<div dir="ltr">Hi Alfredo,<div><br></div><div>I notice that the CenterID for the site is 0. Do you have an entry in the psc table for a CenterID=0?</div><div><br>The problem here is that the data comes from a new scanner and the pipeline tries to first register a new candidate for the scanner (scanner candidate) before adding an entry in the mri_scanner table. To determine the site of the scanner, the pipeline uses the <a href="https://github.com/SPINEProject/Loris-MRI/blob/19f469cce904ebe93ba5f641533e4c0ef39fadab/uploadNeuroDB/NeuroDB/MRIProcessingUtility.pm#L503">determinePSC</a> function of MRIProcessingUtility.pm (called by <a href="http://minc_insertion.pl">minc_insertion.pl</a> in <a href="https://github.com/SPINEProject/Loris-MRI/blob/19f469cce904ebe93ba5f641533e4c0ef39fadab/uploadNeuroDB/minc_insertion.pl#L454">line 454</a>). I would be curious to see what the $center_name and $centerID values returned are.</div><div><br></div><div>Could you also copy the code you have in your prod file for the function getSubjectIDs? </div><div><br></div><div>Finally, could you check that the candidate BGI102001_207019 does have a RegistrationCenterID set and if there is already a screening session created in the session table, that the CenterID of that session has properly been set?</div><div><br></div><div>Thank you!</div><div><br></div><div>Cécile</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 26, 2021 at 2:34 PM Morales Pinzon, Alfredo <<a href="mailto:AMORALESPINZON@bwh.harvard.edu">AMORALESPINZON@bwh.harvard.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
Hi Cécile,
<div><br>
</div>
<div>Thank you for answer. </div>
<div><br>
</div>
<div>I included the following lines:</div>
<div><br>
</div>
<div>===</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(170,171,37)">
<div style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">                  . " NOW(),   'NeuroDB::MRI', 'Scanner'          ) ";</span></div>
<div style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(57,192,38)">
<span style="font-variant-ligatures:no-common-ligatures">+        print "\nCenter ID: " . $centerID . "\n\n";</span></div>
<div style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(57,192,38)">
<span style="font-variant-ligatures:no-common-ligatures">+        print "\nQuery:" . $query . "\n\n";</span></div>
<div style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">         $dbh->do($query);</span></div>
<div style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">     }  </span></div>
</div>
</div>
<div>===</div>
<div><br>
</div>
<div>And I got the following output:</div>
<div><br>
</div>
<div>===</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">perl <a href="http://minc_insertion.pl" target="_blank">minc_insertion.pl</a> -profile prod -force -mincPath /data/BGI102001_207019_screening.mnc -verbose -acquisition_protocol t1c -create_minc_pics</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">log dir is /data_/ipmsa/loris_data/IPMSA/data/logs and log file is /data_/ipmsa/loris_data/IPMSA/data/logs/TarLoad-14-31-d7FH_S.log </span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">    SELECT       ArchiveLocation     FROM       tarchive     WHERE       TarchiveID = (                      SELECT TarchiveID                      FROM tarchive_series                     
 WHERE SeriesUID=? AND EchoTime=?                    ) </span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Center ID: 0</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Query:INSERT INTO candidate (CandID,          PSCID,  RegistrationCenterID, Date_active,   Date_registered, UserID, Entity_type                       ) VALUES (442627, 'scanner',      0,  NOW(), 
   NOW(),   'NeuroDB::MRI', 'Scanner'          ) </span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`IPMSA_LORIS`.`candidate`, CONSTRAINT `FK_candidate_1` FOREIGN KEY (`RegistrationCenterID`) REFERENCES
 `psc` (`CenterID`)) at /data_/ipmsa/loris_data/IPMSA/bin/mri/uploadNeuroDB/NeuroDB/MRI.pm line 1020.</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">ERROR: Failed to insert record in table mri_scanner:</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">The following database commands failed:</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">        PREPARE s FROM 'INSERT INTO mri_scanner (CandID,Model,Manufacturer,Serial_number,Software) VALUES (?,?,?,?,?)';</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">        SET @x1='442627',@x2='Sonata',@x3='Siemens',@x4='syngo_MR_2004A_4VA25A';</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">        EXECUTE s USING @x1,@x2,@x3,@x4,@x5;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Error obtained:Cannot add or update a child row: a foreign key constraint fails (`IPMSA_LORIS`.`mri_scanner`, CONSTRAINT `FK_mri_scanner_1` FOREIGN KEY (`CandID`) REFERENCES `candidate` (`CandID`))
 (error code 1452)</span></div>
