Skip to content

Commit

Permalink
new configuration UiOptions.ShowSamePatientStudiesFilter to list the …
Browse files Browse the repository at this point in the history
…tags that
  • Loading branch information
amazy committed Nov 27, 2023
1 parent 8147c05 commit 8914e48
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
9 changes: 8 additions & 1 deletion Plugin/DefaultConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@
"AllowedModes": ["modify-new-uids", "modify-keep-uids", "duplicate"],
"DefaultMode": "modify-new-uids"

}
},

// List of tags that are used to identify studies belonging to the same patient.
// This appears as "This patient has {count} studies in total" in the study details.
// ex: "ShowSamePatientStudiesFilter" : ["PatientID", "PatientBirthDate", "PatientSex"]
"ShowSamePatientStudiesFilter" : [
"PatientID"
]
},

"Shares" : {
Expand Down
4 changes: 2 additions & 2 deletions WebApplication/src/components/ModifyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
methods: {
async reset() {
this.step = 'init';
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.patientMainDicomTags['PatientID'])).length;
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.patientMainDicomTags, ['PatientID'])).length; // here, we only use the PatientID since this is the only tag used by Orthanc when modifying the resources
this.hasLoadedSamePatientsStudiesCount = true;
this.tags = {};
Expand Down Expand Up @@ -209,7 +209,7 @@ export default {
}
} else if ('PatientName' in this.modifiedTags || 'PatientBirthDate' in this.modifiedTags || 'PatientSex' in this.modifiedTags) {
console.log("modify-any-tags-in-one-study: Patient tags have changed");
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.originalTags['PatientID'])).length;
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.originalTags, ['PatientID'])).length; // here, we only use the PatientID since this is the only tag used by Orthanc when modifying the resources
if (this.samePatientStudiesCount > 1) {
console.error("modify-any-tags-in-one-study: Error while modifying patient-study tags, this patient has other studies, you can not modify patient tags ", this.originalTags['PatientID'], this.modifiedTags);
this.setError('modify.error_modify_any_study_tags_can_not_modify_patient_tags_because_of_other_studies_html');
Expand Down
18 changes: 16 additions & 2 deletions WebApplication/src/components/StudyDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
this.allLabelsLocalCopy = await api.loadAllLabels();
},
async mounted() {
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.patientMainDicomTags['PatientID'])).length;
this.samePatientStudiesCount = (await api.getSamePatientStudies(this.patientMainDicomTags, this.uiOptions.ShowSamePatientStudiesFilter)).length;
this.hasLoadedSamePatientsStudiesCount = true;
Tags.init();
},
Expand All @@ -35,7 +35,21 @@ export default {
}),
selectedValues() {
return this.labelsModel.join(",");
},
sampePatientStudiesLink() {
let filters = [];
for (let tag of this.uiOptions.ShowSamePatientStudiesFilter) {
if (tag in this.patientMainDicomTags) {
if (tag in ["PatientBirthDate"]) {
filters.push(tag + "=" + this.patientMainDicomTags[tag] + "");
} else {
filters.push(tag + "=\"" + this.patientMainDicomTags[tag] + "\"");
}
}
}
return "/filtered-studies?" + filters.join('&');
}
},
components: { SeriesItem, SeriesList, ResourceButtonGroup, ResourceDetailText },
methods: {
Expand Down Expand Up @@ -101,7 +115,7 @@ export default {
</ul>
<p v-if="hasLoadedSamePatientsStudiesCount && samePatientStudiesCount > 1">
{{ $t('this_patient_has_other_studies', { count: samePatientStudiesCount }) }}.
<router-link v-bind:to='"/filtered-studies?PatientID=\"" + patientMainDicomTags["PatientID"] + "\""' >
<router-link v-bind:to='sampePatientStudiesLink' >
{{ $t('this_patient_has_other_studies_show') }}
</router-link>
</p>
Expand Down
17 changes: 13 additions & 4 deletions WebApplication/src/orthancApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,22 @@ export default {
const response = (await axios.get(orthancApiUrl + "changes?since=" + since + "&limit=" + limit));
return response.data;
},
async getSamePatientStudies(patientId) {
async getSamePatientStudies(patientTags, tags) {
if (!tags || tags.length == 0) {
console.error("Unable to getSamePatientStudies if 'tags' is not defined or empty");
return {};
}

let query = {};
for (let tag of tags) {
if (tag in patientTags) {
query[tag] = patientTags[tag];
}
}
const response = (await axios.post(orthancApiUrl + "tools/find", {
"Level": "Study",
"Limit": store.state.configuration.uiOptions.MaxStudiesDisplayed,
"Query": {
"PatientID": patientId
},
"Query": query,
"Expand": false
}));
return response.data;
Expand Down
2 changes: 2 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changes:
- added a button to download multiple studies at once (only available if running an
Orthanc version > 1.12.1 - not officially released at the time this plugin was
released)
- new configuration "UiOptions.ShowSamePatientStudiesFilter" to list the tags that
are used to identify studies belonging to the same patient.
- added Russian translations


Expand Down

0 comments on commit 8914e48

Please sign in to comment.