This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a tool to upload edf metadata to the ASCLEPIOS SSE service and execute it after extracting metadata
- Loading branch information
Showing
4 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
|
||
const { uploadData } = require('asclepios-sse-client'); | ||
const { ArgumentParser } = require('argparse'); | ||
const { execFile } = require('child_process'); | ||
let parser = new ArgumentParser({}); | ||
|
||
parser.addArgument('-xnatID', { required: true}); | ||
parser.addArgument('-host', { required: true }); | ||
parser.addArgument('-user', { required: true }); | ||
parser.addArgument('-pwd', { required: true }); | ||
|
||
const { xnatID, host, user, pwd } = parser.parseArgs(); | ||
const XnatDataClient = '/data/xnat/pipeline/xnat-tools/XnatDataClient' | ||
const args = ['-u', user, '-p', pwd, '-r', `${host}/REST/experiments/${xnatID}/scans/psg?format=json`]; | ||
|
||
const { SSE_URL, SSE_KEY_G, SSE_KENC, TA_URL, SALT_VALUE, IV_VALUE } = process.env; | ||
|
||
if (!(SSE_URL && SSE_KEY_G && SSE_KENC && TA_URL && SALT_VALUE && IV_VALUE)) { | ||
throw 'One or more of the following environment variables are on set: ' + | ||
'SSE_URL, SSE_KEY_G, SSE_KENC, TA_URL, SALT_VALUE, IV_VALUE'; | ||
} | ||
|
||
execFile(XnatDataClient, args, function callback(error, stdout, stderr) { | ||
if (error) { | ||
console.error(stderr); | ||
throw error; | ||
} | ||
const session = JSON.parse(stdout); | ||
const data = session.items[0].data_fields; | ||
|
||
uploadData(data, data.image_session_ID, SSE_KEY_G, SSE_KENC); | ||
}); |
25 changes: 25 additions & 0 deletions
25
resources/catalog/somnonetz-pipeline/resources/upload_to_sse.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<pip:Resource xmlns:pip="http://nrg.wustl.edu/pipeline"> | ||
<pip:name>upload_to_sse</pip:name> | ||
<pip:location>somnonetz-pipeline/bin</pip:location> | ||
<pip:type>Executable</pip:type> | ||
<pip:description>Upload EDF metadata to the ASCLEPIOS symmetric searchable encryption service</pip:description> | ||
<pip:input> | ||
<pip:argument id="xnatID"> | ||
<pip:name>xnatID</pip:name> | ||
<pip:description>XNAT Session ID</pip:description> | ||
</pip:argument> | ||
<pip:argument id="host"> | ||
<pip:name>host</pip:name> | ||
<pip:description>XNAT Host</pip:description> | ||
</pip:argument> | ||
<pip:argument id="user"> | ||
<pip:name>user</pip:name> | ||
<pip:description>XNAT Username</pip:description> | ||
</pip:argument> | ||
<pip:argument id="pwd" isSensitive="true"> | ||
<pip:name>pwd</pip:name> | ||
<pip:description>XNAT Password</pip:description> | ||
</pip:argument> | ||
</pip:input> | ||
</pip:Resource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters