fhir-data-utils-ts 0.6.12 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.16 - 2026-10-07
6
+
7
+ - Export the required FHIR R4 code bindings used by reusable IPS authoring
8
+ forms, keyed by their exact flat claim. The canonical code is stable while
9
+ English and Spanish presentation labels follow the user's locale. Fields
10
+ with extensible or example bindings remain terminology searches instead of
11
+ being incorrectly constrained to a closed dropdown.
12
+
13
+ ## 0.6.14 - 2026-10-06
14
+
15
+ - Own the product-neutral HL7 v2-0203 person and healthcare identifier-type
16
+ catalog used by FHIR adapters, including national, passport, driving licence,
17
+ health, insurance-member/subscriber, donor and patient identifiers. Contact
18
+ points and veterinary evidence remain in their respective standards.
19
+
20
+ - Add a reusable, data-only `CommunicationRequest` form schema backed by
21
+ canonical flat claims, including exact Patient, RelatedPerson or Group
22
+ recipients, information providers, Encounter context and referenced or
23
+ attached payloads. Projection adapters are deliberately limited to the
24
+ published FHIR R4 and R5 specifications; no R6 API is exposed.
25
+
5
26
  - Canonicalize native FHIR relative subject references at the shared clinical
6
27
  editor boundary before claims-first operations, while preserving governed
7
28
  URN and `did:web` identifiers unchanged.
package/README.md CHANGED
@@ -216,6 +216,20 @@ CommunicationRequest against a frozen Group snapshot. See
216
216
  [the contract guide](docs/CARE_EMERGENCY_ALERT_CONTRACTS.md). Product policy,
217
217
  access, encryption and delivery do not belong in these builders.
218
218
 
219
+ ## Communication request authoring
220
+
221
+ `FHIR_COMMUNICATION_REQUEST_FORM_SCHEMA` and its typed adapters are exported
222
+ from `fhir-data-utils-ts/data`. They let Personal and Professional portals use
223
+ the same fields while keeping UI labels, widgets and authorization outside this
224
+ package. Recipients remain exact FHIR references, so a request can target the
225
+ patient and only the authorized `RelatedPerson` records selected for that
226
+ message. `requester` records who prepared the request and
227
+ `informationProviders` records the professionals expected to supply or review
228
+ its content; neither field grants permission by itself.
229
+
230
+ The package exposes separate `CommunicationRequest` projections for published
231
+ FHIR R4 and FHIR R5. It intentionally exposes no R6 or combined R5/R6 adapter.
232
+
219
233
  ## Clinical documents and Encounter journeys
220
234
 
221
235
  A FHIR document always starts with `Composition`; `Encounter` is its optional
@@ -3,19 +3,31 @@ import type { ClaimSpec } from './claim-types.js';
3
3
  export declare const CommunicationRequestClaim: Readonly<{
4
4
  readonly Identifier: "CommunicationRequest.identifier";
5
5
  readonly BasedOn: "CommunicationRequest.based-on";
6
+ readonly Replaces: "CommunicationRequest.replaces";
7
+ readonly GroupIdentifier: "CommunicationRequest.group-identifier";
6
8
  readonly Status: "CommunicationRequest.status";
9
+ readonly StatusReason: "CommunicationRequest.status-reason";
10
+ readonly Intent: "CommunicationRequest.intent";
7
11
  readonly Priority: "CommunicationRequest.priority";
8
12
  readonly Category: "CommunicationRequest.category";
13
+ readonly DoNotPerform: "CommunicationRequest.do-not-perform";
14
+ readonly Medium: "CommunicationRequest.medium";
9
15
  readonly Subject: "CommunicationRequest.subject";
10
16
  readonly About: "CommunicationRequest.about";
11
17
  readonly Encounter: "CommunicationRequest.encounter";
12
18
  readonly Requester: "CommunicationRequest.requester";
13
19
  readonly Recipient: "CommunicationRequest.recipient";
20
+ readonly InformationProvider: "CommunicationRequest.information-provider";
14
21
  readonly AuthoredOn: "CommunicationRequest.authored-on";
15
22
  readonly Occurrence: "CommunicationRequest.occurrence";
16
23
  readonly ReasonCode: "CommunicationRequest.reason-code";
17
24
  readonly ReasonReference: "CommunicationRequest.reason-reference";
18
25
  readonly PayloadContent: "CommunicationRequest.payload-content";
26
+ readonly PayloadReference: "CommunicationRequest.payload-reference";
27
+ readonly PayloadAttachmentContentType: "CommunicationRequest.payload-attachment-content-type";
28
+ readonly PayloadAttachmentData: "CommunicationRequest.payload-attachment-data";
29
+ readonly PayloadAttachmentTitle: "CommunicationRequest.payload-attachment-title";
30
+ readonly Note: "CommunicationRequest.note";
19
31
  }>;
20
32
  export type CommunicationRequestClaimKey = typeof CommunicationRequestClaim[keyof typeof CommunicationRequestClaim];
21
33
  export declare const CommunicationRequestClaimSpecs: readonly ClaimSpec[];
@@ -2,26 +2,58 @@
2
2
  export const CommunicationRequestClaim = Object.freeze({
3
3
  Identifier: 'CommunicationRequest.identifier',
4
4
  BasedOn: 'CommunicationRequest.based-on',
5
+ Replaces: 'CommunicationRequest.replaces',
6
+ GroupIdentifier: 'CommunicationRequest.group-identifier',
5
7
  Status: 'CommunicationRequest.status',
8
+ StatusReason: 'CommunicationRequest.status-reason',
9
+ Intent: 'CommunicationRequest.intent',
6
10
  Priority: 'CommunicationRequest.priority',
7
11
  Category: 'CommunicationRequest.category',
12
+ DoNotPerform: 'CommunicationRequest.do-not-perform',
13
+ Medium: 'CommunicationRequest.medium',
8
14
  Subject: 'CommunicationRequest.subject',
9
15
  About: 'CommunicationRequest.about',
10
16
  Encounter: 'CommunicationRequest.encounter',
11
17
  Requester: 'CommunicationRequest.requester',
12
18
  Recipient: 'CommunicationRequest.recipient',
19
+ InformationProvider: 'CommunicationRequest.information-provider',
13
20
  AuthoredOn: 'CommunicationRequest.authored-on',
14
21
  Occurrence: 'CommunicationRequest.occurrence',
15
22
  ReasonCode: 'CommunicationRequest.reason-code',
16
23
  ReasonReference: 'CommunicationRequest.reason-reference',
17
24
  PayloadContent: 'CommunicationRequest.payload-content',
25
+ PayloadReference: 'CommunicationRequest.payload-reference',
26
+ PayloadAttachmentContentType: 'CommunicationRequest.payload-attachment-content-type',
27
+ PayloadAttachmentData: 'CommunicationRequest.payload-attachment-data',
28
+ PayloadAttachmentTitle: 'CommunicationRequest.payload-attachment-title',
29
+ Note: 'CommunicationRequest.note',
18
30
  });