</div>
<div>===</div>
<div><br>
</div>
<div>I think it’s important to mention that this candidate was created by the bids importing script. Maybe there is center associated with the candidates when using the bids script?</div>
<div><br>
</div>
<div>Let me know your thoughts.</div>
<div><br>
</div>
<div>Best,</div>
<div>Alfredo.<br>
<div><br>
<blockquote type="cite">
<div>On Nov 26, 2021, at 11:13 AM, Cecile Madjar <<a href="mailto:cecile.madjar@mcin.ca" target="_blank">cecile.madjar@mcin.ca</a>> wrote:</div>
<br>
<div>
<p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)">        External Email - Use Caution        </span></p>
<div><br>
</div>
<div dir="ltr">Thank you Alfredo. 
<div><br>
</div>
<div>I wonder whether the variable $centerID is null when provided to the query
<a href="https://secure-web.cisco.com/1BZxp6fiw85BciAlo2QCPeT44gOAdEJUbAAAM3VJsTVYkl_27h-GCDhXtVO-8fh2ghdX3L0808bpAkrN-4-dTSIuf12yvdTBrdZ5Wl5YcKE3s4BTaFeJPBISOXE6-2TppWqpX8R4fldLsB6dpee4WAltjKy3u6ZJa01r-_Up1j5vB6cy_vbAyEgWl_Ft7ACUJ4VwQkwh01nnF8cpg5ePrLbF5bQw28VLFdg3Uo7dO81Ow5-zFCp5KKdHX0KX7vdIPmPuijtNDX9V5jT_YKMml5cX_tM2IVASxDa-wmo0JijRQ7k6oCTwK52FO0yRmVVeFj4108ZlyK2avqXijVKYreQ/https%3A%2F%2Fgithub.com%2FSPINEProject%2FLoris-MRI%2Fblob%2F19f469cce904ebe93ba5f641533e4c0ef39fadab%2FuploadNeuroDB%2FNeuroDB%2FMRI.pm%23L1012" target="_blank">
here</a> in your case.</div>
<div><br>
</div>
<div>Could you add in MRI.pm line 1018 the following print statements and let me know what you get? (Right before the $dbh->do($query);</div>
<div>print($centerID);</div>
<div>print($query);</div>
<div><br>
</div>
<div>Thank you!</div>
<div><br>
</div>
<div>Cécile</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Nov 26, 2021 at 10:55 AM Morales Pinzon, Alfredo <<a href="mailto:AMORALESPINZON@bwh.harvard.edu" target="_blank">AMORALESPINZON@bwh.harvard.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>Hi Cécile,
<div><br>
</div>
<div>This is the branch that we are using in the IPMSA project:</div>
<div><br>
</div>
<div><a href="https://secure-web.cisco.com/1_p5UjMqREHagXmmz7NxbZe91yrcn34HNneKcFN4qKhR9mT7798DmL7TgbLwjpDr1U0bQaX2Rdqcdu3-l5R95gEJ5AzIbYu4-psDEz9Gw3fmrcgxEel3V6rugNzEisR_jZbIG2f2KPrVumnb1MY-TJCYuPQqzVuM_3KHLYTzVKha7RbWAHq6GLefQmer8auU6BALsWue7RBcrrbG9kbGC-S-e1DZ-WP4gVNTDegrcGaghwyxclA9m6SZqs-OljIR6E7IViTaySgZuDnOp5meeyJlKdlksyj5cGVErq4YprL6I9uHWuLjB-06KBUFTBK6C1E38yyToTkJVVH-8LKRPKg/https%3A%2F%2Fgithub.com%2FSPINEProject%2FLoris-MRI%2Ftree%2Fv23.0.3_IPMSA" target="_blank">https://github.com/SPINEProject/Loris-MRI/tree/v23.0.3_IPMSA</a></div>
<div><br>
</div>
<div>Best,</div>
<div>Alfredo.<br>
<div><br>
<blockquote type="cite">
<div>On Nov 26, 2021, at 9:55 AM, Cecile Madjar <<a href="mailto:cecile.madjar@mcin.ca" target="_blank">cecile.madjar@mcin.ca</a>> wrote:</div>
<br>
<div>
<p><span style="padding:3px 10px;border-radius:5px;color:rgb(255,255,255);font-weight:bold;display:inline-block;background-color:rgb(255,0,0)">        External Email - Use Caution        </span></p>
<div><br>
</div>
<div dir="ltr">Hi Alfredo,
<div><br>
</div>
<div>Could you point me to the version of the code you are using on GitHub so I can take a look at the correct MRI.pm file.</div>
<div><br>
</div>
<div>Thank you!</div>
<div><br>
</div>
<div>Cécile</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Nov 25, 2021 at 8:09 PM Morales Pinzon, Alfredo <<a href="mailto:AMORALESPINZON@bwh.harvard.edu" target="_blank">AMORALESPINZON@bwh.harvard.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>Hi Cécile,
<div><br>
</div>
<div>I’m getting the following error when inserting a minc file using the
<a href="http://secure-web.cisco.com/1TzLj0luctz8Wb38Vv2psbWhbcU-f__EKvLSSaDYgEXmz5b0aqjDuEoOYgCDeNvO_wd_jY7vbVfBPyzukTp8u3bszcvl9RlzkffyCB96NEJ6ldbRDtpB5Dm1t3H6zAKfXwb47TCFKN4jo2cTx22wsEoMCjd40dMRoMr5y7-MMPE_rF9MBpp5uEB4y849W6nkPHoaERmNpP67XVRUarntyB3RrW-aH-TPtdYKd6qDPGkllZKISL3hlhs7AG4CCOQdZEVjiW6N9fr5aaSxBevb9TptNEJgPfB3dj-0XRNXWAt9bp6fvmGUwjIXEdKZVASmz/http%3A%2F%2Fminc_insertion.pl" target="_blank">
minc_insertion.pl</a> script:</div>
<div><br>
</div>
<div>===</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<div style="margin:0px;font-stretch:normal;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">$ perl
<a href="http://secure-web.cisco.com/1TzLj0luctz8Wb38Vv2psbWhbcU-f__EKvLSSaDYgEXmz5b0aqjDuEoOYgCDeNvO_wd_jY7vbVfBPyzukTp8u3bszcvl9RlzkffyCB96NEJ6ldbRDtpB5Dm1t3H6zAKfXwb47TCFKN4jo2cTx22wsEoMCjd40dMRoMr5y7-MMPE_rF9MBpp5uEB4y849W6nkPHoaERmNpP67XVRUarntyB3RrW-aH-TPtdYKd6qDPGkllZKISL3hlhs7AG4CCOQdZEVjiW6N9fr5aaSxBevb9TptNEJgPfB3dj-0XRNXWAt9bp6fvmGUwjIXEdKZVASmz/http%3A%2F%2Fminc_insertion.pl" target="_blank">
minc_insertion.pl</a> -profile prod -force -mincPath /data/BGI102001_207019_screening.mnc  -verbose -acquisition_protocol t1c -create_minc_pics</span></div>
</div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures">DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`IPMSA_LORIS`.`candidate`, CONSTRAINT `FK_candidate_1` FOREIGN KEY (`RegistrationCenterID`) REFERENCES
 `psc` (`CenterID`)) at /data_/ipmsa/loris_data/IPMSA/bin/mri/uploadNeuroDB/NeuroDB/MRI.pm line 1018.</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures">ERROR: Failed to insert record in table mri_scanner:</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures">The following database commands failed:</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre-wrap"></span>PREPARE s FROM 'INSERT INTO mri_scanner (Serial_number,Software,Manufacturer,Model,CandID) VALUES (?,?,?,?,?)';</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre-wrap"></span>SET @x1='syngo_MR_2004A_4VA25A',@x2='Siemens',@x3='Sonata',@x4='247660';</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><span style="white-space:pre-wrap"></span>EXECUTE s USING @x1,@x2,@x3,@x4,@x5;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo">
