Skip to content

Commit

Permalink
add syncSeries to import Series
Browse files Browse the repository at this point in the history
  • Loading branch information
nanli-emory committed Apr 5, 2024
1 parent d2050a8 commit da54165
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
12 changes: 8 additions & 4 deletions apps/dicom-connect/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ function initialize() {
return '<div class="icon-center" title="Loading..."><i class="fas fa-spinner fa-spin"></i></div>';
case 'unsync':
// return btn
const seriesId = row['0020000E']['Value'][0]
return `<div class="icon-center"><button onClick="syncSeries('${row.source}', '${row.studyId}', '${seriesId}')" class="btn btn-sm btn-primary" title="Sync Series"><i class="fas fa-cloud-download-alt"></i></button></div>`; //<i class="fas fa-cloud-download-alt"></i>
const seriesId = row['0020000E']['Value'][0];
const modality = row['00080060']['Value'][0];
return `<div class="icon-center"><button onClick="syncSeries('${row.source}', '${row.studyId}', '${seriesId}', '${modality}')" class="btn btn-sm btn-primary" title="Sync Series"><i class="fas fa-cloud-download-alt"></i></button></div>`; //<i class="fas fa-cloud-download-alt"></i>
case 'syncing':
// return downloading
// return '<div class="icon-center"><i class="fas fa-pen"></i></div>';
Expand Down Expand Up @@ -300,8 +301,11 @@ $(document).ready(function() {
});


function syncSeries(source, studyId, seriesId) {
console.log(`syncSeries: ${source}, ${studyId}, ${seriesId}`)
async function syncSeries(source_url, study, series, modality) {
console.log(source_url, study, series, modality);
const result = await store.syncSeries('../../../', {source_url, study, series, modality})
console.log('syncSeries:');
console.log(result);
}

function checkSeriesStatus() {
Expand Down
30 changes: 29 additions & 1 deletion core/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function objToParamStr(obj) {
class Store {
constructor(base, validation, config) {
this.base = base || './data/';

Check failure on line 39 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 39 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
this.validation = validation || {};
this.config = config;
}
Expand Down Expand Up @@ -945,7 +946,34 @@ class Store {
body: JSON.stringify(update),
});
}

/***

Check failure on line 949 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected space or tab after '/**' in comment

Check failure on line 949 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Expected space or tab after '/**' in comment
* dicom api start
*

Check failure on line 951 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 951 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
*/
async syncSeries(baseUrl, data = {}) {
// the data structure:
// const {source_url, study, series, modality} = data

const suffix = 'loader/dicomWeb/importSeries';
const url = baseUrl + suffix;

Check failure on line 958 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 958 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
// Default options are marked with *
const response = await fetch(url, {
method: "POST",

Check failure on line 961 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Strings must use singlequote

Check failure on line 961 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 961 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Strings must use singlequote

Check failure on line 961 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
mode: "cors",

Check failure on line 962 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Strings must use singlequote

Check failure on line 962 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 962 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Strings must use singlequote

Check failure on line 962 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
cache: "no-cache",

Check failure on line 963 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Strings must use singlequote

Check failure on line 963 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Trailing spaces not allowed

Check failure on line 963 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Strings must use singlequote

Check failure on line 963 in core/Store.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
headers: {
"Content-Type": "application/json",
},
redirect: "follow",
referrerPolicy: "no-referrer",
body: JSON.stringify(data),
});
return response.json();
}
/***
* dicom api end
*
*/
addPresetLabels(labels) {
const suffix = 'Presetlabels/add';
const url = this.base + suffix;
Expand Down

0 comments on commit da54165

Please sign in to comment.