19
31
  export const CommunicationRequestClaimSpecs = Object.freeze([
20
32
  { key: CommunicationRequestClaim.Identifier, meaning: 'Business identifier.', example: 'urn:uuid:campaign-1' },
33
+ { key: CommunicationRequestClaim.BasedOn, meaning: 'Requests fulfilled in whole or in part.', example: 'ServiceRequest/request-1' },
34
+ { key: CommunicationRequestClaim.Replaces, meaning: 'Earlier requests superseded by this request.', example: 'CommunicationRequest/request-0' },
35
+ { key: CommunicationRequestClaim.GroupIdentifier, meaning: 'Shared identifier for one request group.', example: 'urn:uuid:request-group-1' },
21
36
  { key: CommunicationRequestClaim.Status, meaning: 'Request lifecycle status.', example: 'active' },
37
+ { key: CommunicationRequestClaim.StatusReason, meaning: 'Coded explanation for the lifecycle status.', example: 'http://terminology.hl7.org/CodeSystem/request-status-reason|paused' },
38
+ { key: CommunicationRequestClaim.Intent, meaning: 'Published R5 request intent.', example: 'proposal' },
22
39
  { key: CommunicationRequestClaim.Priority, meaning: 'Delivery priority.', example: 'routine' },
23
40
  { key: CommunicationRequestClaim.Category, meaning: 'Communication category token.', example: 'http://terminology.hl7.org/CodeSystem/communication-category|notification' },
41
+ { key: CommunicationRequestClaim.DoNotPerform, meaning: 'Whether the requested communication must not occur.', example: 'false' },
42
+ { key: CommunicationRequestClaim.Medium, meaning: 'Requested communication medium token.', example: 'http://terminology.hl7.org/CodeSystem/v3-ParticipationMode|WRITTEN' },
24
43
  { key: CommunicationRequestClaim.Subject, meaning: 'Subject or evaluated Group reference.', example: 'Group/snapshot-1' },
44
+ { key: CommunicationRequestClaim.About, meaning: 'Resources that the communication request concerns.', example: 'DiagnosticReport/report-1' },
45
+ { key: CommunicationRequestClaim.Encounter, meaning: 'Encounter context for the request.', example: 'Encounter/emergency-1' },
25
46
  { key: CommunicationRequestClaim.Requester, meaning: 'Requesting organization or service.', example: 'Organization/blood-bank-1' },
47
+ { key: CommunicationRequestClaim.Recipient, meaning: 'Exact intended recipient references.', example: 'Patient/patient-1,RelatedPerson/family-1' },
48
+ { key: CommunicationRequestClaim.InformationProvider, meaning: 'Actors expected to provide or review message information.', example: 'PractitionerRole/doctor-1' },
26
49
  { key: CommunicationRequestClaim.AuthoredOn, meaning: 'Request authoring time.', example: '2026-09-26T11:00:00Z' },
50
+ { key: CommunicationRequestClaim.Occurrence, meaning: 'Requested delivery time.', example: '2026-09-26T11:30:00Z' },
51
+ { key: CommunicationRequestClaim.ReasonCode, meaning: 'Coded reasons for the request.', example: 'http://snomed.info/sct|246205007' },
52
+ { key: CommunicationRequestClaim.ReasonReference, meaning: 'Resource references supporting the request reason.', example: 'Condition/condition-1' },
53
+ { key: CommunicationRequestClaim.PayloadContent, meaning: 'R4 string payload compatibility value.', example: 'Family update ready for review.' },
54
+ { key: CommunicationRequestClaim.PayloadReference, meaning: 'Referenced message content.', example: 'DocumentReference/update-1' },
55
+ { key: CommunicationRequestClaim.PayloadAttachmentContentType, meaning: 'Attachment media type.', example: 'application/pdf' },
56
+ { key: CommunicationRequestClaim.PayloadAttachmentData, meaning: 'Base64-encoded attachment data.', example: 'JVBERi0xLjQ=' },
57
+ { key: CommunicationRequestClaim.PayloadAttachmentTitle, meaning: 'Human-readable attachment title.', example: 'Clinical update' },
58
+ { key: CommunicationRequestClaim.Note, meaning: 'Request note.', example: 'Call before sending.' },
27
59
  ]);
