fhir-data-utils-ts 0.2.4 → 0.3.1
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/.codex/skills/govern-fhir-data-utilities/SKILL.md +58 -0
- package/.codex/skills/govern-fhir-data-utilities/agents/openai.yaml +4 -0
- package/.codex/skills/govern-fhir-observation-components/SKILL.md +18 -0
- package/CHANGELOG.md +30 -0
- package/README.md +39 -0
- package/dist/builders/immunization-graph.d.ts +36 -0
- package/dist/builders/immunization-graph.js +115 -0
- package/dist/builders/immunization-reminders.d.ts +35 -0
- package/dist/builders/immunization-reminders.js +104 -0
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.js +2 -0
- package/dist/claim-helpers/claim-list-helpers.d.ts +21 -0
- package/dist/claim-helpers/claim-list-helpers.js +54 -0
- package/dist/claim-helpers/claims-helpers-allergy-intolerance.d.ts +18 -0
- package/dist/claim-helpers/claims-helpers-allergy-intolerance.js +65 -0
- package/dist/claim-helpers/claims-helpers-appointment-response.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-appointment-response.js +20 -0
- package/dist/claim-helpers/claims-helpers-appointment.d.ts +10 -0
- package/dist/claim-helpers/claims-helpers-appointment.js +26 -0
- package/dist/claim-helpers/claims-helpers-care-plan.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-care-plan.js +20 -0
- package/dist/claim-helpers/claims-helpers-clinical-impression.d.ts +10 -0
- package/dist/claim-helpers/claims-helpers-clinical-impression.js +26 -0
- package/dist/claim-helpers/claims-helpers-communication.d.ts +19 -0
- package/dist/claim-helpers/claims-helpers-communication.js +63 -0
- package/dist/claim-helpers/claims-helpers-composition.d.ts +12 -0
- package/dist/claim-helpers/claims-helpers-composition.js +32 -0
- package/dist/claim-helpers/claims-helpers-condition.d.ts +18 -0
- package/dist/claim-helpers/claims-helpers-condition.js +65 -0
- package/dist/claim-helpers/claims-helpers-coverage.d.ts +10 -0
- package/dist/claim-helpers/claims-helpers-coverage.js +26 -0
- package/dist/claim-helpers/claims-helpers-device-use-statement.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-device-use-statement.js +20 -0
- package/dist/claim-helpers/claims-helpers-device.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-device.js +20 -0
- package/dist/claim-helpers/claims-helpers-diagnostic-report.d.ts +16 -0
- package/dist/claim-helpers/claims-helpers-diagnostic-report.js +47 -0
- package/dist/claim-helpers/claims-helpers-document-reference.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-document-reference.js +20 -0
- package/dist/claim-helpers/claims-helpers-encounter.d.ts +10 -0
- package/dist/claim-helpers/claims-helpers-encounter.js +26 -0
- package/dist/claim-helpers/claims-helpers-flag.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-flag.js +20 -0
- package/dist/claim-helpers/claims-helpers-immunization.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-immunization.js +20 -0
- package/dist/claim-helpers/claims-helpers-location.d.ts +10 -0
- package/dist/claim-helpers/claims-helpers-location.js +26 -0
- package/dist/claim-helpers/claims-helpers-medication-statement.d.ts +96 -0
- package/dist/claim-helpers/claims-helpers-medication-statement.js +278 -0
- package/dist/claim-helpers/claims-helpers-observation.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-observation.js +20 -0
- package/dist/claim-helpers/claims-helpers-organization.d.ts +12 -0
- package/dist/claim-helpers/claims-helpers-organization.js +32 -0
- package/dist/claim-helpers/claims-helpers-procedure.d.ts +8 -0
- package/dist/claim-helpers/claims-helpers-procedure.js +20 -0
- package/dist/claim-helpers/claims-helpers-related-person.d.ts +22 -0
- package/dist/claim-helpers/claims-helpers-related-person.js +53 -0
- package/dist/claim-helpers/index.d.ts +23 -0
- package/dist/claim-helpers/index.js +23 -0
- package/dist/claims/allergy-intolerance-claims.d.ts +153 -0
- package/dist/claims/allergy-intolerance-claims.js +194 -0
- package/dist/claims/appointment-claims.d.ts +226 -0
- package/dist/claims/appointment-claims.js +218 -0
- package/dist/claims/appointment-response-claims.d.ts +63 -0
- package/dist/claims/appointment-response-claims.js +58 -0
- package/dist/claims/care-plan-claims.d.ts +37 -0
- package/dist/claims/care-plan-claims.js +59 -0
- package/dist/claims/claim-types.d.ts +9 -0
- package/dist/claims/claim-types.js +3 -0
- package/dist/claims/clinical-impression-claims.d.ts +17 -0
- package/dist/claims/clinical-impression-claims.js +30 -0
- package/dist/claims/communication-claims.d.ts +55 -0
- package/dist/claims/communication-claims.js +57 -0
- package/dist/claims/composition-claims.d.ts +27 -0
- package/dist/claims/composition-claims.js +27 -0
- package/dist/claims/condition-claims.d.ts +79 -0
- package/dist/claims/condition-claims.js +104 -0
- package/dist/claims/consent-claims.d.ts +195 -0
- package/dist/claims/consent-claims.js +74 -0
- package/dist/claims/coverage-claims.d.ts +16 -0
- package/dist/claims/coverage-claims.js +28 -0
- package/dist/claims/device-claims.d.ts +20 -0
- package/dist/claims/device-claims.js +36 -0
- package/dist/claims/device-use-statement-claims.d.ts +17 -0
- package/dist/claims/device-use-statement-claims.js +28 -0
- package/dist/claims/diagnostic-report-claims.d.ts +109 -0
- package/dist/claims/diagnostic-report-claims.js +120 -0
- package/dist/claims/document-reference-claims.d.ts +39 -0
- package/dist/claims/document-reference-claims.js +96 -0
- package/dist/claims/encounter-claims.d.ts +18 -0
- package/dist/claims/encounter-claims.js +32 -0
- package/dist/claims/flag-claims.d.ts +19 -0
- package/dist/claims/flag-claims.js +33 -0
- package/dist/claims/immunization-claims.d.ts +31 -0
- package/dist/claims/immunization-claims.js +54 -0
- package/dist/claims/immunization-recommendation-claims.d.ts +19 -0
- package/dist/claims/immunization-recommendation-claims.js +26 -0
- package/dist/claims/index.d.ts +29 -0
- package/dist/claims/index.js +29 -0
- package/dist/claims/invoice-claims.d.ts +277 -0
- package/dist/claims/invoice-claims.js +357 -0
- package/dist/claims/location-claims.d.ts +22 -0
- package/dist/claims/location-claims.js +34 -0
- package/dist/claims/medication-claims.d.ts +15 -0
- package/dist/claims/medication-claims.js +23 -0
- package/dist/claims/medication-statement-claims.d.ts +539 -0
- package/dist/claims/medication-statement-claims.js +469 -0
- package/dist/claims/organization-claims.d.ts +18 -0
- package/dist/claims/organization-claims.js +27 -0
- package/dist/claims/practitioner-role-claims.d.ts +18 -0
- package/dist/claims/practitioner-role-claims.js +33 -0
- package/dist/claims/procedure-claims.d.ts +24 -0
- package/dist/claims/procedure-claims.js +44 -0
- package/dist/claims/related-person-claims.d.ts +30 -0
- package/dist/claims/related-person-claims.js +44 -0
- package/dist/claims/research-subject-claims.d.ts +4 -0
- package/dist/claims/research-subject-claims.js +4 -0
- package/dist/claims/task-claims.d.ts +61 -0
- package/dist/claims/task-claims.js +64 -0
- package/dist/clinical-terminology.d.ts +73 -0
- package/dist/clinical-terminology.js +77 -0
- package/dist/constants/clinical-statuses.d.ts +102 -0
- package/dist/constants/clinical-statuses.js +93 -0
- package/dist/constants/fhir-code-systems.d.ts +15 -0
- package/dist/constants/fhir-code-systems.js +15 -0
- package/dist/constants/fhir-resource-types.d.ts +162 -0
- package/dist/constants/fhir-resource-types.js +70 -0
- package/dist/constants/fhir-versions.d.ts +10 -0
- package/dist/constants/fhir-versions.js +10 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +4 -0
- package/dist/converters/convert-allergy-intolerance.d.ts +3 -0
- package/dist/converters/convert-allergy-intolerance.js +85 -0
- package/dist/converters/convert-appointment-response.d.ts +3 -0
- package/dist/converters/convert-appointment-response.js +32 -0
- package/dist/converters/convert-appointment.d.ts +3 -0
- package/dist/converters/convert-appointment.js +61 -0
- package/dist/converters/convert-care-plan.d.ts +3 -0
- package/dist/converters/convert-care-plan.js +93 -0
- package/dist/converters/convert-clinical-impression.d.ts +3 -0
- package/dist/converters/convert-clinical-impression.js +42 -0
- package/dist/converters/convert-composition.d.ts +3 -0
- package/dist/converters/convert-composition.js +70 -0
- package/dist/converters/convert-condition.d.ts +3 -0
- package/dist/converters/convert-condition.js +51 -0
- package/dist/converters/convert-consent.d.ts +9 -0
- package/dist/converters/convert-consent.js +174 -0
- package/dist/converters/convert-coverage.d.ts +3 -0
- package/dist/converters/convert-coverage.js +51 -0
- package/dist/converters/convert-device-use-statement.d.ts +3 -0
- package/dist/converters/convert-device-use-statement.js +36 -0
- package/dist/converters/convert-device.d.ts +3 -0
- package/dist/converters/convert-device.js +48 -0
- package/dist/converters/convert-diagnostic-report.d.ts +3 -0
- package/dist/converters/convert-diagnostic-report.js +63 -0
- package/dist/converters/convert-document-reference.d.ts +3 -0
- package/dist/converters/convert-document-reference.js +54 -0
- package/dist/converters/convert-encounter.d.ts +3 -0
- package/dist/converters/convert-encounter.js +68 -0
- package/dist/converters/convert-flag.d.ts +3 -0
- package/dist/converters/convert-flag.js +42 -0
- package/dist/converters/convert-immunization.d.ts +3 -0
- package/dist/converters/convert-immunization.js +80 -0
- package/dist/converters/convert-location.d.ts +3 -0
- package/dist/converters/convert-location.js +44 -0
- package/dist/converters/convert-medication-statement.d.ts +3 -0
- package/dist/converters/convert-medication-statement.js +130 -0
- package/dist/converters/convert-observation.d.ts +33 -0
- package/dist/converters/convert-observation.js +246 -0
- package/dist/converters/convert-organization.d.ts +3 -0
- package/dist/converters/convert-organization.js +39 -0
- package/dist/converters/convert-practitioner-role.d.ts +3 -0
- package/dist/converters/convert-practitioner-role.js +62 -0
- package/dist/converters/convert-procedure.d.ts +3 -0
- package/dist/converters/convert-procedure.js +64 -0
- package/dist/converters/convert-related-person.d.ts +3 -0
- package/dist/converters/convert-related-person.js +31 -0
- package/dist/converters/convert-shared.d.ts +33 -0
- package/dist/converters/convert-shared.js +181 -0
- package/dist/converters/index.d.ts +24 -0
- package/dist/converters/index.js +24 -0
- package/dist/fhir-bundle.d.ts +9 -0
- package/dist/fhir-bundle.js +43 -0
- package/dist/fhir-search-parameters.d.ts +18 -0
- package/dist/fhir-search-parameters.js +52 -0
- package/dist/fhir-tokens.d.ts +11 -0
- package/dist/fhir-tokens.js +26 -0
- package/dist/fhir-types.d.ts +77 -0
- package/dist/fhir-types.js +1 -0
- package/dist/fhir-values.d.ts +13 -0
- package/dist/fhir-values.js +53 -0
- package/dist/group-r5.d.ts +121 -0
- package/dist/group-r5.js +301 -0
- package/dist/imaging-types.d.ts +30 -0
- package/dist/imaging-types.js +1 -0
- package/dist/immunization-flat-claims.d.ts +2 -0
- package/dist/immunization-flat-claims.js +2 -0
- package/dist/immunization-reminder-plan.d.ts +2 -0
- package/dist/immunization-reminder-plan.js +2 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/observation-claims.d.ts +170 -0
- package/dist/observation-claims.js +184 -0
- package/dist/related-person.d.ts +16 -0
- package/dist/related-person.js +14 -0
- package/dist/research-study-r5.d.ts +163 -0
- package/dist/research-study-r5.js +490 -0
- package/dist/search-models/index.d.ts +7 -0
- package/dist/search-models/index.js +7 -0
- package/dist/search-models/params/AdverseEvent.params.model.d.ts +14 -0
- package/dist/search-models/params/AdverseEvent.params.model.js +16 -0
- package/dist/search-models/params/AllergyIntolerance.params.model.d.ts +24 -0
- package/dist/search-models/params/AllergyIntolerance.params.model.js +27 -0
- package/dist/search-models/params/Appointment.params.model.d.ts +12 -0
- package/dist/search-models/params/Appointment.params.model.js +14 -0
- package/dist/search-models/params/ClinicalImpression.params.model.d.ts +14 -0
- package/dist/search-models/params/ClinicalImpression.params.model.js +15 -0
- package/dist/search-models/params/Condition.params.model.d.ts +16 -0
- package/dist/search-models/params/Condition.params.model.js +17 -0
- package/dist/search-models/params/DetectedIssue.params.model.d.ts +9 -0
- package/dist/search-models/params/DetectedIssue.params.model.js +11 -0
- package/dist/search-models/params/DiagnosticReport.params.model.d.ts +13 -0
- package/dist/search-models/params/DiagnosticReport.params.model.js +14 -0
- package/dist/search-models/params/Encounter.params.model.d.ts +15 -0
- package/dist/search-models/params/Encounter.params.model.js +17 -0
- package/dist/search-models/params/Immunization.params.model.d.ts +14 -0
- package/dist/search-models/params/Immunization.params.model.js +16 -0
- package/dist/search-models/params/Medication.params.model.d.ts +35 -0
- package/dist/search-models/params/Medication.params.model.js +45 -0
- package/dist/search-models/params/Observation.params.model.d.ts +326 -0
- package/dist/search-models/params/Observation.params.model.js +244 -0
- package/dist/search-models/params/Procedure.params.model.d.ts +15 -0
- package/dist/search-models/params/Procedure.params.model.js +17 -0
- package/dist/search-models/params/Search.params.model.d.ts +75 -0
- package/dist/search-models/params/Search.params.model.js +69 -0
- package/dist/search-models/params/ServiceRequest.params.model.d.ts +14 -0
- package/dist/search-models/params/ServiceRequest.params.model.js +16 -0
- package/dist/search-models/params/Specimen.params.model.d.ts +10 -0
- package/dist/search-models/params/Specimen.params.model.js +12 -0
- package/dist/search-models/params/index.d.ts +15 -0
- package/dist/search-models/params/index.js +15 -0
- package/dist/search-models/templates/AdverseEvent.template.model.d.ts +16 -0
- package/dist/search-models/templates/AdverseEvent.template.model.js +2 -0
- package/dist/search-models/templates/AllergyIntolerance.template.model.d.ts +24 -0
- package/dist/search-models/templates/AllergyIntolerance.template.model.js +1 -0
- package/dist/search-models/templates/Appointment.template.model.d.ts +13 -0
- package/dist/search-models/templates/Appointment.template.model.js +1 -0
- package/dist/search-models/templates/ClinicalImpression.template.model.d.ts +16 -0
- package/dist/search-models/templates/ClinicalImpression.template.model.js +1 -0
- package/dist/search-models/templates/Condition.template.model.d.ts +18 -0
- package/dist/search-models/templates/Condition.template.model.js +1 -0
- package/dist/search-models/templates/DetectedIssue.template.model.d.ts +11 -0
- package/dist/search-models/templates/DetectedIssue.template.model.js +1 -0
- package/dist/search-models/templates/DiagnosticReport.template.model.d.ts +15 -0
- package/dist/search-models/templates/DiagnosticReport.template.model.js +1 -0
- package/dist/search-models/templates/Encounter.template.model.d.ts +17 -0
- package/dist/search-models/templates/Encounter.template.model.js +1 -0
- package/dist/search-models/templates/Immunization.template.model.d.ts +18 -0
- package/dist/search-models/templates/Immunization.template.model.js +2 -0
- package/dist/search-models/templates/Medication.template.model.d.ts +37 -0
- package/dist/search-models/templates/Medication.template.model.js +1 -0
- package/dist/search-models/templates/Observation.template.model.d.ts +18 -0
- package/dist/search-models/templates/Observation.template.model.js +1 -0
- package/dist/search-models/templates/Procedure.template.model.d.ts +17 -0
- package/dist/search-models/templates/Procedure.template.model.js +1 -0
- package/dist/search-models/templates/ServiceRequest.template.model.d.ts +16 -0
- package/dist/search-models/templates/ServiceRequest.template.model.js +1 -0
- package/dist/search-models/templates/Specimen.template.model.d.ts +12 -0
- package/dist/search-models/templates/Specimen.template.model.js +1 -0
- package/dist/search-models/templates/index.d.ts +14 -0
- package/dist/search-models/templates/index.js +14 -0
- package/dist/terminology-models/AtcModel.d.ts +15 -0
- package/dist/terminology-models/AtcModel.js +2 -0
- package/dist/terminology-models/CommonModels.d.ts +70 -0
- package/dist/terminology-models/CommonModels.js +55 -0
- package/dist/terminology-models/FhirModels.d.ts +60 -0
- package/dist/terminology-models/FhirModels.js +34 -0
- package/dist/terminology-models/LoincModels.d.ts +24 -0
- package/dist/terminology-models/LoincModels.js +2 -0
- package/dist/terminology-models/SnomedModels.d.ts +13 -0
- package/dist/terminology-models/SnomedModels.js +2 -0
- package/dist/terminology-models/index.d.ts +6 -0
- package/dist/terminology-models/index.js +6 -0
- package/docs/UHC_FHIR_UTILS_MIGRATION.md +51 -8
- package/package.json +83 -2
package/dist/group-r5.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe FHIR R5 Group contract for research-team descriptions.
|
|
3
|
+
*
|
|
4
|
+
* Group membership is descriptive. It never grants authorization, permission
|
|
5
|
+
* or a SMART scope; those decisions remain separate Consent and credential
|
|
6
|
+
* contracts.
|
|
7
|
+
*
|
|
8
|
+
* @see https://hl7.org/fhir/R5/group.html
|
|
9
|
+
* @see https://hl7.org/fhir/R5/group-search.html
|
|
10
|
+
*/
|
|
11
|
+
export const GroupR5Version = '5.0.0';
|
|
12
|
+
export const GroupR5TypeSystem = 'http://hl7.org/fhir/group-type';
|
|
13
|
+
export const GroupR5TypeCodes = Object.freeze([
|
|
14
|
+
'person',
|
|
15
|
+
'animal',
|
|
16
|
+
'practitioner',
|
|
17
|
+
'device',
|
|
18
|
+
'careteam',
|
|
19
|
+
'healthcareservice',
|
|
20
|
+
'location',
|
|
21
|
+
'organization',
|
|
22
|
+
'relatedperson',
|
|
23
|
+
'specimen',
|
|
24
|
+
]);
|
|
25
|
+
export const GroupR5MembershipSystem = 'http://hl7.org/fhir/group-membership-basis';
|
|
26
|
+
export const GroupR5MembershipCodes = Object.freeze(['definitional', 'enumerated']);
|
|
27
|
+
export const GroupR5Bindings = Object.freeze({
|
|
28
|
+
type: Object.freeze({
|
|
29
|
+
valueSet: 'http://hl7.org/fhir/ValueSet/group-type',
|
|
30
|
+
strength: 'required',
|
|
31
|
+
}),
|
|
32
|
+
membership: Object.freeze({
|
|
33
|
+
valueSet: 'http://hl7.org/fhir/ValueSet/group-membership-basis',
|
|
34
|
+
strength: 'required',
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
const searchParameter = (code, type, expression, components = []) => Object.freeze({
|
|
38
|
+
code,
|
|
39
|
+
type,
|
|
40
|
+
expression,
|
|
41
|
+
components: Object.freeze([...components]),
|
|
42
|
+
});
|
|
43
|
+
/** Exact resource-specific SearchParameters published by FHIR R5 5.0.0. */
|
|
44
|
+
export const GroupR5SearchParameterCatalog = Object.freeze([
|
|
45
|
+
searchParameter('characteristic', 'token', 'Group.characteristic.code'),
|
|
46
|
+
searchParameter('characteristic-reference', 'reference', '(Group.characteristic.value.ofType(Reference))'),
|
|
47
|
+
searchParameter('characteristic-value', 'composite', 'Group.characteristic', [
|
|
48
|
+
'http://hl7.org/fhir/SearchParameter/Group-characteristic',
|
|
49
|
+
'http://hl7.org/fhir/SearchParameter/Group-value',
|
|
50
|
+
]),
|
|
51
|
+
searchParameter('code', 'token', 'Group.code'),
|
|
52
|
+
searchParameter('exclude', 'token', 'Group.characteristic.exclude'),
|
|
53
|
+
searchParameter('identifier', 'token', 'Group.identifier'),
|
|
54
|
+
searchParameter('managing-entity', 'reference', 'Group.managingEntity'),
|
|
55
|
+
searchParameter('member', 'reference', 'Group.member.entity'),
|
|
56
|
+
searchParameter('membership', 'token', 'Group.membership'),
|
|
57
|
+
searchParameter('name', 'string', 'Group.name'),
|
|
58
|
+
searchParameter('type', 'token', 'Group.type'),
|
|
59
|
+
searchParameter('value', 'token', '(Group.characteristic.value.ofType(CodeableConcept)) | (Group.characteristic.value.ofType(boolean))'),
|
|
60
|
+
]);
|
|
61
|
+
/** Canonical Group flat-claim names. Never repeat these storage keys as literals. */
|
|
62
|
+
export const GroupClaim = Object.freeze({
|
|
63
|
+
Characteristic: 'Group.characteristic',
|
|
64
|
+
CharacteristicReference: 'Group.characteristic-reference',
|
|
65
|
+
CharacteristicValue: 'Group.characteristic-value',
|
|
66
|
+
Code: 'Group.code',
|
|
67
|
+
Exclude: 'Group.exclude',
|
|
68
|
+
Identifier: 'Group.identifier',
|
|
69
|
+
ManagingEntity: 'Group.managing-entity',
|
|
70
|
+
Member: 'Group.member',
|
|
71
|
+
Membership: 'Group.membership',
|
|
72
|
+
Name: 'Group.name',
|
|
73
|
+
Type: 'Group.type',
|
|
74
|
+
Value: 'Group.value',
|
|
75
|
+
});
|
|
76
|
+
const standardSearchClaims = Object.freeze(Object.values(GroupClaim));
|
|
77
|
+
/** Canonical claims derived only from the official resource-specific catalogue. */
|
|
78
|
+
export const GroupFlatClaimCatalog = Object.freeze({
|
|
79
|
+
standardSearch: standardSearchClaims,
|
|
80
|
+
all: standardSearchClaims,
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Normalizes the members used by an enumerated professional research team.
|
|
84
|
+
* Every entity is a native PractitionerRole reference; a Practitioner or an
|
|
85
|
+
* employee identifier cannot substitute for the registered role assignment.
|
|
86
|
+
*/
|
|
87
|
+
export function normalizeGroupPractitionerRoleMembers(input) {
|
|
88
|
+
if (!Array.isArray(input))
|
|
89
|
+
throw new TypeError('group_members_invalid');
|
|
90
|
+
return Object.freeze(input.map((value, index) => {
|
|
91
|
+
if (!isRecord(value) || containsAuthorizationProperty(value)) {
|
|
92
|
+
throw new TypeError(containsAuthorizationProperty(value) ? 'group_authorization_property_forbidden' : `group_member_${index}_invalid`);
|
|
93
|
+
}
|
|
94
|
+
if (!isRecord(value.entity))
|
|
95
|
+
throw new TypeError(`group_member_${index}_practitioner_role_reference_invalid`);
|
|
96
|
+
const reference = optionalString(value.entity.reference);
|
|
97
|
+
const declaredType = optionalString(value.entity.type);
|
|
98
|
+
if (!reference || !/^PractitionerRole\/[A-Za-z0-9.-]{1,64}$/.test(reference) || (declaredType && declaredType !== 'PractitionerRole')) {
|
|
99
|
+
throw new TypeError(`group_member_${index}_practitioner_role_reference_invalid`);
|
|
100
|
+
}
|
|
101
|
+
const display = optionalString(value.entity.display);
|
|
102
|
+
const period = value.period === undefined ? undefined : normalizePeriod(value.period, index);
|
|
103
|
+
if (value.inactive !== undefined && typeof value.inactive !== 'boolean') {
|
|
104
|
+
throw new TypeError(`group_member_${index}_inactive_invalid`);
|
|
105
|
+
}
|
|
106
|
+
return Object.freeze({
|
|
107
|
+
entity: Object.freeze({
|
|
108
|
+
reference: reference,
|
|
109
|
+
type: 'PractitionerRole',
|
|
110
|
+
...(display ? { display } : {}),
|
|
111
|
+
}),
|
|
112
|
+
...(period ? { period } : {}),
|
|
113
|
+
...(value.inactive !== undefined ? { inactive: value.inactive } : {}),
|
|
114
|
+
});
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Normalizes the Group profile used to describe an explicit professional
|
|
119
|
+
* ResearchStudy team. This data is descriptive and authorization-shaped
|
|
120
|
+
* properties are rejected at every depth.
|
|
121
|
+
*/
|
|
122
|
+
export function normalizeGroupR5ResearchTeam(input) {
|
|
123
|
+
if (!isRecord(input) || input.resourceType !== 'Group')
|
|
124
|
+
throw new TypeError('group_resource_invalid');
|
|
125
|
+
if (containsAuthorizationProperty(input))
|
|
126
|
+
throw new TypeError('group_authorization_property_forbidden');
|
|
127
|
+
if (input.type !== 'practitioner')
|
|
128
|
+
throw new TypeError('group_research_team_type_invalid');
|
|
129
|
+
if (input.membership !== 'enumerated')
|
|
130
|
+
throw new TypeError('group_research_team_membership_invalid');
|
|
131
|
+
const member = normalizeGroupPractitionerRoleMembers(input.member);
|
|
132
|
+
return Object.freeze({ ...input, type: 'practitioner', membership: 'enumerated', member });
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Projects all populated official resource-specific R5 Group SearchParameters
|
|
136
|
+
* into flat `resource.meta.claims`. A referenced characteristic is indexed by
|
|
137
|
+
* `characteristic-reference`, not as the token-valued `value` parameter.
|
|
138
|
+
*
|
|
139
|
+
* @see https://hl7.org/fhir/R5/group-search.html
|
|
140
|
+
*/
|
|
141
|
+
export function projectGroupR5SearchClaims(input) {
|
|
142
|
+
if (!isRecord(input) || input.resourceType !== 'Group')
|
|
143
|
+
throw new TypeError('group_resource_invalid');
|
|
144
|
+
if (containsAuthorizationProperty(input))
|
|
145
|
+
throw new TypeError('group_authorization_property_forbidden');
|
|
146
|
+
if (!GroupR5TypeCodes.includes(input.type))
|
|
147
|
+
throw new TypeError('group_type_invalid');
|
|
148
|
+
if (!GroupR5MembershipCodes.includes(input.membership)) {
|
|
149
|
+
throw new TypeError('group_membership_invalid');
|
|
150
|
+
}
|
|
151
|
+
const characteristics = normalizeRecords(input.characteristic, 'group_characteristic_invalid');
|
|
152
|
+
const characteristicCodes = characteristics.flatMap(item => conceptTokens(item.code));
|
|
153
|
+
const characteristicValues = characteristics.flatMap(characteristicTokenValues);
|
|
154
|
+
const claims = {};
|
|
155
|
+
addClaim(claims, GroupClaim.Characteristic, characteristicCodes);
|
|
156
|
+
addClaim(claims, GroupClaim.CharacteristicReference, characteristics.flatMap(item => referenceTokens(item.valueReference)));
|
|
157
|
+
addClaim(claims, GroupClaim.CharacteristicValue, characteristics.flatMap(item => conceptTokens(item.code).flatMap(code => characteristicTokenValues(item).map(value => `${code}$${value}`))));
|
|
158
|
+
addClaim(claims, GroupClaim.Code, conceptTokens(input.code));
|
|
159
|
+
addClaim(claims, GroupClaim.Exclude, characteristics.flatMap(item => typeof item.exclude === 'boolean' ? [String(item.exclude)] : []));
|
|
160
|
+
addClaim(claims, GroupClaim.Identifier, identifierTokens(input.identifier));
|
|
161
|
+
addClaim(claims, GroupClaim.ManagingEntity, referenceTokens(input.managingEntity));
|
|
162
|
+
addClaim(claims, GroupClaim.Member, normalizeRecords(input.member, 'group_members_invalid').flatMap(item => referenceTokens(item.entity)));
|
|
163
|
+
addClaim(claims, GroupClaim.Membership, [input.membership]);
|
|
164
|
+
addClaim(claims, GroupClaim.Name, strings(input.name));
|
|
165
|
+
addClaim(claims, GroupClaim.Type, [input.type]);
|
|
166
|
+
addClaim(claims, GroupClaim.Value, characteristicValues);
|
|
167
|
+
return Object.freeze(claims);
|
|
168
|
+
}
|
|
169
|
+
/** Projects native-shaped Group input to the claims-only GW persistence shape. */
|
|
170
|
+
export function projectGroupR5FlatClaimsResource(input) {
|
|
171
|
+
if (!isRecord(input) || input.resourceType !== 'Group')
|
|
172
|
+
throw new TypeError('group_resource_invalid');
|
|
173
|
+
const id = fhirId(input.id, 'group_flat_resource_invalid');
|
|
174
|
+
if (Array.isArray(input.member) && input.member.length > 0)
|
|
175
|
+
throw new TypeError('group_members_require_separate_resources');
|
|
176
|
+
return normalizeGroupR5FlatClaimsResource({
|
|
177
|
+
resourceType: 'Group',
|
|
178
|
+
id,
|
|
179
|
+
meta: { claims: projectGroupR5SearchClaims(input) },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** Projects one correlated claims-only GW resource per PractitionerRole member. */
|
|
183
|
+
export function projectGroupPractitionerRoleMemberFlatClaimResources(input) {
|
|
184
|
+
const id = fhirId(input.groupId, 'group_flat_resource_invalid');
|
|
185
|
+
const members = normalizeGroupPractitionerRoleMembers(input.members);
|
|
186
|
+
return Object.freeze(members.map(member => normalizeGroupR5FlatClaimsResource({
|
|
187
|
+
resourceType: 'Group',
|
|
188
|
+
id,
|
|
189
|
+
meta: {
|
|
190
|
+
claims: projectGroupR5SearchClaims({
|
|
191
|
+
resourceType: 'Group',
|
|
192
|
+
id,
|
|
193
|
+
type: 'practitioner',
|
|
194
|
+
membership: 'enumerated',
|
|
195
|
+
member: [member],
|
|
196
|
+
}),
|
|
197
|
+
},
|
|
198
|
+
})));
|
|
199
|
+
}
|
|
200
|
+
/** Validates and freezes a claims-only Group GW resource. */
|
|
201
|
+
export function normalizeGroupR5FlatClaimsResource(input) {
|
|
202
|
+
if (!isRecord(input)
|
|
203
|
+
|| input.resourceType !== 'Group'
|
|
204
|
+
|| Object.keys(input).some(key => !['resourceType', 'id', 'meta'].includes(key))) {
|
|
205
|
+
throw new TypeError('group_flat_resource_invalid');
|
|
206
|
+
}
|
|
207
|
+
const id = fhirId(input.id, 'group_flat_resource_invalid');
|
|
208
|
+
if (!isRecord(input.meta) || !isRecord(input.meta.claims))
|
|
209
|
+
throw new TypeError('group_flat_resource_invalid');
|
|
210
|
+
const claims = {};
|
|
211
|
+
for (const [name, rawValues] of Object.entries(input.meta.claims)) {
|
|
212
|
+
if (!GroupFlatClaimCatalog.all.includes(name)
|
|
213
|
+
|| !Array.isArray(rawValues)
|
|
214
|
+
|| rawValues.length === 0
|
|
215
|
+
|| rawValues.some(value => typeof value !== 'string' || !value.trim())) {
|
|
216
|
+
throw new TypeError('group_flat_claim_invalid');
|
|
217
|
+
}
|
|
218
|
+
claims[name] = Object.freeze(rawValues.map(value => value.trim()));
|
|
219
|
+
}
|
|
220
|
+
return Object.freeze({ resourceType: 'Group', id, meta: Object.freeze({ claims: Object.freeze(claims) }) });
|
|
221
|
+
}
|
|
222
|
+
function addClaim(claims, name, values) {
|
|
223
|
+
const normalized = [...new Set(values.flatMap(value => strings(value)))];
|
|
224
|
+
if (normalized.length > 0)
|
|
225
|
+
claims[name] = Object.freeze(normalized);
|
|
226
|
+
}
|
|
227
|
+
function identifierTokens(value) {
|
|
228
|
+
return normalizeRecords(value, 'group_identifier_invalid').flatMap(identifier => {
|
|
229
|
+
const system = optionalString(identifier.system);
|
|
230
|
+
const identifierValue = optionalString(identifier.value);
|
|
231
|
+
return identifierValue ? [`${system ? `${system}|` : ''}${identifierValue}`] : [];
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function conceptTokens(value) {
|
|
235
|
+
if (!isRecord(value))
|
|
236
|
+
return [];
|
|
237
|
+
const coding = normalizeRecords(value.coding, 'group_coding_invalid').flatMap(item => {
|
|
238
|
+
const system = optionalString(item.system);
|
|
239
|
+
const code = optionalString(item.code);
|
|
240
|
+
return code ? [`${system ? `${system}|` : ''}${code}`] : [];
|
|
241
|
+
});
|
|
242
|
+
return coding.length > 0 ? coding : strings(value.text);
|
|
243
|
+
}
|
|
244
|
+
function characteristicTokenValues(value) {
|
|
245
|
+
if (typeof value.valueBoolean === 'boolean')
|
|
246
|
+
return [String(value.valueBoolean)];
|
|
247
|
+
return conceptTokens(value.valueCodeableConcept);
|
|
248
|
+
}
|
|
249
|
+
function referenceTokens(value) {
|
|
250
|
+
return isRecord(value) ? strings(value.reference) : [];
|
|
251
|
+
}
|
|
252
|
+
function normalizeRecords(value, error) {
|
|
253
|
+
if (value === undefined)
|
|
254
|
+
return [];
|
|
255
|
+
if (!Array.isArray(value) || !value.every(isRecord))
|
|
256
|
+
throw new TypeError(error);
|
|
257
|
+
return value;
|
|
258
|
+
}
|
|
259
|
+
function normalizePeriod(value, index) {
|
|
260
|
+
if (!isRecord(value))
|
|
261
|
+
throw new TypeError(`group_member_${index}_period_invalid`);
|
|
262
|
+
const start = optionalString(value.start);
|
|
263
|
+
const end = optionalString(value.end);
|
|
264
|
+
if (!start && !end)
|
|
265
|
+
throw new TypeError(`group_member_${index}_period_invalid`);
|
|
266
|
+
if ((start && !isFhirDateTime(start)) || (end && !isFhirDateTime(end))) {
|
|
267
|
+
throw new TypeError(`group_member_${index}_period_invalid`);
|
|
268
|
+
}
|
|
269
|
+
if (start && end && Date.parse(end) < Date.parse(start))
|
|
270
|
+
throw new TypeError(`group_member_${index}_period_invalid`);
|
|
271
|
+
return Object.freeze({ ...(start ? { start } : {}), ...(end ? { end } : {}) });
|
|
272
|
+
}
|
|
273
|
+
function containsAuthorizationProperty(value, seen = new WeakSet()) {
|
|
274
|
+
if (!value || typeof value !== 'object')
|
|
275
|
+
return false;
|
|
276
|
+
if (seen.has(value))
|
|
277
|
+
return false;
|
|
278
|
+
seen.add(value);
|
|
279
|
+
if (Array.isArray(value))
|
|
280
|
+
return value.some(item => containsAuthorizationProperty(item, seen));
|
|
281
|
+
return Object.entries(value).some(([name, nested]) => ['authorization', 'permission', 'scope'].includes(name) || containsAuthorizationProperty(nested, seen));
|
|
282
|
+
}
|
|
283
|
+
function strings(value) {
|
|
284
|
+
const normalized = optionalString(value);
|
|
285
|
+
return normalized ? [normalized] : [];
|
|
286
|
+
}
|
|
287
|
+
function optionalString(value) {
|
|
288
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
289
|
+
}
|
|
290
|
+
function isFhirDateTime(value) {
|
|
291
|
+
return /^\d{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12]\d|3[01])(?:T.+)?)?)?$/.test(value);
|
|
292
|
+
}
|
|
293
|
+
function isRecord(value) {
|
|
294
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
295
|
+
}
|
|
296
|
+
function fhirId(value, error) {
|
|
297
|
+
const id = optionalString(value);
|
|
298
|
+
if (!id || !/^[A-Za-z0-9.-]{1,64}$/.test(id))
|
|
299
|
+
throw new TypeError(error);
|
|
300
|
+
return id;
|
|
301
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Type-only DICOMDIR tree contract recovered from the retired UHC package. */
|
|
2
|
+
export interface DicomDirectoryNode {
|
|
3
|
+
id: string;
|
|
4
|
+
uid: string;
|
|
5
|
+
key: string;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface DicomDirectoryPatient extends DicomDirectoryNode {
|
|
9
|
+
value: string;
|
|
10
|
+
children?: DicomDirectoryStudy[];
|
|
11
|
+
}
|
|
12
|
+
export interface DicomDirectoryStudy extends DicomDirectoryNode {
|
|
13
|
+
description: string;
|
|
14
|
+
numberOfSeries?: number;
|
|
15
|
+
numberOfInstances?: number;
|
|
16
|
+
value: string;
|
|
17
|
+
children?: DicomDirectorySeries[];
|
|
18
|
+
}
|
|
19
|
+
export interface DicomDirectorySeries extends DicomDirectoryNode {
|
|
20
|
+
description: string;
|
|
21
|
+
number: number;
|
|
22
|
+
value: string;
|
|
23
|
+
children?: DicomDirectoryInstance[];
|
|
24
|
+
}
|
|
25
|
+
export interface DicomDirectoryInstance extends DicomDirectoryNode {
|
|
26
|
+
number: number;
|
|
27
|
+
path: string;
|
|
28
|
+
sopClassUID: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,22 @@ export * from './coding-review-flat-claims.js';
|
|
|
3
3
|
export * from './search-parameters.js';
|
|
4
4
|
export * from './observation-claims.js';
|
|
5
5
|
export * from './vital-sign-observations.js';
|
|
6
|
+
export * from './claims/index.js';
|
|
7
|
+
export * from './claim-helpers/index.js';
|
|
8
|
+
export * from './converters/index.js';
|
|
9
|
+
export * from './fhir-types.js';
|
|
10
|
+
export * from './fhir-values.js';
|
|
11
|
+
export * from './fhir-search-parameters.js';
|
|
12
|
+
export * from './search-models/index.js';
|
|
13
|
+
export * from './fhir-bundle.js';
|
|
14
|
+
export * from './terminology-models/index.js';
|
|
15
|
+
export * from './constants/index.js';
|
|
16
|
+
export * from './clinical-terminology.js';
|
|
17
|
+
export * from './immunization-flat-claims.js';
|
|
18
|
+
export * from './immunization-reminder-plan.js';
|
|
19
|
+
export * from './builders/index.js';
|
|
20
|
+
export * from './group-r5.js';
|
|
21
|
+
export * from './research-study-r5.js';
|
|
22
|
+
export * from './fhir-tokens.js';
|
|
23
|
+
export * from './related-person.js';
|
|
24
|
+
export * from './imaging-types.js';
|
package/dist/index.js
CHANGED
|
@@ -3,3 +3,22 @@ export * from './coding-review-flat-claims.js';
|
|
|
3
3
|
export * from './search-parameters.js';
|
|
4
4
|
export * from './observation-claims.js';
|
|
5
5
|
export * from './vital-sign-observations.js';
|
|
6
|
+
export * from './claims/index.js';
|
|
7
|
+
export * from './claim-helpers/index.js';
|
|
8
|
+
export * from './converters/index.js';
|
|
9
|
+
export * from './fhir-types.js';
|
|
10
|
+
export * from './fhir-values.js';
|
|
11
|
+
export * from './fhir-search-parameters.js';
|
|
12
|
+
export * from './search-models/index.js';
|
|
13
|
+
export * from './fhir-bundle.js';
|
|
14
|
+
export * from './terminology-models/index.js';
|
|
15
|
+
export * from './constants/index.js';
|
|
16
|
+
export * from './clinical-terminology.js';
|
|
17
|
+
export * from './immunization-flat-claims.js';
|
|
18
|
+
export * from './immunization-reminder-plan.js';
|
|
19
|
+
export * from './builders/index.js';
|
|
20
|
+
export * from './group-r5.js';
|
|
21
|
+
export * from './research-study-r5.js';
|
|
22
|
+
export * from './fhir-tokens.js';
|
|
23
|
+
export * from './related-person.js';
|
|
24
|
+
export * from './imaging-types.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClaimSpec } from './claims/claim-types.js';
|
|
1
2
|
/** Canonical code-system URIs used by neutral Observation contracts. */
|
|
2
3
|
export declare const FhirCodeSystem: Readonly<{
|
|
3
4
|
readonly Loinc: "http://loinc.org";
|
|
@@ -121,6 +122,8 @@ export declare const ObservationClaim: Readonly<{
|
|
|
121
122
|
readonly ValueString: "Observation.value-string";
|
|
122
123
|
readonly Note: "Observation.note";
|
|
123
124
|
readonly EffectiveDateTime: "Observation.effective-datetime";
|
|
125
|
+
/** @deprecated Read-only camelCase key from historical persisted rows. */
|
|
126
|
+
readonly EffectiveDateTimeLegacy: "Observation.effectiveDateTime";
|
|
124
127
|
/** Custom provenance flag for an explicitly entered or selected result. */
|
|
125
128
|
readonly UserSelected: "Observation.user-selected";
|
|
126
129
|
}>;
|
|
@@ -130,3 +133,170 @@ export type ObservationClaimKey = typeof ObservationClaim[keyof typeof Observati
|
|
|
130
133
|
* Compatibility input is normalized in memory and never emitted again.
|
|
131
134
|
*/
|
|
132
135
|
export declare function decodeObservationClaimList(value: string | undefined): readonly unknown[];
|
|
136
|
+
export type SplitCodingClaims = Readonly<{
|
|
137
|
+
system?: string;
|
|
138
|
+
value?: string;
|
|
139
|
+
text?: string;
|
|
140
|
+
display?: string;
|
|
141
|
+
}>;
|
|
142
|
+
/**
|
|
143
|
+
* Builds the legacy compact `system|code` token from split claims.
|
|
144
|
+
*
|
|
145
|
+
* Use this only for compatibility/export. Frontend authoring should prefer the
|
|
146
|
+
* split fields such as `code-value`, `code-text`, and `value-concept-value`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function buildObservationCodingClaim(input: SplitCodingClaims): string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Splits a compact token such as `http://loinc.org|8867-4` into separate
|
|
151
|
+
* claims that are easier for forms, local storage, and numeric/text filters.
|
|
152
|
+
*/
|
|
153
|
+
export declare function splitObservationCodingClaim(value: unknown): SplitCodingClaims;
|
|
154
|
+
/**
|
|
155
|
+
* Reduced claim surface that mirrors FHIR `Observation.component`.
|
|
156
|
+
*
|
|
157
|
+
* By design this shape does not include `status`, `subject`, or other
|
|
158
|
+
* top-level Observation context fields from FHIR. When a component needs to be
|
|
159
|
+
* persisted/indexed locally, the transformer may add only the minimum
|
|
160
|
+
* operational fields (`identifier`, `subject`) in a separate indexed shape.
|
|
161
|
+
*/
|
|
162
|
+
export interface ClaimsObservationComponent {
|
|
163
|
+
/** Code system URL. Example: `http://loinc.org`. The SDK can derive the compact token from this and `code-value`. */
|
|
164
|
+
[ObservationClaim.CodeSystem]?: string;
|
|
165
|
+
/** Code value. Example: `8480-6`. This is the main code field for UI authoring and search. */
|
|
166
|
+
[ObservationClaim.CodeValue]?: string;
|
|
167
|
+
/** Local-language human label used by forms. Example: `Presión arterial sistólica`. */
|
|
168
|
+
[ObservationClaim.CodeText]?: string;
|
|
169
|
+
/** Canonical English/international display. Example: `Systolic blood pressure`. */
|
|
170
|
+
[ObservationClaim.CodeDisplay]?: string;
|
|
171
|
+
/** Component/observation code as `system|code`. Example: `http://loinc.org|8480-6`. */
|
|
172
|
+
[ObservationClaim.Code]?: string;
|
|
173
|
+
/** Value concept system URL. Example: `http://terminology.hl7.org/CodeSystem/data-absent-reason`. */
|
|
174
|
+
[ObservationClaim.ValueConceptSystem]?: string;
|
|
175
|
+
/** Value concept code value. Example: `not-performed`. */
|
|
176
|
+
[ObservationClaim.ValueConceptValue]?: string;
|
|
177
|
+
/** Local-language label for the value concept. Example: `No realizado`. */
|
|
178
|
+
[ObservationClaim.ValueConceptText]?: string;
|
|
179
|
+
/** Canonical English/international display for the value concept. Example: `Not performed`. */
|
|
180
|
+
[ObservationClaim.ValueConceptDisplay]?: string;
|
|
181
|
+
/** Value as coded concept token. Example: `http://terminology.hl7.org/CodeSystem/data-absent-reason|not-performed`. */
|
|
182
|
+
[ObservationClaim.ValueConcept]?: string;
|
|
183
|
+
/** Value when the observation result itself is one date/dateTime. Example: `2026-06-01T10:00:00Z`. */
|
|
184
|
+
[ObservationClaim.ValueDate]?: string;
|
|
185
|
+
/** Free-text value when the result is narrative rather than coded/quantified. Example: `Former smoker`. */
|
|
186
|
+
[ObservationClaim.ValueString]?: string;
|
|
187
|
+
/** Optional FHIR Quantity comparator. Allowed values: `<`, `<=`, `>=`, `>`. Example: `>=`. */
|
|
188
|
+
[ObservationClaim.ValueQuantityComparator]?: string;
|
|
189
|
+
/** Numeric scalar of the observed value. Example heart rate: `72`. Example temperature: `38.4`. */
|
|
190
|
+
[ObservationClaim.ValueQuantityNumber]?: string | number;
|
|
191
|
+
/** Human-readable quantity unit. Example: `/min`, `mmHg`, `Cel`. */
|
|
192
|
+
[ObservationClaim.ValueQuantityUnit]?: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Reduced component claims after local indexing adds only the minimal locator
|
|
196
|
+
* information required by vault persistence and parent/child traversal.
|
|
197
|
+
*/
|
|
198
|
+
export interface ClaimsObservationComponentIndexed extends ClaimsObservationComponent {
|
|
199
|
+
/** Synthetic/local identifier added during indexing of a reduced imported component. Example: `bp-systolic-1`. */
|
|
200
|
+
[ObservationClaim.Identifier]: string;
|
|
201
|
+
/** Subject inherited from the parent observation so the reduced row can be indexed and located locally. */
|
|
202
|
+
[ObservationClaim.Subject]: string;
|
|
203
|
+
/** Optional compatibility alias of `Observation.subject`. */
|
|
204
|
+
[ObservationClaim.Patient]?: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Minimal visible Vital Signs Observation claims.
|
|
208
|
+
*
|
|
209
|
+
* This is the practical authoring/search surface for local-first individual
|
|
210
|
+
* apps. A row without `Observation.status` is not considered a visible vital
|
|
211
|
+
* sign result and should be ignored by normal section list/search operations.
|
|
212
|
+
*/
|
|
213
|
+
export interface ClaimsObservationVitalSigns extends ClaimsObservationComponentIndexed {
|
|
214
|
+
/** Required for visible/searchable vital signs. If missing, treat the row as internal/supporting only. Example: `final`. */
|
|
215
|
+
[ObservationClaim.Status]: string;
|
|
216
|
+
/** Must contain the vital-signs category token for visible Vital Signs rows. */
|
|
217
|
+
[ObservationClaim.Category]: string;
|
|
218
|
+
/** Vital Sign LOINC code. Example heart rate: `http://loinc.org|8867-4`. */
|
|
219
|
+
[ObservationClaim.Code]: string;
|
|
220
|
+
/** Clinical time of the observation when represented as one scalar date/dateTime. */
|
|
221
|
+
[ObservationClaim.Date]?: string;
|
|
222
|
+
/** FHIR-compatible explicit `effectiveDateTime` fallback. Example: `2026-06-01T10:00:00Z`. */
|
|
223
|
+
[ObservationClaim.EffectiveDateTime]?: string;
|
|
224
|
+
/** Language of authored text/narrative. Example: `en`, `es`. */
|
|
225
|
+
[ObservationClaim.Language]?: string;
|
|
226
|
+
/** Observation method token when relevant. Example: `http://snomed.info/sct|252465000`. */
|
|
227
|
+
[ObservationClaim.Method]?: string;
|
|
228
|
+
/** User-authored note. Example: `Measured after resting 5 minutes.` */
|
|
229
|
+
[ObservationClaim.Note]?: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* General Observation claims for persisted/searchable clinical resources.
|
|
233
|
+
*
|
|
234
|
+
* This is the widest flat contract currently used by the package. It extends
|
|
235
|
+
* the Vital Signs-visible shape so consumers can reuse one traversal/query
|
|
236
|
+
* model while adding broader Observation fields such as encounter, performer,
|
|
237
|
+
* specimen, focus, and group membership.
|
|
238
|
+
*/
|
|
239
|
+
export interface ClaimsObservationGeneral extends ClaimsObservationVitalSigns {
|
|
240
|
+
/** Upstream order/request reference list. Example: `ServiceRequest/sr-1`. */
|
|
241
|
+
[ObservationClaim.BasedOn]?: string;
|
|
242
|
+
/** Device reference. Example: `Device/dev-1`. */
|
|
243
|
+
[ObservationClaim.Device]?: string;
|
|
244
|
+
/** Encounter reference. Example: `Encounter/enc-1`. */
|
|
245
|
+
[ObservationClaim.Encounter]?: string;
|
|
246
|
+
/** Focus reference list when the observation is about another target. Example: `Condition/cond-1`. */
|
|
247
|
+
[ObservationClaim.Focus]?: string;
|
|
248
|
+
/** Child Observation references for panels/groups. Example: `Observation/hr-1,Observation/temp-1`. */
|
|
249
|
+
[ObservationClaim.HasMember]?: string;
|
|
250
|
+
/** Synthetic tags summarizing component presence on a composite observation. Example: `bp-systolic,bp-diastolic`. */
|
|
251
|
+
[ObservationClaim.ComponentTags]?: string;
|
|
252
|
+
/** Component code values summarized on the parent observation. Example: `8480-6,8462-4`. */
|
|
253
|
+
[ObservationClaim.ComponentCodeValues]?: string;
|
|
254
|
+
/** Human-readable component names summarized on the parent observation. Example: `Systolic blood pressure,Diastolic blood pressure`. */
|
|
255
|
+
[ObservationClaim.ComponentNames]?: string;
|
|
256
|
+
/** Performer reference list. Example: `Practitioner/prac-1`. */
|
|
257
|
+
[ObservationClaim.Performer]?: string;
|
|
258
|
+
/** Specimen reference. Example: `Specimen/spec-1`. */
|
|
259
|
+
[ObservationClaim.Specimen]?: string;
|
|
260
|
+
/** Total assessment score summarized on the parent observation when applicable. Example: `8`. */
|
|
261
|
+
[ObservationClaim.ScoreTotalNumber]?: string | number;
|
|
262
|
+
/** Parent blood pressure panel copy of the systolic numeric value. Example: `120`. */
|
|
263
|
+
[ObservationClaim.BloodPressureSystolicNumber]?: string | number;
|
|
264
|
+
/** Parent blood pressure panel copy of the diastolic numeric value. Example: `78`. */
|
|
265
|
+
[ObservationClaim.BloodPressureDiastolicNumber]?: string | number;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Backwards-compatible alias kept during the current refactor.
|
|
269
|
+
*
|
|
270
|
+
* Prefer `ClaimsObservationVitalSigns` in new code when the row is expected to
|
|
271
|
+
* be one visible/searchable vital-sign Observation.
|
|
272
|
+
*/
|
|
273
|
+
export type ClaimsVitalSign = ClaimsObservationVitalSigns;
|
|
274
|
+
/**
|
|
275
|
+
* Full persisted claim surface for a general Observation row in local storage.
|
|
276
|
+
*
|
|
277
|
+
* This list is intentionally broader than the searchable/indexable subset.
|
|
278
|
+
* Free-text or UI-only fields may exist here even when they must stay out of
|
|
279
|
+
* blind-query/search indexes.
|
|
280
|
+
*/
|
|
281
|
+
export declare const ObservationGeneralClaimsList: readonly ["Observation.based-on", "Observation.category", "Observation.code-system", "Observation.code-value", "Observation.code-text", "Observation.code-display", "Observation.code", "Observation.date", "Observation.device", "Observation.encounter", "Observation.effective-datetime", "Observation.focus", "Observation.has-member", "Observation.component-tags", "Observation.component-code-values", "Observation.component-names", "Observation.identifier", "Observation.language", "Observation.method", "Observation.note", "Observation.patient", "Observation.performer", "Observation.specimen", "Observation.status", "Observation.subject", "Observation.value-concept-system", "Observation.value-concept-value", "Observation.value-concept-text", "Observation.value-concept-display", "Observation.value-concept", "Observation.value-date", "Observation.value-quantity-comparator", "Observation.value-quantity-number", "Observation.value-quantity-unit", "Observation.score-total-number", "Observation.bp-systolic-number", "Observation.bp-diastolic-number", "Observation.value-string"];
|
|
282
|
+
/**
|
|
283
|
+
* Full persisted claim surface for visible/searchable Vital Signs rows.
|
|
284
|
+
*
|
|
285
|
+
* This keeps the claims-first authoring fields but still avoids introducing
|
|
286
|
+
* fields that only belong to broader Observation families.
|
|
287
|
+
*/
|
|
288
|
+
export declare const ObservationVitalSignsClaimsList: readonly ["Observation.category", "Observation.code-system", "Observation.code-value", "Observation.code-text", "Observation.code-display", "Observation.code", "Observation.date", "Observation.effective-datetime", "Observation.has-member", "Observation.component-tags", "Observation.component-code-values", "Observation.component-names", "Observation.identifier", "Observation.language", "Observation.method", "Observation.note", "Observation.patient", "Observation.status", "Observation.subject", "Observation.value-concept-system", "Observation.value-concept-value", "Observation.value-concept-text", "Observation.value-concept-display", "Observation.value-concept", "Observation.value-date", "Observation.value-quantity-comparator", "Observation.value-quantity-number", "Observation.value-quantity-unit", "Observation.score-total-number", "Observation.bp-systolic-number", "Observation.bp-diastolic-number", "Observation.value-string"];
|
|
289
|
+
export declare const ObservationClaimSpecs: ClaimSpec[];
|
|
290
|
+
/**
|
|
291
|
+
* Returns `true` when the flat claims represent one visible/searchable vital
|
|
292
|
+
* sign Observation row.
|
|
293
|
+
*
|
|
294
|
+
* Current rule:
|
|
295
|
+
* - must be categorized as `vital-signs`
|
|
296
|
+
* - must carry `Observation.status`
|
|
297
|
+
*
|
|
298
|
+
* Reduced indexed component rows derived from FHIR `component` intentionally do
|
|
299
|
+
* not carry `Observation.status`, so they are excluded from normal UI list and
|
|
300
|
+
* search results even though they remain persisted for reconstruction/export.
|
|
301
|
+
*/
|
|
302
|
+
export declare function isDisplayableVitalSignObservationClaims(claims: Record<string, unknown> | undefined): boolean;
|