<span style="font-variant-ligatures:no-common-ligatures">Error obtained:Cannot add or update a child row: a foreign key constraint fails (`IPMSA_LORIS`.`mri_scanner`, CONSTRAINT `FK_mri_scanner_1` FOREIGN KEY (`CandID`) REFERENCES `candidate` (`CandID`))
 (error code 1452)</span></div>
</div>
<div>===</div>
<div><br>
</div>
<div>Could you help me figuring out what is happening? Is there something I should add to the minc headers?</div>
<div><br>
</div>
<div>Best,</div>
<div>Alfredo.<br>
<div><br>
</div>
</div>
<div>The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine
 at <a href="http://secure-web.cisco.com/10DEfcj-Ova6W7NFLUPao--zc_ba_3Yk63CTqhSG5Ca4FJWekd8J8afbwCr_p31UYqWdlWd2rAqSBE3jLmNtkj6jzu0Deh3bP7WsUj3yX1B4Iv_RzcWr2nfZ7f8_OUQvlNL5D_jqwZyNdyv_JUiP0dLvm0NprWoJtFmmA4jwKQ4X8BKNoa6LBbiWMVYizEQDtUP5c9bc0XDPr-wYz3SlyBzIrLOxha8XYY4l8tLxS_skKp_uX_4jMesLtI_DCQza3WckhpQ7-43tcveIJ9vz-wKKRp31RbQkfDcbgexXsRG1oCpy-6zP8ggtvzNLZ0VSxSBDRZD7ti7dI0bPJXah5pg/http%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline" target="_blank">
