|
@@ -19,14 +19,17 @@ fconfig=os.path.join(fhome,'.labkey','network.json')
|
|
|
net=labkeyInterface.labkeyInterface()
|
|
|
net.init(fconfig)
|
|
|
db=labkeyDatabaseBrowser.labkeyDB(net)
|
|
|
+fb=labkeyFileBrowser.labkeyFileBrowser(net)
|
|
|
|
|
|
-
|
|
|
+tempDir=os.path.join(os.path.expanduser('~'),'temp')
|
|
|
#also need merlin credentials
|
|
|
|
|
|
fconfigMerlin=os.path.join(fhome,'.labkey','merlin.json')
|
|
|
netMerlin=labkeyInterface.labkeyInterface()
|
|
|
netMerlin.init(fconfigMerlin)
|
|
|
dbMerlin=labkeyDatabaseBrowser.labkeyDB(netMerlin)
|
|
|
+fbMerlin=labkeyFileBrowser.labkeyFileBrowser(netMerlin)
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -48,6 +51,32 @@ for row in ds['rows']:
|
|
|
outRow=copy.deepcopy(row)
|
|
|
outRow['PatientId']='{}-{}'.format(nixID,row['PatientId'])
|
|
|
dbMerlin.modifyRows('insert',merlinProject,'study',merlinDataset,[outRow])
|
|
|
-
|
|
|
+
|
|
|
+#
|
|
|
print('Done')
|
|
|
+quit()
|
|
|
+
|
|
|
+imagingDataset="AnonymousImaging1?"
|
|
|
+merlinImagingDataset="Imaging1"
|
|
|
+imageDir="preprocessedImages"
|
|
|
+ds=db.selectRows(project,'study',imagingDataset,[],)
|
|
|
+for row in ds['rows']:
|
|
|
+ ofiles=[row['preprocessedCT'],row['preprocessedPET']]
|
|
|
+ pCode=row['PatientCode']
|
|
|
+ vCode=row['visitCode']
|
|
|
+ for ofile in ofiles:
|
|
|
+ xPath=[imageDir,pCode,vCode]
|
|
|
+ xPath.append(ofile)
|
|
|
+ path='/'.join(xPath)
|
|
|
+ localPath=os.path.join(tempDir,ofile)
|
|
|
+ remotePath=fb.formatPathURL(project,path)
|
|
|
+ fb.readFileToFile(remotePath,localPath)
|
|
|
+ merlinPath=fbMerlin.buildPathURL(merlinProject,xPath)
|
|
|
+ fbMerlin.writeFileToFile(localPath,merlinPath)
|
|
|
+ outRow=copy.deepcopy(row)
|
|
|
+ outRow['PatientId']='{}-{}'.format(nixID,row['PatientId'])
|
|
|
+ dbMerlin.modifyRows('insert',merlinProject,'study',merlinImagingDataset,[outRow])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|