@@ -0,0 +1,26 @@
1
+ export type FhirClinicalCodedOption = Readonly<{
2
+ code: string;
3
+ labels: Readonly<{
4
+ en: string;
5
+ es: string;
6
+ }>;
7
+ }>;
8
+ export type FhirClinicalCodedOptionSet = Readonly<{
9
+ fhirVersion: 'R4';
10
+ binding: 'required';
11
+ system: string;
12
+ options: readonly FhirClinicalCodedOption[];
13
+ }>;
14
+ /**
15
+ * Required FHIR R4 code bindings used by the reusable IPS artifact editor.
16
+ *
17
+ * Extensible and example bindings deliberately stay out of this catalog: they
18
+ * require terminology search or free entry and must not be rendered as closed
19
+ * dropdowns.
20
+ */
21
+ export declare const FHIR_IPS_CLINICAL_CODED_OPTION_SETS: Readonly<Record<string, FhirClinicalCodedOptionSet>>;
22
+ /** Returns localized labels while preserving the exact canonical code value. */
23
+ export declare function clinicalArtifactCodedOptionsForClaim(claim: string, locale: string): readonly Readonly<{
24
+ code: string;
25
+ label: string;
26
+ }>[];
@@ -0,0 +1,38 @@
1
+ // Copyright 2026 Connecting Solution & Applications Ltd under the Apache License, Version 2.0.
2
+ import { AllergyIntoleranceClaim } from './claims/allergy-intolerance-claims.js';
3
+ import { ConditionClaim } from './claims/condition-claims.js';
4
+ import { ImmunizationClaim } from './claims/immunization-claims.js';
5
+ import { MedicationStatementClaim } from './claims/medication-statement-claims.js';
6
+ import { ProcedureClaim } from './claims/procedure-claims.js';
7
+ import { ObservationClaim } from './observation-claims.js';
8
+ const option = (code, en, es) => Object.freeze({ code, labels: Object.freeze({ en, es }) });
9
+ const requiredSet = (system, options) => Object.freeze({ fhirVersion: 'R4', binding: 'required', system, options: Object.freeze(options) });
10
+ const enteredInError = option('entered-in-error', 'Entered in error', 'Introducido por error');
11
+ const unknown = option('unknown', 'Unknown', 'Desconocido');
12
+ /**
13
+ * Required FHIR R4 code bindings used by the reusable IPS artifact editor.
14
+ *
15
+ * Extensible and example bindings deliberately stay out of this catalog: they
16
+ * require terminology search or free entry and must not be rendered as closed
17
+ * dropdowns.
18
+ */
19
+ export const FHIR_IPS_CLINICAL_CODED_OPTION_SETS = Object.freeze({
20
+ [AllergyIntoleranceClaim.ClinicalStatus]: requiredSet('http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical', [option('active', 'Active', 'Activo'), option('inactive', 'Inactive', 'Inactivo'), option('resolved', 'Resolved', 'Resuelto')]),
21
+ [AllergyIntoleranceClaim.VerificationStatus]: requiredSet('http://terminology.hl7.org/CodeSystem/allergyintolerance-verification', [option('unconfirmed', 'Unconfirmed', 'No confirmado'), option('confirmed', 'Confirmed', 'Confirmado'), option('refuted', 'Refuted', 'Refutado'), enteredInError]),
22
+ [AllergyIntoleranceClaim.Category]: requiredSet('http://hl7.org/fhir/allergy-intolerance-category', [option('food', 'Food', 'Alimento'), option('medication', 'Medication', 'Medicamento'), option('environment', 'Environment', 'Entorno'), option('biologic', 'Biologic', 'Biológico')]),
23
+ [AllergyIntoleranceClaim.Criticality]: requiredSet('http://hl7.org/fhir/allergy-intolerance-criticality', [option('low', 'Low risk', 'Riesgo bajo'), option('high', 'High risk', 'Riesgo alto'), option('unable-to-assess', 'Unable to assess', 'No se puede evaluar')]),
24
+ [MedicationStatementClaim.Status]: requiredSet('http://hl7.org/fhir/CodeSystem/medication-statement-status', [option('active', 'Active', 'Activo'), option('completed', 'Completed', 'Completado'), enteredInError, option('intended', 'Intended', 'Previsto'), option('stopped', 'Stopped', 'Interrumpido'), option('on-hold', 'On hold', 'En espera'), unknown, option('not-taken', 'Not taken', 'No tomado')]),
25
+ [ImmunizationClaim.Status]: requiredSet('http://hl7.org/fhir/event-status', [option('completed', 'Completed', 'Completado'), enteredInError, option('not-done', 'Not done', 'No realizado')]),
26
+ [ConditionClaim.ClinicalStatus]: requiredSet('http://terminology.hl7.org/CodeSystem/condition-clinical', [option('active', 'Active', 'Activo'), option('recurrence', 'Recurrence', 'Recurrencia'), option('relapse', 'Relapse', 'Recaída'), option('inactive', 'Inactive', 'Inactivo'), option('remission', 'Remission', 'Remisión'), option('resolved', 'Resolved', 'Resuelto')]),
27
+ [ConditionClaim.VerificationStatus]: requiredSet('http://terminology.hl7.org/CodeSystem/condition-ver-status', [option('unconfirmed', 'Unconfirmed', 'No confirmado'), option('provisional', 'Provisional', 'Provisional'), option('differential', 'Differential', 'Diferencial'), option('confirmed', 'Confirmed', 'Confirmado'), option('refuted', 'Refuted', 'Refutado'), enteredInError]),
28
+ [ProcedureClaim.Status]: requiredSet('http://hl7.org/fhir/event-status', [option('preparation', 'Preparation', 'Preparación'), option('in-progress', 'In progress', 'En curso'), option('not-done', 'Not done', 'No realizado'), option('on-hold', 'On hold', 'En espera'), option('stopped', 'Stopped', 'Detenido'), option('completed', 'Completed', 'Completado'), enteredInError, unknown]),
29
+ [ObservationClaim.Status]: requiredSet('http://hl7.org/fhir/observation-status', [option('registered', 'Registered', 'Registrado'), option('preliminary', 'Preliminary', 'Preliminar'), option('final', 'Final', 'Final'), option('amended', 'Amended', 'Modificado'), option('corrected', 'Corrected', 'Corregido'), option('cancelled', 'Cancelled', 'Cancelado'), enteredInError, unknown]),
30
+ });
31
+ /** Returns localized labels while preserving the exact canonical code value. */
32
+ export function clinicalArtifactCodedOptionsForClaim(claim, locale) {
33
+ const set = FHIR_IPS_CLINICAL_CODED_OPTION_SETS[claim];
34
+ if (!set)
35
+ return Object.freeze([]);
36
+ const language = locale.trim().toLowerCase().split('-')[0] === 'es' ? 'es' : 'en';
37
+ return Object.freeze(set.options.map(entry => Object.freeze({ code: entry.code, label: entry.labels[language] })));
38
+ }
@@ -3,3 +3,7 @@ import type { FhirResource, FlatClaims } from './convert-shared.js';
3
3
  export declare function communicationRequestFlatToFhirR4(claims: FlatClaims): FhirResource;
4
4
  /** Reads a FHIR R4 CommunicationRequest into canonical flat claims. */
5
5
  export declare function communicationRequestFhirR4ToFlat(resource: FhirResource): FlatClaims;