http://www.massgeneralbrigham.org/complianceline</a> . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.</div>
<br>
<p class="MsoNormal">Please note that this e-mail is not secure (encrypted).  If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving
 this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail. 
</p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<div>The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine
 at <a href="http://secure-web.cisco.com/1_sf0B_pY6Veyn85uEgw5ObBiM-QA382bc3nDvcSdrZOKA6no0I3vr4IK-5T3aDVnNH0xdP0QPSlWZoWkQ_GwFwWpmsSr4ck4dMGnU4VytPp-LDqG94cvmqnN5tL76lwADrn6xIQWpzuk5L8BVaZWrrrGjDSpYdGwV3AIPq2zzJhN9hBT5o5FBx0LlHEf-E7onD9zSqkkZiu9_atJraKUgpCCauEab0PbqWsTxYk0edTnIC6LbDq3t55qVy6FVWQybcR-n1rq2GND31ubWD7fk0h2dvddl4PnBk7PwnBZ6n6Q3S6lZvD9wWk_5ShEkjxI4GLdc2m60Frytk5an8XeeQ/http%3A%2F%2Fwww.massgeneralbrigham.org%2Fcomplianceline" target="_blank">
http://www.massgeneralbrigham.org/complianceline</a> . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.</div>
<br>
<p class="MsoNormal">Please note that this e-mail is not secure (encrypted).  If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving
 this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail. 
</p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<div>The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at <a href="http://www.massgeneralbrigham.org/complianceline" target="_blank">http://www.massgeneralbrigham.org/complianceline</a> . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.</div><br>
<p class="MsoNormal">Please note that this e-mail is not secure
(encrypted).  If you do not wish to continue communication over
unencrypted e-mail, please notify the sender of this message immediately.  Continuing to send or respond to e-mail after receiving this message means you
understand and accept this risk and wish to continue to communicate over
unencrypted e-mail.  </p></div>

</blockquote></div>