fhir-data-utils-ts 0.6.11 → 0.6.12
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.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Canonicalize native FHIR relative subject references at the shared clinical
|
|
6
|
+
editor boundary before claims-first operations, while preserving governed
|
|
7
|
+
URN and `did:web` identifiers unchanged.
|
|
8
|
+
|
|
5
9
|
- Add the shared clinical-artifact editor boundary for native FHIR R4 imports:
|
|
6
10
|
hydrate only schema-owned fields, materialize supported IPS resources from
|
|
7
11
|
editor plus host-owned claims, and prove FHIR-to-form-to-FHIR semantic
|
|
@@ -2,6 +2,12 @@ import { type FhirIpsClinicalArtifactSchema, type FhirIpsClinicalArtifactType }
|
|
|
2
2
|
export type ClinicalArtifactFhirR4Resource = Readonly<Record<string, unknown> & {
|
|
3
3
|
resourceType: FhirIpsClinicalArtifactType;
|
|
4
4
|
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Converts a native FHIR relative subject reference into the canonical actor
|
|
7
|
+
* reference accepted by claims-first persistence. Existing governed URNs and
|
|
8
|
+
* did:web identifiers pass through unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export declare function canonicalClinicalSubjectReference(subjectReference: string): string;
|
|
5
11
|
/** Host-owned subject claims added only at the trusted materialization boundary. */
|
|
6
12
|
export declare function clinicalArtifactSubjectClaims(resourceType: FhirIpsClinicalArtifactType, subjectReference: string): Readonly<Record<string, string>>;
|
|
7
13
|
/**
|
|
@@ -7,6 +7,20 @@ import { ImmunizationClaim } from './claims/immunization-claims.js';
|
|
|
7
7
|
import { MedicationStatementClaim } from './claims/medication-statement-claims.js';
|
|
8
8
|
import { ProcedureClaim } from './claims/procedure-claims.js';
|
|
9
9
|
import { ObservationClaim } from './observation-claims.js';
|
|
10
|
+
/**
|
|
11
|
+
* Converts a native FHIR relative subject reference into the canonical actor
|
|
12
|
+
* reference accepted by claims-first persistence. Existing governed URNs and
|
|
13
|
+
* did:web identifiers pass through unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export function canonicalClinicalSubjectReference(subjectReference) {
|
|
16
|
+
const normalized = subjectReference.trim();
|
|
17
|
+
if (/^(?:urn:[^\s]+|did:web:[^\s]+)$/.test(normalized))
|
|
18
|
+
return normalized;
|
|
19
|
+
const relativeReference = /^[A-Z][A-Za-z]+\/([^/\s]+)$/.exec(normalized);
|
|
20
|
+
if (!relativeReference)
|
|
21
|
+
throw new TypeError('clinical_artifact_subject_reference_invalid');
|
|
22
|
+
return `urn:uuid:${relativeReference[1]}`;
|
|
23
|
+
}
|
|
10
24
|
/** Host-owned subject claims added only at the trusted materialization boundary. */
|
|
11
25
|
export function clinicalArtifactSubjectClaims(resourceType, subjectReference) {
|
|
12
26
|
const claim = {
|
|
@@ -17,7 +31,7 @@ export function clinicalArtifactSubjectClaims(resourceType, subjectReference) {
|
|
|
17
31
|
[FhirIpsClinicalArtifactTypes.Procedure]: ProcedureClaim.Subject,
|
|
18
32
|
[FhirIpsClinicalArtifactTypes.Observation]: ObservationClaim.Subject,
|
|
19
33
|
}[resourceType];
|
|
20
|
-
return Object.freeze({ [claim]: subjectReference });
|
|
34
|
+
return Object.freeze({ [claim]: canonicalClinicalSubjectReference(subjectReference) });
|
|
21
35
|
}
|
|
22
36
|
/**
|
|
23
37
|
* Hydrates one schema-driven editor from a native FHIR R4 resource.
|