gdc-common-utils-ts 2.3.15 → 2.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,6 +37,9 @@ export type ClinicalResourceDisplayOptions = Readonly<{
|
|
|
37
37
|
/**
|
|
38
38
|
* Product terminology lookup keyed by canonical `system|code`.
|
|
39
39
|
*
|
|
40
|
+
* The token is resolved claims-first, so translations remain available when
|
|
41
|
+
* a `$summary` readback keeps `Coding.display` but omits native coding fields.
|
|
42
|
+
*
|
|
40
43
|
* Return `undefined` when the product has no translation so the shared
|
|
41
44
|
* reader can fall back to the international `Coding.display`.
|
|
42
45
|
*/
|
|
@@ -315,7 +315,8 @@ function resolveTitle(resourceType, claims, resource, options = {}) {
|
|
|
315
315
|
resource,
|
|
316
316
|
options,
|
|
317
317
|
concept: primaryConcept,
|
|
318
|
-
token:
|
|
318
|
+
token: resolvePrimaryClaimCodeToken(resourceType, claims)
|
|
319
|
+
|| resolveCodeableConceptToken(primaryConcept),
|
|
319
320
|
}) || resolveFhirResourceTitle(resourceType, resource) || resourceType;
|
|
320
321
|
}
|
|
321
322
|
function resolveLocalizedCodedTitle(input) {
|
|
@@ -613,6 +614,32 @@ function findBySuffix(claims, keySuffix) {
|
|
|
613
614
|
function findFirstClaimBySuffixes(claims, suffixes) {
|
|
614
615
|
return firstDefinedText(suffixes.map((suffix) => findBySuffix(claims, suffix)));
|
|
615
616
|
}
|
|
617
|
+
function resolvePrimaryClaimCodeToken(resourceType, claims) {
|
|
618
|
+
const suffixes = resourceType === ResourceTypesFhirR4.Immunization
|
|
619
|
+
|| resourceType === ResourceTypesFhirR4.ImmunizationRecommendation
|
|
620
|
+
? ['vaccine-code', 'code']
|
|
621
|
+
: resourceType === ResourceTypesFhirR4.Device
|
|
622
|
+
|| resourceType === ResourceTypesFhirR4.DocumentReference
|
|
623
|
+
|| resourceType === ResourceTypesFhirR4.Specimen
|
|
624
|
+
? ['type', 'code']
|
|
625
|
+
: resourceType === ResourceTypesFhirR4.ImagingStudy
|
|
626
|
+
? ['procedure-code', 'code']
|
|
627
|
+
: resourceType === ResourceTypesFhirR4.CarePlan
|
|
628
|
+
? ['category', 'code']
|
|
629
|
+
: ['code'];
|
|
630
|
+
const normalizedResourceType = resourceType.toLowerCase();
|
|
631
|
+
for (const suffix of suffixes) {
|
|
632
|
+
const token = findBySuffix(claims, `${normalizedResourceType}.${suffix}`);
|
|
633
|
+
const firstToken = splitCsv(token)[0];
|
|
634
|
+
if (firstToken)
|
|
635
|
+
return firstToken;
|
|
636
|
+
}
|
|
637
|
+
const system = findBySuffix(claims, `${normalizedResourceType}.code-system`);
|
|
638
|
+
const code = findBySuffix(claims, `${normalizedResourceType}.code-value`);
|
|
639
|
+
if (code)
|
|
640
|
+
return system ? `${system}|${code}` : code;
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
616
643
|
function resolveResourceCodeText(resource) {
|
|
617
644
|
return trimValue(asRecord(resource?.code).text) || undefined;
|
|
618
645
|
}
|