6
+ /** Projects canonical claims to the published FHIR R5 shape. */
7
+ export declare function communicationRequestFlatToFhirR5(claims: FlatClaims): FhirResource;
8
+ /** Reads a published FHIR R5 CommunicationRequest into canonical flat claims. */
9
+ export declare function communicationRequestFhirR5ToFlat(resource: FhirResource): FlatClaims;
@@ -4,37 +4,174 @@ import { codingFromValue, codingListFromCsv, codingListToCsv, codingToValue, ref
4
4
  export function communicationRequestFlatToFhirR4(claims) {
5
5
  return {
6
6
  resourceType: 'CommunicationRequest', identifier: claims[CommunicationRequestClaim.Identifier] ? [{ value: claims[CommunicationRequestClaim.Identifier] }] : undefined,
7
- basedOn: referenceCsv(claims[CommunicationRequestClaim.BasedOn]), status: claims[CommunicationRequestClaim.Status], priority: claims[CommunicationRequestClaim.Priority],
7
+ basedOn: referenceCsv(claims[CommunicationRequestClaim.BasedOn]),
8
+ replaces: referenceCsv(claims[CommunicationRequestClaim.Replaces]),
9
+ groupIdentifier: claims[CommunicationRequestClaim.GroupIdentifier] ? { value: claims[CommunicationRequestClaim.GroupIdentifier] } : undefined,
10
+ status: claims[CommunicationRequestClaim.Status],
11
+ statusReason: codeableConcept(claims[CommunicationRequestClaim.StatusReason]),
12
+ priority: claims[CommunicationRequestClaim.Priority],
8
13
  category: claims[CommunicationRequestClaim.Category] ? [{ coding: codingFromValue(claims[CommunicationRequestClaim.Category]) }] : undefined,
14
+ doNotPerform: optionalBoolean(claims[CommunicationRequestClaim.DoNotPerform]),
15
+ medium: claims[CommunicationRequestClaim.Medium] ? [{ coding: codingFromValue(claims[CommunicationRequestClaim.Medium]) }] : undefined,
9
16
  subject: claims[CommunicationRequestClaim.Subject] ? { reference: claims[CommunicationRequestClaim.Subject] } : undefined,
10
17
  about: referenceCsv(claims[CommunicationRequestClaim.About]), encounter: claims[CommunicationRequestClaim.Encounter] ? { reference: claims[CommunicationRequestClaim.Encounter] } : undefined,
11
18
  requester: claims[CommunicationRequestClaim.Requester] ? { reference: claims[CommunicationRequestClaim.Requester] } : undefined,
19
+ sender: firstReference(claims[CommunicationRequestClaim.InformationProvider]),
12
20
  recipient: referenceCsv(claims[CommunicationRequestClaim.Recipient]), authoredOn: claims[CommunicationRequestClaim.AuthoredOn],
13
21
  occurrenceDateTime: claims[CommunicationRequestClaim.Occurrence],
14
22
  reasonCode: claims[CommunicationRequestClaim.ReasonCode] ? [{ coding: codingListFromCsv(claims[CommunicationRequestClaim.ReasonCode]) }] : undefined,
15
23
  reasonReference: referenceCsv(claims[CommunicationRequestClaim.ReasonReference]),
16
- payload: claims[CommunicationRequestClaim.PayloadContent] ? [{ contentString: claims[CommunicationRequestClaim.PayloadContent] }] : undefined,
24
+ payload: payloadR4(claims),
25
+ note: annotation(claims[CommunicationRequestClaim.Note]),
17
26
  };
18
27
  }
19
28
  /** Reads a FHIR R4 CommunicationRequest into canonical flat claims. */
20
29
  export function communicationRequestFhirR4ToFlat(resource) {
21
- return {
30
+ return compact({
22
31
  [CommunicationRequestClaim.Identifier]: resource.identifier?.[0]?.value,
23
32
  [CommunicationRequestClaim.BasedOn]: referenceListToCsv(resource.basedOn),
24
- [CommunicationRequestClaim.Status]: resource.status, [CommunicationRequestClaim.Priority]: resource.priority,
33
+ [CommunicationRequestClaim.Replaces]: referenceListToCsv(resource.replaces),
34
+ [CommunicationRequestClaim.GroupIdentifier]: resource.groupIdentifier?.value,
35
+ [CommunicationRequestClaim.Status]: resource.status,
36
+ [CommunicationRequestClaim.StatusReason]: codeableConceptToValue(resource.statusReason),
37
+ [CommunicationRequestClaim.Priority]: resource.priority,
25
38
  [CommunicationRequestClaim.Category]: codingToValue(resource.category?.[0]?.coding?.[0]),
39
+ [CommunicationRequestClaim.DoNotPerform]: typeof resource.doNotPerform === 'boolean' ? String(resource.doNotPerform) : undefined,
40
+ [CommunicationRequestClaim.Medium]: codingToValue(resource.medium?.[0]?.coding?.[0]),
26
41
  [CommunicationRequestClaim.Subject]: referenceToValue(resource.subject),
27
42
  [CommunicationRequestClaim.About]: referenceListToCsv(resource.about),
28
43
  [CommunicationRequestClaim.Encounter]: referenceToValue(resource.encounter),
29
44
  [CommunicationRequestClaim.Requester]: referenceToValue(resource.requester),
45
+ [CommunicationRequestClaim.InformationProvider]: referenceToValue(resource.sender),
30
46
  [CommunicationRequestClaim.Recipient]: referenceListToCsv(resource.recipient),
31
47
  [CommunicationRequestClaim.AuthoredOn]: resource.authoredOn, [CommunicationRequestClaim.Occurrence]: resource.occurrenceDateTime,
32
48
  [CommunicationRequestClaim.ReasonCode]: codingListToCsv(resource.reasonCode?.flatMap(value => value.coding ?? [])),
33
49
  [CommunicationRequestClaim.ReasonReference]: referenceListToCsv(resource.reasonReference),
34
- [CommunicationRequestClaim.PayloadContent]: resource.payload?.[0]?.contentString,
50
+ ...payloadToFlat(resource),
51
+ [CommunicationRequestClaim.Note]: annotationText(resource.note),
52
+ });
53
+ }
54
+ /** Projects canonical claims to the published FHIR R5 shape. */
55
+ export function communicationRequestFlatToFhirR5(claims) {
56
+ return communicationRequestFlatToFhirR5Resource(claims);
57
+ }
58
+ /** Reads a published FHIR R5 CommunicationRequest into canonical flat claims. */
59
+ export function communicationRequestFhirR5ToFlat(resource) {
60
+ return communicationRequestFhirR5ResourceToFlat(resource);
61
+ }
62
+ function communicationRequestFlatToFhirR5Resource(claims) {
63
+ const intent = claims[CommunicationRequestClaim.Intent];
64
+ if (!intent)
65
+ throw new TypeError('communication_request_intent_required');
66
+ return {
67
+ resourceType: 'CommunicationRequest',
68
+ identifier: claims[CommunicationRequestClaim.Identifier] ? [{ value: claims[CommunicationRequestClaim.Identifier] }] : undefined,
69
+ basedOn: referenceCsv(claims[CommunicationRequestClaim.BasedOn]),
70
+ replaces: referenceCsv(claims[CommunicationRequestClaim.Replaces]),
71
+ groupIdentifier: claims[CommunicationRequestClaim.GroupIdentifier] ? { value: claims[CommunicationRequestClaim.GroupIdentifier] } : undefined,
72
+ status: claims[CommunicationRequestClaim.Status],
73
+ statusReason: codeableConcept(claims[CommunicationRequestClaim.StatusReason]),
74
+ intent,
75
+ priority: claims[CommunicationRequestClaim.Priority],
76
+ category: claims[CommunicationRequestClaim.Category] ? [{ coding: codingFromValue(claims[CommunicationRequestClaim.Category]) }] : undefined,
77
+ doNotPerform: optionalBoolean(claims[CommunicationRequestClaim.DoNotPerform]),
78
+ medium: claims[CommunicationRequestClaim.Medium] ? [{ coding: codingFromValue(claims[CommunicationRequestClaim.Medium]) }] : undefined,
79
+ subject: claims[CommunicationRequestClaim.Subject] ? { reference: claims[CommunicationRequestClaim.Subject] } : undefined,
80
+ about: referenceCsv(claims[CommunicationRequestClaim.About]),
81
+ encounter: claims[CommunicationRequestClaim.Encounter] ? { reference: claims[CommunicationRequestClaim.Encounter] } : undefined,
82
+ requester: claims[CommunicationRequestClaim.Requester] ? { reference: claims[CommunicationRequestClaim.Requester] } : undefined,
83
+ recipient: referenceCsv(claims[CommunicationRequestClaim.Recipient]),
84
+ informationProvider: referenceCsv(claims[CommunicationRequestClaim.InformationProvider]),
85
+ authoredOn: claims[CommunicationRequestClaim.AuthoredOn], occurrenceDateTime: claims[CommunicationRequestClaim.Occurrence],
86
+ reason: reasonsR5(claims), payload: payloadR5(claims), note: annotation(claims[CommunicationRequestClaim.Note]),
35
87
  };
36
88
  }
89
+ function communicationRequestFhirR5ResourceToFlat(resource) {
90
+ const reasons = resource.reason;
91
+ return compact({
92
+ [CommunicationRequestClaim.Identifier]: resource.identifier?.[0]?.value,
93
+ [CommunicationRequestClaim.BasedOn]: referenceListToCsv(resource.basedOn),
94
+ [CommunicationRequestClaim.Replaces]: referenceListToCsv(resource.replaces),
95
+ [CommunicationRequestClaim.GroupIdentifier]: resource.groupIdentifier?.value,
96
+ [CommunicationRequestClaim.Status]: resource.status,
97
+ [CommunicationRequestClaim.StatusReason]: codeableConceptToValue(resource.statusReason),
98
+ [CommunicationRequestClaim.Intent]: resource.intent,
99
+ [CommunicationRequestClaim.Priority]: resource.priority,
100
+ [CommunicationRequestClaim.Category]: codingToValue(resource.category?.[0]?.coding?.[0]),
101
+ [CommunicationRequestClaim.DoNotPerform]: typeof resource.doNotPerform === 'boolean' ? String(resource.doNotPerform) : undefined,
102
+ [CommunicationRequestClaim.Medium]: codingToValue(resource.medium?.[0]?.coding?.[0]),
103
+ [CommunicationRequestClaim.Subject]: referenceToValue(resource.subject),
104
+ [CommunicationRequestClaim.About]: referenceListToCsv(resource.about),
105
+ [CommunicationRequestClaim.Encounter]: referenceToValue(resource.encounter),
106
+ [CommunicationRequestClaim.Requester]: referenceToValue(resource.requester),
107
+ [CommunicationRequestClaim.Recipient]: referenceListToCsv(resource.recipient),
108
+ [CommunicationRequestClaim.InformationProvider]: referenceListToCsv(resource.informationProvider),
109
+ [CommunicationRequestClaim.AuthoredOn]: resource.authoredOn,
110
+ [CommunicationRequestClaim.Occurrence]: resource.occurrenceDateTime,
111
+ [CommunicationRequestClaim.ReasonCode]: codingListToCsv(reasons?.flatMap(value => value.concept?.coding ?? [])),
112
+ [CommunicationRequestClaim.ReasonReference]: reasons?.map(value => value.reference?.reference).filter((value) => Boolean(value)).join(',') || undefined,
113
+ ...payloadToFlat(resource), [CommunicationRequestClaim.Note]: annotationText(resource.note),
114
+ });
115
+ }
37
116
  function referenceCsv(value) {
38
117
  const references = value?.split(',').map(reference => reference.trim()).filter(Boolean) ?? [];
39
118
  return references.length ? references.map(reference => ({ reference })) : undefined;
40
119
  }
120
+ function firstReference(value) { return referenceCsv(value)?.[0]; }
121
+ function codeableConcept(value) {
122
+ const coding = codingFromValue(value);
123
+ return coding ? { coding } : undefined;
124
+ }
125
+ function codeableConceptToValue(value) {
126
+ return codingToValue(value?.coding?.[0]);
127
+ }
128
+ function optionalBoolean(value) {
129
+ if (value === undefined)
130
+ return undefined;
131
+ if (value !== 'true' && value !== 'false')
132
+ throw new TypeError('communication_request_boolean_invalid');
133
+ return value === 'true';
134
+ }
135
+ function annotation(value) { return value ? [{ text: value }] : undefined; }
136
+ function annotationText(value) { return value?.[0]?.text; }
137
+ function payloadR4(claims) {
138
+ if (claims[CommunicationRequestClaim.PayloadReference])
139
+ return [{ contentReference: { reference: claims[CommunicationRequestClaim.PayloadReference] } }];
140
+ if (claims[CommunicationRequestClaim.PayloadAttachmentData])
141
+ return [{ contentAttachment: attachment(claims) }];
142
+ return claims[CommunicationRequestClaim.PayloadContent] ? [{ contentString: claims[CommunicationRequestClaim.PayloadContent] }] : undefined;
143
+ }
144
+ function payloadR5(claims) {
145
+ if (claims[CommunicationRequestClaim.PayloadReference])
146
+ return [{ contentReference: { reference: claims[CommunicationRequestClaim.PayloadReference] } }];
147
+ if (claims[CommunicationRequestClaim.PayloadAttachmentData])
148
+ return [{ contentAttachment: attachment(claims) }];
149
+ if (claims[CommunicationRequestClaim.PayloadContent])
150
+ throw new TypeError('communication_request_string_payload_not_supported_in_r5');
151
+ return undefined;
152
+ }
153
+ function attachment(claims) {
154
+ const contentType = claims[CommunicationRequestClaim.PayloadAttachmentContentType];
155
+ if (!contentType)
156
+ throw new TypeError('communication_request_attachment_content_type_required');
157
+ return { contentType, data: claims[CommunicationRequestClaim.PayloadAttachmentData], title: claims[CommunicationRequestClaim.PayloadAttachmentTitle] };
158
+ }
159
+ function payloadToFlat(resource) {
160
+ const payload = resource.payload?.[0];
161
+ return compact({
162
+ [CommunicationRequestClaim.PayloadContent]: payload?.contentString,
163
+ [CommunicationRequestClaim.PayloadReference]: payload?.contentReference?.reference,
164
+ [CommunicationRequestClaim.PayloadAttachmentContentType]: payload?.contentAttachment?.contentType,
165
+ [CommunicationRequestClaim.PayloadAttachmentData]: payload?.contentAttachment?.data,
166
+ [CommunicationRequestClaim.PayloadAttachmentTitle]: payload?.contentAttachment?.title,
167
+ });
168
+ }
169
+ function reasonsR5(claims) {
170
+ const result = [];
171
+ for (const coding of codingListFromCsv(claims[CommunicationRequestClaim.ReasonCode]) ?? [])
172
+ result.push({ concept: { coding: [coding] } });
173
+ for (const item of referenceCsv(claims[CommunicationRequestClaim.ReasonReference]) ?? [])
174
+ result.push({ reference: item });
175
+ return result.length ? result : undefined;
176
+ }
177
+ function compact(value) { return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined)); }
@@ -0,0 +1,108 @@
1
+ import type { FlatClaims } from '../converters/convert-shared.js';
2
+ export declare const CommunicationRequestStatuses: readonly ["draft", "active", "on-hold", "revoked", "completed", "entered-in-error", "unknown"];
3
+ export declare const CommunicationRequestIntents: readonly ["proposal", "plan", "directive", "order", "original-order", "reflex-order", "filler-order", "instance-order", "option"];
4
+ export declare const CommunicationRequestPriorities: readonly ["routine", "urgent", "asap", "stat"];
5
+ export type CommunicationRequestFormData = Readonly<{
6
+ identifier?: string;
7
+ status: typeof CommunicationRequestStatuses[number];
8
+ intent: typeof CommunicationRequestIntents[number];
9
+ priority?: typeof CommunicationRequestPriorities[number];
10
+ subject: string;
11
+ encounter?: string;
12
+ requester: string;
13
+ recipients: readonly string[];
14
+ informationProviders?: readonly string[];
15
+ authoredOn?: string;
16
+ occurrence?: string;
17
+ payloadReference?: string;
18
+ payloadAttachmentContentType?: string;
19
+ payloadAttachmentData?: string;
20
+ payloadAttachmentTitle?: string;
21
+ note?: string;
22
+ }>;
23
+ /** Data-only JSON Schema. Portals own localized labels, widgets and authorization. */
24
+ export declare const FHIR_COMMUNICATION_REQUEST_FORM_SCHEMA: Readonly<{
25
+ $schema: "https://json-schema.org/draft/2020-12/schema";
26
+ $id: "https://globaldatacare.com/schemas/fhir/communication-request-form.json";
27
+ title: "CommunicationRequest";
28
+ type: "object";
29
+ additionalProperties: false;
30
+ required: readonly string[];
31
+ properties: Readonly<{
32
+ identifier: Readonly<{
33
+ type: "string";
34
+ minLength: 1;
35
+ }>;
36
+ status: Readonly<{
37
+ type: "string";
38
+ enum: readonly ["draft", "active", "on-hold", "revoked", "completed", "entered-in-error", "unknown"];
39
+ }>;
40
+ intent: Readonly<{
41
+ type: "string";
42
+ enum: readonly ["proposal", "plan", "directive", "order", "original-order", "reflex-order", "filler-order", "instance-order", "option"];
43
+ }>;
44
+ priority: Readonly<{
45
+ type: "string";
46
+ enum: readonly ["routine", "urgent", "asap", "stat"];
47
+ }>;
48
+ subject: Readonly<{
49
+ type: "string";
50
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
51
+ }>;
52
+ encounter: Readonly<{
53
+ type: "string";
54
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
55
+ }>;
56
+ requester: Readonly<{
57
+ type: "string";
58
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
59
+ }>;
60
+ recipients: Readonly<{
61
+ type: "array";
62
+ minItems: 1;
63
+ uniqueItems: true;
64
+ items: Readonly<{
65
+ type: "string";
66
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
67
+ }>;
68
+ }>;
69
+ informationProviders: Readonly<{
70
+ type: "array";
71
+ uniqueItems: true;
72
+ items: Readonly<{
73
+ type: "string";
74
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
75
+ }>;
76
+ }>;
77
+ authoredOn: Readonly<{
78
+ type: "string";
79
+ format: "date-time";
80
+ }>;
81
+ occurrence: Readonly<{
82
+ type: "string";
83
+ format: "date-time";
84
+ }>;
85
+ payloadReference: Readonly<{
86
+ type: "string";
87
+ pattern: "^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$";
88
+ }>;
89
+ payloadAttachmentContentType: Readonly<{
90
+ type: "string";
91
+ minLength: 1;
92
+ }>;
93
+ payloadAttachmentData: Readonly<{
94
+ type: "string";
95
+ minLength: 1;
96
+ contentEncoding: "base64";
97
+ }>;
98
+ payloadAttachmentTitle: Readonly<{
99
+ type: "string";
100
+ minLength: 1;
101
+ }>;
102
+ note: Readonly<{
103
+ type: "string";
104
+ }>;
105
+ }>;
106
+ }>;
107
+ export declare function communicationRequestFormDataToFlatClaims(input: CommunicationRequestFormData): FlatClaims;
108
+ export declare function communicationRequestFlatClaimsToFormData(claims: FlatClaims): CommunicationRequestFormData;
@@ -0,0 +1,91 @@
1
+ // Copyright 2026 Connecting Solution & Applications Ltd under the Apache License, Version 2.0.
2
+ import { CommunicationRequestClaim } from '../claims/communication-request-claims.js';
3
+ export const CommunicationRequestStatuses = Object.freeze([
4
+ 'draft', 'active', 'on-hold', 'revoked', 'completed', 'entered-in-error', 'unknown',
5
+ ]);
6
+ export const CommunicationRequestIntents = Object.freeze([
7
+ 'proposal', 'plan', 'directive', 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order', 'option',
8
+ ]);
9
+ export const CommunicationRequestPriorities = Object.freeze(['routine', 'urgent', 'asap', 'stat']);
10
+ /** Data-only JSON Schema. Portals own localized labels, widgets and authorization. */
11
+ export const FHIR_COMMUNICATION_REQUEST_FORM_SCHEMA = Object.freeze({
12
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
13
+ $id: 'https://globaldatacare.com/schemas/fhir/communication-request-form.json',
14
+ title: 'CommunicationRequest',
15
+ type: 'object',
16
+ additionalProperties: false,
17
+ required: Object.freeze(['status', 'intent', 'subject', 'requester', 'recipients']),
18
+ properties: Object.freeze({
19
+ identifier: Object.freeze({ type: 'string', minLength: 1 }),
20
+ status: Object.freeze({ type: 'string', enum: CommunicationRequestStatuses }),
21
+ intent: Object.freeze({ type: 'string', enum: CommunicationRequestIntents }),
22
+ priority: Object.freeze({ type: 'string', enum: CommunicationRequestPriorities }),
23
+ subject: referenceSchema(), encounter: referenceSchema(), requester: referenceSchema(),
24
+ recipients: Object.freeze({ type: 'array', minItems: 1, uniqueItems: true, items: referenceSchema() }),
25
+ informationProviders: Object.freeze({ type: 'array', uniqueItems: true, items: referenceSchema() }),
26
+ authoredOn: dateTimeSchema(), occurrence: dateTimeSchema(), payloadReference: referenceSchema(),
27
+ payloadAttachmentContentType: Object.freeze({ type: 'string', minLength: 1 }),
28
+ payloadAttachmentData: Object.freeze({ type: 'string', minLength: 1, contentEncoding: 'base64' }),
29
+ payloadAttachmentTitle: Object.freeze({ type: 'string', minLength: 1 }),
30
+ note: Object.freeze({ type: 'string' }),
31
+ }),
32
+ });
33
+ export function communicationRequestFormDataToFlatClaims(input) {
34
+ requiredEnum(input.status, CommunicationRequestStatuses, 'communication_request_status_invalid');
35
+ requiredEnum(input.intent, CommunicationRequestIntents, 'communication_request_intent_invalid');
36
+ if (input.priority)
37
+ requiredEnum(input.priority, CommunicationRequestPriorities, 'communication_request_priority_invalid');
38
+ const recipients = references(input.recipients, 'communication_request_recipient_required');
39
+ const providers = input.informationProviders?.length
40
+ ? references(input.informationProviders, 'communication_request_information_provider_invalid') : undefined;
41
+ if (input.payloadAttachmentData && !input.payloadAttachmentContentType) {
42
+ throw new TypeError('communication_request_attachment_content_type_required');
43
+ }
44
+ return compact({
45
+ [CommunicationRequestClaim.Identifier]: optional(input.identifier),
46
+ [CommunicationRequestClaim.Status]: input.status,
47
+ [CommunicationRequestClaim.Intent]: input.intent,
48
+ [CommunicationRequestClaim.Priority]: optional(input.priority),
49
+ [CommunicationRequestClaim.Subject]: reference(input.subject, 'communication_request_subject_invalid'),
50
+ [CommunicationRequestClaim.Encounter]: input.encounter ? reference(input.encounter, 'communication_request_encounter_invalid') : undefined,
51
+ [CommunicationRequestClaim.Requester]: reference(input.requester, 'communication_request_requester_invalid'),
52
+ [CommunicationRequestClaim.Recipient]: recipients.join(','),
53
+ [CommunicationRequestClaim.InformationProvider]: providers?.join(','),
54
+ [CommunicationRequestClaim.AuthoredOn]: dateTime(input.authoredOn),
55
+ [CommunicationRequestClaim.Occurrence]: dateTime(input.occurrence),
56
+ [CommunicationRequestClaim.PayloadReference]: input.payloadReference ? reference(input.payloadReference, 'communication_request_payload_reference_invalid') : undefined,
57
+ [CommunicationRequestClaim.PayloadAttachmentContentType]: optional(input.payloadAttachmentContentType),
58
+ [CommunicationRequestClaim.PayloadAttachmentData]: optional(input.payloadAttachmentData),
59
+ [CommunicationRequestClaim.PayloadAttachmentTitle]: optional(input.payloadAttachmentTitle),
60
+ [CommunicationRequestClaim.Note]: optional(input.note),
61
+ });
62
+ }
63
+ export function communicationRequestFlatClaimsToFormData(claims) {
64
+ return compact({
65
+ identifier: claims[CommunicationRequestClaim.Identifier], status: claims[CommunicationRequestClaim.Status],
66
+ intent: claims[CommunicationRequestClaim.Intent], priority: claims[CommunicationRequestClaim.Priority],
67
+ subject: claims[CommunicationRequestClaim.Subject], encounter: claims[CommunicationRequestClaim.Encounter],
68
+ requester: claims[CommunicationRequestClaim.Requester], recipients: split(claims[CommunicationRequestClaim.Recipient]),
69
+ informationProviders: splitOptional(claims[CommunicationRequestClaim.InformationProvider]),
70
+ authoredOn: claims[CommunicationRequestClaim.AuthoredOn], occurrence: claims[CommunicationRequestClaim.Occurrence],
71
+ payloadReference: claims[CommunicationRequestClaim.PayloadReference],
72
+ payloadAttachmentContentType: claims[CommunicationRequestClaim.PayloadAttachmentContentType],
73
+ payloadAttachmentData: claims[CommunicationRequestClaim.PayloadAttachmentData],
74
+ payloadAttachmentTitle: claims[CommunicationRequestClaim.PayloadAttachmentTitle], note: claims[CommunicationRequestClaim.Note],
75
+ });
76
+ }
77
+ function referenceSchema() { return Object.freeze({ type: 'string', pattern: '^[A-Za-z][A-Za-z0-9]+/[A-Za-z0-9.-]{1,64}$' }); }
78
+ function dateTimeSchema() { return Object.freeze({ type: 'string', format: 'date-time' }); }
79
+ function optional(value) { const text = String(value ?? '').trim(); return text || undefined; }
80
+ function dateTime(value) { const text = optional(value); if (text && Number.isNaN(Date.parse(text)))
81
+ throw new TypeError('communication_request_datetime_invalid'); return text; }
82
+ function reference(value, error) { const text = optional(value); if (!text || !/^[A-Za-z][A-Za-z0-9]+\/[A-Za-z0-9.-]{1,64}$/u.test(text))
83
+ throw new TypeError(error); return text; }
84
+ function references(values, error) { if (!Array.isArray(values) || !values.length)
85
+ throw new TypeError(error); const result = [...new Set(values.map(value => reference(value, error)))]; if (result.length !== values.length)
86
+ throw new TypeError(error); return result; }
87
+ function split(value) { return Object.freeze(String(value || '').split(',').map(item => item.trim()).filter(Boolean)); }
88
+ function splitOptional(value) { const values = split(value); return values.length ? values : undefined; }
89
+ function requiredEnum(value, allowed, error) { if (!allowed.includes(value))
90
+ throw new TypeError(error); }
91
+ function compact(value) { return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined)); }
@@ -5,3 +5,4 @@ export * from './ips-all-sections.data.js';
5
5
  export * from './health-credential-qr.data.js';
