fix: Patient name handling as either Alphabetic object or simply string object

- formatPN should accept a string person name as well as an object with a Alphabetic field.
- For DICOM JSON data sources, spread in the patient data from the study object into the instance.
This commit is contained in:
Joe Boccanfuso 2023-02-16 13:50:59 -05:00 committed by GitHub
parent b67c7b23e8
commit ae4183852f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -206,8 +206,10 @@ function createDicomJSONApi(dicomJsonConfig) {
url: instance.url, url: instance.url,
imageId: instance.url, imageId: instance.url,
...series, ...series,
...study,
}; };
delete obj.instances; delete obj.instances;
delete obj.series;
return obj; return obj;
}); });
storeInstances(instances); storeInstances(instances);

View File

@ -211,7 +211,7 @@ function TrackedCornerstoneViewport(props) {
seriesDescription: SeriesDescription, seriesDescription: SeriesDescription,
patientInformation: { patientInformation: {
patientName: PatientName patientName: PatientName
? OHIF.utils.formatPN(PatientName.Alphabetic) ? OHIF.utils.formatPN(PatientName)
: '', : '',
patientSex: PatientSex || '', patientSex: PatientSex || '',
patientAge: PatientAge || '', patientAge: PatientAge || '',

View File

@ -6,9 +6,11 @@ export default function formatPN(name) {
return; return;
} }
const nameToUse = name.Alphabetic ?? name;
// Convert the first ^ to a ', '. String.replace() only affects // Convert the first ^ to a ', '. String.replace() only affects
// the first appearance of the character. // the first appearance of the character.
const commaBetweenFirstAndLast = name.replace('^', ', '); const commaBetweenFirstAndLast = nameToUse.replace('^', ', ');
// Replace any remaining '^' characters with spaces // Replace any remaining '^' characters with spaces
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' '); const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');