6
6
  export * from './ips-clinical-artifact-schemas.data.js';
7
7
  export * from './clinical-document-encounter-journey.data.js';
8
+ export * from './communication-request-form-schema.data.js';
@@ -5,3 +5,4 @@ export * from './ips-all-sections.data.js';
5
5
  export * from './health-credential-qr.data.js';
6
6
  export * from './ips-clinical-artifact-schemas.data.js';
7
7
  export * from './clinical-document-encounter-journey.data.js';
8
+ export * from './communication-request-form-schema.data.js';
@@ -67,7 +67,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
67
67
  display: string;
68
68
  }[];
69
69
  };
70
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
70
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
71
71
  id: string;
72
72
  status: string;
73
73
  subject: {
@@ -84,7 +84,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
84
84
  }[];
85
85
  };
86
86
  effectiveDateTime: string;
87
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
87
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
88
88
  id: string;
89
89
  subject: {
90
90
  reference: string;
@@ -103,7 +103,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
103
103
  }[];
104
104
  };
105
105
  occurrenceDateTime: string;
106
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
106
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
107
107
  id: string;
108
108
  subject: {
109
109
  reference: string;
@@ -119,7 +119,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
119
119
  }[];
120
120
  };
121
121
  effectiveDateTime: string;
122
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
122
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
123
123
  id: string;
124
124
  subject: {
125
125
  reference: string;
@@ -135,7 +135,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
135
135
  }[];
136
136
  };
137
137
  performedDateTime: string;
138
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
138
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
139
139
  id: string;
140
140
  subject: {
141
141
  reference: string;
@@ -145,7 +145,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
145
145
  device: {
146
146
  display: "Corrective lens use";
147
147
  };
148
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
148
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
149
149
  id: string;
150
150
  subject: {
151
151
  reference: string;
@@ -166,7 +166,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
166
166
  system: string;
167
167
  code: string;
168
168
  };
169
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
169
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
170
170
  id: string;
171
171
  status: string;
172
172
  subject: {
@@ -190,7 +190,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
190
190
  display: string;
191
191
  }[];
192
192
  };
193
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
193
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
194
194
  id: string;
195
195
  status: string;
196
196
  subject: {
@@ -206,7 +206,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
206
206
  display: string;
207
207
  }[];
208
208
  };
209
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
209
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
210
210
  id: string;
211
211
  subject: {
212
212
  reference: string;
@@ -221,7 +221,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
221
221
  display: string;
222
222
  }[];
223
223
  };
224
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
224
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
225
225
  id: string;
226
226
  status: string;
227
227
  subject: {
@@ -248,7 +248,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
248
248
  patient: {
249
249
  reference: string;
250
250
  };
251
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
251
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
252
252
  id: string;
253
253
  subject: {
254
254
  reference: string;
@@ -257,7 +257,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
257
257
  status: string;
258
258
  description: "Independent daily activities";
259
259
  summary: "Independent daily activities";
260
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
260
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
261
261
  id: string;
262
262
  subject: {
263
263
  reference: string;
@@ -274,7 +274,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
274
274
  display: string;
275
275
  }[];
276
276
  }[];
277
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
277
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
278
278
  id: string;
279
279
  subject: {
280
280
  reference: string;
@@ -291,7 +291,7 @@ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
291
291
  display: string;
292
292
  }[];
293
293
  };
294
- resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation" | "Procedure";
294
+ resourceType: "Condition" | "Goal" | "Procedure" | "AllergyIntolerance" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "DiagnosticReport" | "Flag" | "Immunization" | "MedicationStatement" | "Observation";
295
295
  id: string;
296
296
  status: string;
297
297
  subject: {
@@ -0,0 +1,40 @@
1
+ /** Canonical HL7 v2-0203 CodeSystem used by FHIR Identifier.type coding. */
2
+ export declare const HL7_V2_0203_IDENTIFIER_TYPE_SYSTEM: "http://terminology.hl7.org/CodeSystem/v2-0203";
3
+ /** Published FHIR value set that selects commonly used Identifier.type codes. */
4
+ export declare const FHIR_IDENTIFIER_TYPE_VALUE_SET_URL: "https://hl7.org/fhir/valueset-identifier-type.html";
5
+ /** Normative registries used to validate the shared catalog. */
6
+ export declare const HL7_IDENTIFIER_REGISTRY_SOURCES: Readonly<{
7
+ CodeSystem: "http://terminology.hl7.org/CodeSystem/v2-0203";
8
+ FhirIdentifierTypeValueSet: "https://hl7.org/fhir/valueset-identifier-type.html";
9
+ Hl7TerminologySource: "https://terminology.hl7.org/6.5.0/CodeSystem-v2-0203.html";
10
+ }>;
11
+ /**
12
+ * Product-neutral person and healthcare identifier codes used by the shared
13
+ * FHIR adapters. Contact points and veterinary identifiers belong to their
14
+ * own standards and are deliberately absent.
15
+ */
16
+ export declare const HL7_V2_0203_IDENTIFIER_CODES: Readonly<{
17
+ readonly DriverLicense: "DL";
18
+ readonly CitizenshipCard: "CZ";
19
+ readonly NationalNumber: "NN";
20
+ readonly PassportNumber: "PPN";
21
+ readonly JurisdictionalHealthNumber: "JHN";
22
+ readonly PermanentResidentCard: "PRC";
23
+ readonly WorkPermit: "WP";
24
+ readonly StudyPermit: "SP";
25
+ readonly Visa: "VS";
26
+ readonly VisitorPermit: "VP";
27
+ readonly TemporaryPermanentResident: "TPR";
28
+ readonly HealthCard: "HC";
29
+ readonly MemberNumber: "MB";
30
+ readonly SubscriberNumber: "SN";
31
+ readonly DonorRecord: "DR";
32
+ readonly PatientIdentifier: "PI";
33
+ }>;
34
+ export type Hl7V20203IdentifierCode = typeof HL7_V2_0203_IDENTIFIER_CODES[keyof typeof HL7_V2_0203_IDENTIFIER_CODES];
35
+ /** Product-neutral organization identifier codes from the same CodeSystem. */
36
+ export declare const HL7_V2_0203_ORGANIZATION_IDENTIFIER_CODES: Readonly<{
37
+ readonly TaxIdentifier: "TAX";
38
+ readonly EmployerNumber: "EN";
39
+ }>;
40
+ export type Hl7V20203OrganizationIdentifierCode = typeof HL7_V2_0203_ORGANIZATION_IDENTIFIER_CODES[keyof typeof HL7_V2_0203_ORGANIZATION_IDENTIFIER_CODES];
@@ -0,0 +1,38 @@
1
+ /** Canonical HL7 v2-0203 CodeSystem used by FHIR Identifier.type coding. */
2
+ export const HL7_V2_0203_IDENTIFIER_TYPE_SYSTEM = 'http://terminology.hl7.org/CodeSystem/v2-0203';
3
+ /** Published FHIR value set that selects commonly used Identifier.type codes. */
4
+ export const FHIR_IDENTIFIER_TYPE_VALUE_SET_URL = 'https://hl7.org/fhir/valueset-identifier-type.html';
5
+ /** Normative registries used to validate the shared catalog. */
6
+ export const HL7_IDENTIFIER_REGISTRY_SOURCES = Object.freeze({
7
+ CodeSystem: HL7_V2_0203_IDENTIFIER_TYPE_SYSTEM,
8
+ FhirIdentifierTypeValueSet: FHIR_IDENTIFIER_TYPE_VALUE_SET_URL,
9
+ Hl7TerminologySource: 'https://terminology.hl7.org/6.5.0/CodeSystem-v2-0203.html',
10
+ });
11
+ /**
12
+ * Product-neutral person and healthcare identifier codes used by the shared
13
+ * FHIR adapters. Contact points and veterinary identifiers belong to their
14
+ * own standards and are deliberately absent.
15
+ */
16
+ export const HL7_V2_0203_IDENTIFIER_CODES = Object.freeze({
17
+ DriverLicense: 'DL',
18
+ CitizenshipCard: 'CZ',
19
+ NationalNumber: 'NN',
20
+ PassportNumber: 'PPN',
21
+ JurisdictionalHealthNumber: 'JHN',
22
+ PermanentResidentCard: 'PRC',
23
+ WorkPermit: 'WP',
24
+ StudyPermit: 'SP',
25
+ Visa: 'VS',
26
+ VisitorPermit: 'VP',
27
+ TemporaryPermanentResident: 'TPR',
28
+ HealthCard: 'HC',
29
+ MemberNumber: 'MB',
30
+ SubscriberNumber: 'SN',
31
+ DonorRecord: 'DR',
32
+ PatientIdentifier: 'PI',
33
+ });
34
+ /** Product-neutral organization identifier codes from the same CodeSystem. */
35
+ export const HL7_V2_0203_ORGANIZATION_IDENTIFIER_CODES = Object.freeze({
36
+ TaxIdentifier: 'TAX',
37
+ EmployerNumber: 'EN',
38
+ });
package/dist/index.d.ts CHANGED
@@ -29,3 +29,5 @@ export * from './fhir-instant.js';
29
29
  export * from './health-credential-qr.js';
30
30
  export * from './fhir-temporal-presentation.js';
31
31
  export * from './clinical-artifact-editor.js';
32
+ export * from './clinical-artifact-coded-options.js';
33
+ export * from './hl7-v2-0203-identifier-types.js';
package/dist/index.js CHANGED
@@ -29,3 +29,5 @@ export * from './fhir-instant.js';
29
29
  export * from './health-credential-qr.js';
30
30
  export * from './fhir-temporal-presentation.js';
31
31
  export * from './clinical-artifact-editor.js';
32
+ export * from './clinical-artifact-coded-options.js';
33
+ export * from './hl7-v2-0203-identifier-types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-data-utils-ts",
3
- "version": "0.6.12",
3
+ "version": "0.6.16",
4
4
  "description": "FHIR-version-neutral flat-claim and SearchParameter data utilities",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -55,6 +55,10 @@
55
55
  "types": "./dist/fhir-values.d.ts",
56
56
  "default": "./dist/fhir-values.js"
57
57
  },
58
+ "./hl7-v2-0203-identifier-types": {
59
+ "types": "./dist/hl7-v2-0203-identifier-types.d.ts",
60
+ "default": "./dist/hl7-v2-0203-identifier-types.js"
61
+ },
58
62
  "./fhir-search-parameters": {
59
63
  "types": "./dist/fhir-search-parameters.d.ts",
60
64
  "default": "./dist/fhir-search-parameters.js"
@@ -83,6 +87,10 @@
83
87
  "types": "./dist/clinical-terminology.d.ts",
84
88
  "default": "./dist/clinical-terminology.js"
85
89
  },
90
+ "./clinical-artifact-coded-options": {
91
+ "types": "./dist/clinical-artifact-coded-options.d.ts",
92
+ "default": "./dist/clinical-artifact-coded-options.js"
93
+ },
86
94
  "./immunization-flat-claims": {
87
95
  "types": "./dist/immunization-flat-claims.d.ts",
88
96
  "default": "./dist/immunization-flat-claims.js"