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
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe FHIR R5 ResearchStudy flat-claim contract.
|
|
3
|
+
*
|
|
4
|
+
* The standard catalogue is copied from the R5 SearchParameter definitions,
|
|
5
|
+
* not inferred from similarly named resource elements. In particular, the
|
|
6
|
+
* `date` SearchParameter targets `ResearchStudy.period`, not the publication
|
|
7
|
+
* date element. Associated-party projections are indexed separately because
|
|
8
|
+
* base R5 defines no ResearchStudy party SearchParameter.
|
|
9
|
+
*
|
|
10
|
+
* @see https://hl7.org/fhir/R5/researchstudy.html
|
|
11
|
+
* @see https://hl7.org/fhir/R5/researchstudy-search.html
|
|
12
|
+
*/
|
|
13
|
+
export const ResearchStudyR5Version = '5.0.0';
|
|
14
|
+
/**
|
|
15
|
+
* Immutable codes defined by the FHIR R5 5.0.0 ResearchStudy party-role code
|
|
16
|
+
* system. The element binding remains extensible; this catalogue is the closed
|
|
17
|
+
* set a portal may offer by default, not a validator for every conformant
|
|
18
|
+
* external Coding.
|
|
19
|
+
*
|
|
20
|
+
* @see https://hl7.org/fhir/R5/codesystem-research-study-party-role.html
|
|
21
|
+
*/
|
|
22
|
+
export const ResearchStudyR5PartyRoleSystem = 'http://hl7.org/fhir/research-study-party-role';
|
|
23
|
+
export const ResearchStudyR5PartyRoleCodes = Object.freeze([
|
|
24
|
+
'sponsor',
|
|
25
|
+
'lead-sponsor',
|
|
26
|
+
'sponsor-investigator',
|
|
27
|
+
'primary-investigator',
|
|
28
|
+
'collaborator',
|
|
29
|
+
'funding-source',
|
|
30
|
+
'general-contact',
|
|
31
|
+
'recruitment-contact',
|
|
32
|
+
'sub-investigator',
|
|
33
|
+
'study-director',
|
|
34
|
+
'study-chair',
|
|
35
|
+
'irb',
|
|
36
|
+
]);
|
|
37
|
+
export const ResearchStudyAssociatedPartyBindings = Object.freeze({
|
|
38
|
+
role: Object.freeze({
|
|
39
|
+
valueSet: 'http://hl7.org/fhir/ValueSet/research-study-party-role',
|
|
40
|
+
strength: 'extensible',
|
|
41
|
+
}),
|
|
42
|
+
classifier: Object.freeze({
|
|
43
|
+
valueSet: 'http://hl7.org/fhir/ValueSet/research-study-party-organization-type',
|
|
44
|
+
strength: 'example',
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const searchParameter = (code, type, expression, components = []) => Object.freeze({
|
|
48
|
+
code,
|
|
49
|
+
type,
|
|
50
|
+
expression,
|
|
51
|
+
components: Object.freeze([...components]),
|
|
52
|
+
});
|
|
53
|
+
/** Exact resource-specific SearchParameters published by FHIR R5 5.0.0. */
|
|
54
|
+
export const ResearchStudyR5SearchParameterCatalog = Object.freeze([
|
|
55
|
+
searchParameter('classifier', 'token', 'ResearchStudy.classifier'),
|
|
56
|
+
searchParameter('condition', 'token', 'ResearchStudy.condition'),
|
|
57
|
+
searchParameter('date', 'date', 'ResearchStudy.period'),
|
|
58
|
+
searchParameter('description', 'string', 'ResearchStudy.description'),
|
|
59
|
+
searchParameter('eligibility', 'reference', 'ResearchStudy.recruitment.eligibility'),
|
|
60
|
+
searchParameter('focus-code', 'token', 'ResearchStudy.focus.concept'),
|
|
61
|
+
searchParameter('focus-reference', 'reference', 'ResearchStudy.focus.reference'),
|
|
62
|
+
searchParameter('identifier', 'token', 'ResearchStudy.identifier'),
|
|
63
|
+
searchParameter('keyword', 'token', 'ResearchStudy.keyword'),
|
|
64
|
+
searchParameter('name', 'string', 'ResearchStudy.name'),
|
|
65
|
+
searchParameter('objective-description', 'string', 'ResearchStudy.objective.description'),
|
|
66
|
+
searchParameter('objective-type', 'token', 'ResearchStudy.objective.type'),
|
|
67
|
+
searchParameter('part-of', 'reference', 'ResearchStudy.partOf'),
|
|
68
|
+
searchParameter('phase', 'token', 'ResearchStudy.phase'),
|
|
69
|
+
searchParameter('progress-status-state-actual', 'composite', 'ResearchStudy.progressStatus', [
|
|
70
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-state',
|
|
71
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-actual',
|
|
72
|
+
]),
|
|
73
|
+
searchParameter('progress-status-state-period', 'composite', 'ResearchStudy.progressStatus', [
|
|
74
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-state',
|
|
75
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-period',
|
|
76
|
+
]),
|
|
77
|
+
searchParameter('progress-status-state-period-actual', 'composite', 'ResearchStudy.progressStatus', [
|
|
78
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-state',
|
|
79
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-period',
|
|
80
|
+
'http://hl7.org/fhir/SearchParameter/ResearchStudy-actual',
|
|
81
|
+
]),
|
|
82
|
+
searchParameter('protocol', 'reference', 'ResearchStudy.protocol'),
|
|
83
|
+
searchParameter('recruitment-actual', 'number', 'ResearchStudy.recruitment.actualNumber'),
|
|
84
|
+
searchParameter('recruitment-target', 'number', 'ResearchStudy.recruitment.targetNumber'),
|
|
85
|
+
searchParameter('region', 'token', 'ResearchStudy.region'),
|
|
86
|
+
searchParameter('site', 'reference', 'ResearchStudy.site'),
|
|
87
|
+
searchParameter('status', 'token', 'ResearchStudy.status'),
|
|
88
|
+
searchParameter('study-design', 'token', 'ResearchStudy.studyDesign'),
|
|
89
|
+
searchParameter('title', 'string', 'ResearchStudy.title'),
|
|
90
|
+
]);
|
|
91
|
+
/** Canonical ResearchStudy flat-claim names. Never repeat these storage keys as literals. */
|
|
92
|
+
export const ResearchStudyClaim = Object.freeze({
|
|
93
|
+
Classifier: 'ResearchStudy.classifier',
|
|
94
|
+
Condition: 'ResearchStudy.condition',
|
|
95
|
+
Date: 'ResearchStudy.date',
|
|
96
|
+
Description: 'ResearchStudy.description',
|
|
97
|
+
Eligibility: 'ResearchStudy.eligibility',
|
|
98
|
+
FocusCode: 'ResearchStudy.focus-code',
|
|
99
|
+
FocusReference: 'ResearchStudy.focus-reference',
|
|
100
|
+
Identifier: 'ResearchStudy.identifier',
|
|
101
|
+
Keyword: 'ResearchStudy.keyword',
|
|
102
|
+
Name: 'ResearchStudy.name',
|
|
103
|
+
ObjectiveDescription: 'ResearchStudy.objective-description',
|
|
104
|
+
ObjectiveType: 'ResearchStudy.objective-type',
|
|
105
|
+
PartOf: 'ResearchStudy.part-of',
|
|
106
|
+
Phase: 'ResearchStudy.phase',
|
|
107
|
+
ProgressStatusStateActual: 'ResearchStudy.progress-status-state-actual',
|
|
108
|
+
ProgressStatusStatePeriod: 'ResearchStudy.progress-status-state-period',
|
|
109
|
+
ProgressStatusStatePeriodActual: 'ResearchStudy.progress-status-state-period-actual',
|
|
110
|
+
Protocol: 'ResearchStudy.protocol',
|
|
111
|
+
RecruitmentActual: 'ResearchStudy.recruitment-actual',
|
|
112
|
+
RecruitmentTarget: 'ResearchStudy.recruitment-target',
|
|
113
|
+
Region: 'ResearchStudy.region',
|
|
114
|
+
Site: 'ResearchStudy.site',
|
|
115
|
+
Status: 'ResearchStudy.status',
|
|
116
|
+
StudyDesign: 'ResearchStudy.study-design',
|
|
117
|
+
Title: 'ResearchStudy.title',
|
|
118
|
+
PartyName: 'ResearchStudy.party-name',
|
|
119
|
+
PartyRole: 'ResearchStudy.party-role',
|
|
120
|
+
PartyPeriodStart: 'ResearchStudy.party-period-start',
|
|
121
|
+
PartyPeriodEnd: 'ResearchStudy.party-period-end',
|
|
122
|
+
PartyClassifier: 'ResearchStudy.party-classifier',
|
|
123
|
+
Party: 'ResearchStudy.party',
|
|
124
|
+
});
|
|
125
|
+
const standardSearchClaims = Object.freeze([
|
|
126
|
+
ResearchStudyClaim.Classifier, ResearchStudyClaim.Condition, ResearchStudyClaim.Date,
|
|
127
|
+
ResearchStudyClaim.Description, ResearchStudyClaim.Eligibility, ResearchStudyClaim.FocusCode,
|
|
128
|
+
ResearchStudyClaim.FocusReference, ResearchStudyClaim.Identifier, ResearchStudyClaim.Keyword,
|
|
129
|
+
ResearchStudyClaim.Name, ResearchStudyClaim.ObjectiveDescription, ResearchStudyClaim.ObjectiveType,
|
|
130
|
+
ResearchStudyClaim.PartOf, ResearchStudyClaim.Phase, ResearchStudyClaim.ProgressStatusStateActual,
|
|
131
|
+
ResearchStudyClaim.ProgressStatusStatePeriod, ResearchStudyClaim.ProgressStatusStatePeriodActual,
|
|
132
|
+
ResearchStudyClaim.Protocol, ResearchStudyClaim.RecruitmentActual, ResearchStudyClaim.RecruitmentTarget,
|
|
133
|
+
ResearchStudyClaim.Region, ResearchStudyClaim.Site, ResearchStudyClaim.Status,
|
|
134
|
+
ResearchStudyClaim.StudyDesign, ResearchStudyClaim.Title,
|
|
135
|
+
]);
|
|
136
|
+
const associatedPartyClaims = Object.freeze([
|
|
137
|
+
ResearchStudyClaim.PartyName, ResearchStudyClaim.PartyRole, ResearchStudyClaim.PartyPeriodStart,
|
|
138
|
+
ResearchStudyClaim.PartyPeriodEnd, ResearchStudyClaim.PartyClassifier, ResearchStudyClaim.Party,
|
|
139
|
+
]);
|
|
140
|
+
/**
|
|
141
|
+
* Governed flat claims for ResearchStudy.
|
|
142
|
+
*
|
|
143
|
+
* `standardSearch` contains only official R5 SearchParameters. The
|
|
144
|
+
* `associatedParty` list is an explicit operational projection of the R5
|
|
145
|
+
* backbone element; none of those names is advertised as a standard search
|
|
146
|
+
* parameter and `classifier` never carries CRUD or authorization policy.
|
|
147
|
+
*/
|
|
148
|
+
export const ResearchStudyFlatClaimCatalog = Object.freeze({
|
|
149
|
+
standardSearch: standardSearchClaims,
|
|
150
|
+
associatedParty: associatedPartyClaims,
|
|
151
|
+
all: Object.freeze([...standardSearchClaims, ...associatedPartyClaims]),
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* Projects the official resource-specific R5 SearchParameters from one native
|
|
155
|
+
* ResearchStudy into flat `resource.meta.claims`. Composite values use FHIR's
|
|
156
|
+
* `$` component separator; associatedParty remains a separate projection and
|
|
157
|
+
* never becomes authorization data.
|
|
158
|
+
*
|
|
159
|
+
* @see https://hl7.org/fhir/R5/researchstudy-search.html
|
|
160
|
+
*/
|
|
161
|
+
export function projectResearchStudyR5SearchClaims(input) {
|
|
162
|
+
if (!isRecord(input) || input.resourceType !== 'ResearchStudy') {
|
|
163
|
+
throw new TypeError('research_study_resource_invalid');
|
|
164
|
+
}
|
|
165
|
+
const claims = {};
|
|
166
|
+
addClaim(claims, ResearchStudyClaim.Classifier, conceptsValue(input.classifier, 'research_study_classifier_invalid'));
|
|
167
|
+
addClaim(claims, ResearchStudyClaim.Condition, conceptsValue(input.condition, 'research_study_condition_invalid'));
|
|
168
|
+
addClaim(claims, ResearchStudyClaim.Date, periodValues(input.period, 'research_study_period_invalid'));
|
|
169
|
+
addClaim(claims, ResearchStudyClaim.Description, strings(input.description));
|
|
170
|
+
addClaim(claims, ResearchStudyClaim.Eligibility, references(input.recruitment, 'eligibility'));
|
|
171
|
+
addClaim(claims, ResearchStudyClaim.FocusCode, codeableReferences(input.focus, 'concept'));
|
|
172
|
+
addClaim(claims, ResearchStudyClaim.FocusReference, codeableReferences(input.focus, 'reference'));
|
|
173
|
+
addClaim(claims, ResearchStudyClaim.Identifier, identifiers(input.identifier));
|
|
174
|
+
addClaim(claims, ResearchStudyClaim.Keyword, conceptsValue(input.keyword, 'research_study_keyword_invalid'));
|
|
175
|
+
addClaim(claims, ResearchStudyClaim.Name, strings(input.name));
|
|
176
|
+
addClaim(claims, ResearchStudyClaim.ObjectiveDescription, backboneStrings(input.objective, 'description'));
|
|
177
|
+
addClaim(claims, ResearchStudyClaim.ObjectiveType, backboneConcepts(input.objective, 'type'));
|
|
178
|
+
addClaim(claims, ResearchStudyClaim.PartOf, references(input.partOf));
|
|
179
|
+
addClaim(claims, ResearchStudyClaim.Phase, conceptsValue(input.phase, 'research_study_phase_invalid'));
|
|
180
|
+
const progress = progressStatusValues(input.progressStatus);
|
|
181
|
+
addClaim(claims, ResearchStudyClaim.ProgressStatusStateActual, progress.stateActual);
|
|
182
|
+
addClaim(claims, ResearchStudyClaim.ProgressStatusStatePeriod, progress.statePeriod);
|
|
183
|
+
addClaim(claims, ResearchStudyClaim.ProgressStatusStatePeriodActual, progress.statePeriodActual);
|
|
184
|
+
addClaim(claims, ResearchStudyClaim.Protocol, references(input.protocol));
|
|
185
|
+
addClaim(claims, ResearchStudyClaim.RecruitmentActual, nestedNumber(input.recruitment, 'actualNumber'));
|
|
186
|
+
addClaim(claims, ResearchStudyClaim.RecruitmentTarget, nestedNumber(input.recruitment, 'targetNumber'));
|
|
187
|
+
addClaim(claims, ResearchStudyClaim.Region, conceptsValue(input.region, 'research_study_region_invalid'));
|
|
188
|
+
addClaim(claims, ResearchStudyClaim.Site, references(input.site));
|
|
189
|
+
addClaim(claims, ResearchStudyClaim.Status, strings(input.status));
|
|
190
|
+
addClaim(claims, ResearchStudyClaim.StudyDesign, conceptsValue(input.studyDesign, 'research_study_design_invalid'));
|
|
191
|
+
addClaim(claims, ResearchStudyClaim.Title, strings(input.title));
|
|
192
|
+
return Object.freeze(claims);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Normalizes the R5 `associatedParty[]` backbone without flattening parties
|
|
196
|
+
* into unrelated parallel arrays. This function validates data shape only; it
|
|
197
|
+
* does not grant study access or interpret classifier values as permissions.
|
|
198
|
+
*/
|
|
199
|
+
export function normalizeResearchStudyAssociatedParties(input) {
|
|
200
|
+
if (!Array.isArray(input))
|
|
201
|
+
throw new TypeError('research_study_associated_parties_invalid');
|
|
202
|
+
return Object.freeze(input.map((value, index) => normalizeAssociatedParty(value, index)));
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Produces one flat-claim map per associated party. Keeping the normalized
|
|
206
|
+
* party beside each map preserves the party/role/period/classifier boundary
|
|
207
|
+
* required when a later Bundle PATCH changes one party.
|
|
208
|
+
*/
|
|
209
|
+
export function projectResearchStudyAssociatedPartyClaims(input) {
|
|
210
|
+
const parties = normalizeResearchStudyAssociatedParties(input);
|
|
211
|
+
return Object.freeze(parties.map(party => Object.freeze({
|
|
212
|
+
associatedParty: party,
|
|
213
|
+
claims: Object.freeze({
|
|
214
|
+
[ResearchStudyClaim.PartyName]: Object.freeze(party.name ? [party.name] : []),
|
|
215
|
+
[ResearchStudyClaim.PartyRole]: Object.freeze(conceptValues([party.role])),
|
|
216
|
+
[ResearchStudyClaim.PartyPeriodStart]: Object.freeze((party.period || []).flatMap(period => period.start ? [period.start] : [])),
|
|
217
|
+
[ResearchStudyClaim.PartyPeriodEnd]: Object.freeze((party.period || []).flatMap(period => period.end ? [period.end] : [])),
|
|
218
|
+
[ResearchStudyClaim.PartyClassifier]: Object.freeze(conceptValues(party.classifier || [])),
|
|
219
|
+
[ResearchStudyClaim.Party]: Object.freeze(party.party ? [party.party.reference] : []),
|
|
220
|
+
}),
|
|
221
|
+
})));
|
|
222
|
+
}
|
|
223
|
+
/** Projects native-shaped study input to the claims-only GW persistence shape. */
|
|
224
|
+
export function projectResearchStudyR5FlatClaimsResource(input) {
|
|
225
|
+
if (!isRecord(input) || input.resourceType !== 'ResearchStudy')
|
|
226
|
+
throw new TypeError('research_study_resource_invalid');
|
|
227
|
+
const id = fhirId(input.id, 'research_study_flat_resource_invalid');
|
|
228
|
+
if (input.associatedParty !== undefined)
|
|
229
|
+
throw new TypeError('research_study_parties_require_separate_resources');
|
|
230
|
+
return normalizeResearchStudyR5FlatClaimsResource({
|
|
231
|
+
resourceType: 'ResearchStudy',
|
|
232
|
+
id,
|
|
233
|
+
meta: { claims: projectResearchStudyR5SearchClaims(input) },
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/** Projects one correlated claims-only GW resource per associated party. */
|
|
237
|
+
export function projectResearchStudyAssociatedPartyFlatClaimResources(input) {
|
|
238
|
+
const id = fhirId(input.researchStudyId, 'research_study_flat_resource_invalid');
|
|
239
|
+
return Object.freeze(projectResearchStudyAssociatedPartyClaims(input.associatedParties).map(projection => {
|
|
240
|
+
const claims = Object.fromEntries(Object.entries(projection.claims).filter(([, values]) => values.length > 0));
|
|
241
|
+
return normalizeResearchStudyR5FlatClaimsResource({ resourceType: 'ResearchStudy', id, meta: { claims } });
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
/** Validates and freezes a claims-only ResearchStudy GW resource. */
|
|
245
|
+
export function normalizeResearchStudyR5FlatClaimsResource(input) {
|
|
246
|
+
if (!isRecord(input)
|
|
247
|
+
|| input.resourceType !== 'ResearchStudy'
|
|
248
|
+
|| Object.keys(input).some(key => !['resourceType', 'id', 'meta'].includes(key))) {
|
|
249
|
+
throw new TypeError('research_study_flat_resource_invalid');
|
|
250
|
+
}
|
|
251
|
+
const id = fhirId(input.id, 'research_study_flat_resource_invalid');
|
|
252
|
+
if (!isRecord(input.meta) || !isRecord(input.meta.claims))
|
|
253
|
+
throw new TypeError('research_study_flat_resource_invalid');
|
|
254
|
+
const claims = {};
|
|
255
|
+
for (const [name, rawValues] of Object.entries(input.meta.claims)) {
|
|
256
|
+
if (!ResearchStudyFlatClaimCatalog.all.includes(name)
|
|
257
|
+
|| !Array.isArray(rawValues)
|
|
258
|
+
|| rawValues.length === 0
|
|
259
|
+
|| rawValues.some(value => typeof value !== 'string' || !value.trim())) {
|
|
260
|
+
throw new TypeError('research_study_flat_claim_invalid');
|
|
261
|
+
}
|
|
262
|
+
claims[name] = Object.freeze(rawValues.map(value => value.trim()));
|
|
263
|
+
}
|
|
264
|
+
return Object.freeze({ resourceType: 'ResearchStudy', id, meta: Object.freeze({ claims: Object.freeze(claims) }) });
|
|
265
|
+
}
|
|
266
|
+
function normalizeAssociatedParty(value, index) {
|
|
267
|
+
if (!isRecord(value))
|
|
268
|
+
throw new TypeError(`research_study_associated_party_${index}_invalid`);
|
|
269
|
+
const role = normalizeConcept(value.role, `research_study_associated_party_${index}_role_required`);
|
|
270
|
+
const name = optionalString(value.name);
|
|
271
|
+
const period = value.period === undefined
|
|
272
|
+
? undefined
|
|
273
|
+
: normalizePeriods(value.period, index);
|
|
274
|
+
const classifier = value.classifier === undefined
|
|
275
|
+
? undefined
|
|
276
|
+
: normalizeConcepts(value.classifier, `research_study_associated_party_${index}_classifier_invalid`);
|
|
277
|
+
const party = value.party === undefined ? undefined : normalizePartyReference(value.party, index);
|
|
278
|
+
return Object.freeze({
|
|
279
|
+
...(name ? { name } : {}),
|
|
280
|
+
role,
|
|
281
|
+
...(period ? { period } : {}),
|
|
282
|
+
...(classifier ? { classifier } : {}),
|
|
283
|
+
...(party ? { party } : {}),
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function normalizeConcepts(value, error) {
|
|
287
|
+
if (!Array.isArray(value))
|
|
288
|
+
throw new TypeError(error);
|
|
289
|
+
return Object.freeze(value.map(item => normalizeConcept(item, error)));
|
|
290
|
+
}
|
|
291
|
+
function normalizeConcept(value, error) {
|
|
292
|
+
if (!isRecord(value))
|
|
293
|
+
throw new TypeError(error);
|
|
294
|
+
const text = optionalString(value.text);
|
|
295
|
+
let coding;
|
|
296
|
+
if (value.coding !== undefined) {
|
|
297
|
+
if (!Array.isArray(value.coding))
|
|
298
|
+
throw new TypeError(error);
|
|
299
|
+
coding = Object.freeze(value.coding.map(item => normalizeCoding(item, error)));
|
|
300
|
+
}
|
|
301
|
+
if (!text && (!coding || coding.length === 0 || !coding.some(item => item.code)))
|
|
302
|
+
throw new TypeError(error);
|
|
303
|
+
return Object.freeze({ ...(coding ? { coding } : {}), ...(text ? { text } : {}) });
|
|
304
|
+
}
|
|
305
|
+
function normalizeCoding(value, error) {
|
|
306
|
+
if (!isRecord(value))
|
|
307
|
+
throw new TypeError(error);
|
|
308
|
+
const system = optionalString(value.system);
|
|
309
|
+
const code = optionalString(value.code);
|
|
310
|
+
const display = optionalString(value.display);
|
|
311
|
+
if (!code && !display)
|
|
312
|
+
throw new TypeError(error);
|
|
313
|
+
return Object.freeze({ ...(system ? { system } : {}), ...(code ? { code } : {}), ...(display ? { display } : {}) });
|
|
314
|
+
}
|
|
315
|
+
function normalizePeriods(value, index) {
|
|
316
|
+
if (!Array.isArray(value))
|
|
317
|
+
throw new TypeError(`research_study_associated_party_${index}_period_invalid`);
|
|
318
|
+
return Object.freeze(value.map(item => {
|
|
319
|
+
if (!isRecord(item))
|
|
320
|
+
throw new TypeError(`research_study_associated_party_${index}_period_invalid`);
|
|
321
|
+
const start = optionalString(item.start);
|
|
322
|
+
const end = optionalString(item.end);
|
|
323
|
+
if (!start && !end)
|
|
324
|
+
throw new TypeError(`research_study_associated_party_${index}_period_invalid`);
|
|
325
|
+
if ((start && !isFhirDateTime(start)) || (end && !isFhirDateTime(end))) {
|
|
326
|
+
throw new TypeError(`research_study_associated_party_${index}_period_invalid`);
|
|
327
|
+
}
|
|
328
|
+
if (start && end && Date.parse(end) < Date.parse(start)) {
|
|
329
|
+
throw new TypeError(`research_study_associated_party_${index}_period_invalid`);
|
|
330
|
+
}
|
|
331
|
+
return Object.freeze({ ...(start ? { start } : {}), ...(end ? { end } : {}) });
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
function normalizePartyReference(value, index) {
|
|
335
|
+
const error = `research_study_associated_party_${index}_party_reference_invalid`;
|
|
336
|
+
if (!isRecord(value))
|
|
337
|
+
throw new TypeError(error);
|
|
338
|
+
const reference = optionalString(value.reference);
|
|
339
|
+
const type = optionalString(value.type);
|
|
340
|
+
const display = optionalString(value.display);
|
|
341
|
+
if (!reference)
|
|
342
|
+
throw new TypeError(error);
|
|
343
|
+
const allowed = ['Organization', 'Practitioner', 'PractitionerRole'];
|
|
344
|
+
if (type && !allowed.includes(type))
|
|
345
|
+
throw new TypeError(error);
|
|
346
|
+
const relativeType = reference.match(/^(Organization|Practitioner|PractitionerRole|[A-Z][A-Za-z]+)\//)?.[1];
|
|
347
|
+
if (relativeType && !allowed.includes(relativeType))
|
|
348
|
+
throw new TypeError(error);
|
|
349
|
+
return Object.freeze({
|
|
350
|
+
reference,
|
|
351
|
+
...(type ? { type: type } : {}),
|
|
352
|
+
...(display ? { display } : {}),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
function conceptValues(concepts) {
|
|
356
|
+
return concepts.flatMap(concept => {
|
|
357
|
+
const coded = (concept.coding || []).flatMap(coding => coding.code
|
|
358
|
+
? [`${coding.system ? `${coding.system}|` : ''}${coding.code}`]
|
|
359
|
+
: []);
|
|
360
|
+
return coded.length > 0 ? coded : concept.text ? [concept.text] : [];
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function addClaim(claims, name, values) {
|
|
364
|
+
if (values.length > 0)
|
|
365
|
+
claims[name] = Object.freeze([...values]);
|
|
366
|
+
}
|
|
367
|
+
function strings(value) {
|
|
368
|
+
const result = optionalString(value);
|
|
369
|
+
return result ? [result] : [];
|
|
370
|
+
}
|
|
371
|
+
function conceptsValue(value, error) {
|
|
372
|
+
if (value === undefined)
|
|
373
|
+
return [];
|
|
374
|
+
const concepts = Array.isArray(value)
|
|
375
|
+
? normalizeConcepts(value, error)
|
|
376
|
+
: Object.freeze([normalizeConcept(value, error)]);
|
|
377
|
+
return conceptValues(concepts);
|
|
378
|
+
}
|
|
379
|
+
function references(value, nestedKey) {
|
|
380
|
+
let candidate = value;
|
|
381
|
+
if (nestedKey) {
|
|
382
|
+
if (!isRecord(value))
|
|
383
|
+
return [];
|
|
384
|
+
candidate = value[nestedKey];
|
|
385
|
+
}
|
|
386
|
+
if (candidate === undefined)
|
|
387
|
+
return [];
|
|
388
|
+
const items = Array.isArray(candidate) ? candidate : [candidate];
|
|
389
|
+
return items.flatMap(item => isRecord(item) && optionalString(item.reference) ? [String(item.reference).trim()] : []);
|
|
390
|
+
}
|
|
391
|
+
function identifiers(value) {
|
|
392
|
+
if (value === undefined)
|
|
393
|
+
return [];
|
|
394
|
+
if (!Array.isArray(value))
|
|
395
|
+
throw new TypeError('research_study_identifier_invalid');
|
|
396
|
+
return value.flatMap(item => {
|
|
397
|
+
if (!isRecord(item))
|
|
398
|
+
throw new TypeError('research_study_identifier_invalid');
|
|
399
|
+
const system = optionalString(item.system);
|
|
400
|
+
const identifier = optionalString(item.value);
|
|
401
|
+
return identifier ? [`${system ? `${system}|` : ''}${identifier}`] : [];
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function periodValues(value, error) {
|
|
405
|
+
if (value === undefined)
|
|
406
|
+
return [];
|
|
407
|
+
if (!isRecord(value))
|
|
408
|
+
throw new TypeError(error);
|
|
409
|
+
const start = optionalString(value.start);
|
|
410
|
+
const end = optionalString(value.end);
|
|
411
|
+
if ((start && !isFhirDateTime(start)) || (end && !isFhirDateTime(end)))
|
|
412
|
+
throw new TypeError(error);
|
|
413
|
+
return [start, end].filter((item) => Boolean(item));
|
|
414
|
+
}
|
|
415
|
+
function codeableReferences(value, key) {
|
|
416
|
+
if (value === undefined)
|
|
417
|
+
return [];
|
|
418
|
+
if (!Array.isArray(value))
|
|
419
|
+
throw new TypeError('research_study_focus_invalid');
|
|
420
|
+
return value.flatMap(item => {
|
|
421
|
+
if (!isRecord(item))
|
|
422
|
+
throw new TypeError('research_study_focus_invalid');
|
|
423
|
+
return key === 'concept'
|
|
424
|
+
? conceptsValue(item.concept, 'research_study_focus_invalid')
|
|
425
|
+
: references(item.reference);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function backboneStrings(value, key) {
|
|
429
|
+
if (value === undefined)
|
|
430
|
+
return [];
|
|
431
|
+
if (!Array.isArray(value))
|
|
432
|
+
throw new TypeError('research_study_backbone_invalid');
|
|
433
|
+
return value.flatMap(item => isRecord(item) ? strings(item[key]) : []);
|
|
434
|
+
}
|
|
435
|
+
function backboneConcepts(value, key) {
|
|
436
|
+
if (value === undefined)
|
|
437
|
+
return [];
|
|
438
|
+
if (!Array.isArray(value))
|
|
439
|
+
throw new TypeError('research_study_backbone_invalid');
|
|
440
|
+
return value.flatMap(item => isRecord(item) ? conceptsValue(item[key], 'research_study_backbone_invalid') : []);
|
|
441
|
+
}
|
|
442
|
+
function nestedNumber(value, key) {
|
|
443
|
+
if (!isRecord(value) || value[key] === undefined)
|
|
444
|
+
return [];
|
|
445
|
+
const number = Number(value[key]);
|
|
446
|
+
if (!Number.isInteger(number) || number < 0)
|
|
447
|
+
throw new TypeError('research_study_recruitment_invalid');
|
|
448
|
+
return [String(number)];
|
|
449
|
+
}
|
|
450
|
+
function progressStatusValues(value) {
|
|
451
|
+
const result = { stateActual: [], statePeriod: [], statePeriodActual: [] };
|
|
452
|
+
if (value === undefined)
|
|
453
|
+
return result;
|
|
454
|
+
if (!Array.isArray(value))
|
|
455
|
+
throw new TypeError('research_study_progress_status_invalid');
|
|
456
|
+
for (const item of value) {
|
|
457
|
+
if (!isRecord(item))
|
|
458
|
+
throw new TypeError('research_study_progress_status_invalid');
|
|
459
|
+
const states = conceptsValue(item.state, 'research_study_progress_status_invalid');
|
|
460
|
+
const dates = periodValues(item.period, 'research_study_progress_status_invalid');
|
|
461
|
+
const actual = typeof item.actual === 'boolean' ? String(item.actual) : undefined;
|
|
462
|
+
for (const state of states) {
|
|
463
|
+
if (actual)
|
|
464
|
+
result.stateActual.push(`${state}$${actual}`);
|
|
465
|
+
for (const date of dates) {
|
|
466
|
+
result.statePeriod.push(`${state}$${date}`);
|
|
467
|
+
if (actual)
|
|
468
|
+
result.statePeriodActual.push(`${state}$${date}$${actual}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return result;
|
|
473
|
+
}
|
|
474
|
+
function optionalString(value) {
|
|
475
|
+
const normalized = typeof value === 'string' ? value.trim() : '';
|
|
476
|
+
return normalized || undefined;
|
|
477
|
+
}
|
|
478
|
+
function isFhirDateTime(value) {
|
|
479
|
+
return /^\d{4}(?:-\d{2}(?:-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2}))?)?)?$/.test(value)
|
|
480
|
+
&& !Number.isNaN(Date.parse(value));
|
|
481
|
+
}
|
|
482
|
+
function isRecord(value) {
|
|
483
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
484
|
+
}
|
|
485
|
+
function fhirId(value, error) {
|
|
486
|
+
const id = optionalString(value);
|
|
487
|
+
if (!id || !/^[A-Za-z0-9.-]{1,64}$/.test(id))
|
|
488
|
+
throw new TypeError(error);
|
|
489
|
+
return id;
|
|
490
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource-specific search models recovered from the original UHC package.
|
|
3
|
+
* Runtime parsing and serialization use `fhir-search-parameters`; these are
|
|
4
|
+
* compile-time compatibility surfaces, not a second query implementation.
|
|
5
|
+
*/
|
|
6
|
+
export * from './params/index.js';
|
|
7
|
+
export * from './templates/index.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource-specific search models recovered from the original UHC package.
|
|
3
|
+
* Runtime parsing and serialization use `fhir-search-parameters`; these are
|
|
4
|
+
* compile-time compatibility surfaces, not a second query implementation.
|
|
5
|
+
*/
|
|
6
|
+
export * from './params/index.js';
|
|
7
|
+
export * from './templates/index.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum AdverseEventParameters {
|
|
2
|
+
Category = "org.hl7.fhir.api.AdverseEvent.category",
|
|
3
|
+
Date = "org.hl7.fhir.api.AdverseEvent.date",
|
|
4
|
+
Identifier = "org.hl7.fhir.api.AdverseEvent.identifier",
|
|
5
|
+
Location = "org.hl7.fhir.api.AdverseEvent.location",
|
|
6
|
+
Reaction = "org.hl7.fhir.api.AdverseEvent.reaction",
|
|
7
|
+
Recorder = "org.hl7.fhir.api.AdverseEvent.recorder",
|
|
8
|
+
Seriousness = "org.hl7.fhir.api.AdverseEvent.seriousness",
|
|
9
|
+
Study = "org.hl7.fhir.api.AdverseEvent.study",
|
|
10
|
+
Subject = "org.hl7.fhir.api.AdverseEvent.subject",
|
|
11
|
+
Substance = "org.hl7.fhir.api.AdverseEvent.substance",
|
|
12
|
+
RecordedDate = "org.hl7.fhir.api.AdverseEvent.recorder-date",
|
|
13
|
+
ReferenceDocument = "org.hl7.fhir.api.AdverseEvent.reference-document"
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Create the TypeScript enumerator for the HTTP parameters of the AdverseEvent resource
|
|
2
|
+
export var AdverseEventParameters;
|
|
3
|
+
(function (AdverseEventParameters) {
|
|
4
|
+
AdverseEventParameters["Category"] = "org.hl7.fhir.api.AdverseEvent.category";
|
|
5
|
+
AdverseEventParameters["Date"] = "org.hl7.fhir.api.AdverseEvent.date";
|
|
6
|
+
AdverseEventParameters["Identifier"] = "org.hl7.fhir.api.AdverseEvent.identifier";
|
|
7
|
+
AdverseEventParameters["Location"] = "org.hl7.fhir.api.AdverseEvent.location";
|
|
8
|
+
AdverseEventParameters["Reaction"] = "org.hl7.fhir.api.AdverseEvent.reaction";
|
|
9
|
+
AdverseEventParameters["Recorder"] = "org.hl7.fhir.api.AdverseEvent.recorder";
|
|
10
|
+
AdverseEventParameters["Seriousness"] = "org.hl7.fhir.api.AdverseEvent.seriousness";
|
|
11
|
+
AdverseEventParameters["Study"] = "org.hl7.fhir.api.AdverseEvent.study";
|
|
12
|
+
AdverseEventParameters["Subject"] = "org.hl7.fhir.api.AdverseEvent.subject";
|
|
13
|
+
AdverseEventParameters["Substance"] = "org.hl7.fhir.api.AdverseEvent.substance";
|
|
14
|
+
AdverseEventParameters["RecordedDate"] = "org.hl7.fhir.api.AdverseEvent.recorder-date";
|
|
15
|
+
AdverseEventParameters["ReferenceDocument"] = "org.hl7.fhir.api.AdverseEvent.reference-document";
|
|
16
|
+
})(AdverseEventParameters || (AdverseEventParameters = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum AllergyIntoleranceParameters {
|
|
2
|
+
Category = "org.hl7.fhir.api.AllergyIntolerance.category",
|
|
3
|
+
ClinicalStatus = "org.hl7.fhir.api.AllergyIntolerance.clinical-status",
|
|
4
|
+
Code = "org.hl7.fhir.api.AllergyIntolerance.code",
|
|
5
|
+
Criticality = "org.hl7.fhir.api.AllergyIntolerance.criticality",
|
|
6
|
+
Date = "org.hl7.fhir.api.AllergyIntolerance.date",
|
|
7
|
+
Identifier = "org.hl7.fhir.api.AllergyIntolerance.identifier",
|
|
8
|
+
LastDate = "org.hl7.fhir.api.AllergyIntolerance.last-date",
|
|
9
|
+
Patient = "org.hl7.fhir.api.AllergyIntolerance.patient",
|
|
10
|
+
Recorder = "org.hl7.fhir.api.AllergyIntolerance.recorder",
|
|
11
|
+
Reporter = "org.hl7.fhir.api.AllergyIntolerance.reporter",
|
|
12
|
+
Type = "org.hl7.fhir.api.AllergyIntolerance.type",
|
|
13
|
+
VerificationStatus = "org.hl7.fhir.api.AllergyIntolerance.verification-status",
|
|
14
|
+
Asserter = "org.hl7.fhir.api.AllergyIntolerance.Asserter",
|
|
15
|
+
Id = "org.hl7.fhir.api.AllergyIntolerance.Id",
|
|
16
|
+
Note = "org.hl7.fhir.api.AllergyIntolerance.note",
|
|
17
|
+
Severity = "org.hl7.fhir.api.AllergyIntolerance.severity",
|
|
18
|
+
Onset = "org.hl7.fhir.api.AllergyIntolerance.onset",
|
|
19
|
+
Manifestation = "org.hl7.fhir.api.AllergyIntolerance.manifestation",
|
|
20
|
+
ExposureRoute = "org.hl7.fhir.api.AllergyIntolerance.exposure-route",
|
|
21
|
+
Substance = "org.hl7.fhir.api.AllergyIntolerance.substance",
|
|
22
|
+
ReactionNote = "org.hl7.fhir.api.AllergyIntolerance.reaction-note",
|
|
23
|
+
ReactionDescription = "org.hl7.fhir.api.AllergyIntolerance.reaction-description"
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Added extra parameter "note"
|
|
2
|
+
// Create the TypeScript enumerator for the HTTP parameters of the AllergyIntolerance resource
|
|
3
|
+
export var AllergyIntoleranceParameters;
|
|
4
|
+
(function (AllergyIntoleranceParameters) {
|
|
5
|
+
AllergyIntoleranceParameters["Category"] = "org.hl7.fhir.api.AllergyIntolerance.category";
|
|
6
|
+
AllergyIntoleranceParameters["ClinicalStatus"] = "org.hl7.fhir.api.AllergyIntolerance.clinical-status";
|
|
7
|
+
AllergyIntoleranceParameters["Code"] = "org.hl7.fhir.api.AllergyIntolerance.code";
|
|
8
|
+
AllergyIntoleranceParameters["Criticality"] = "org.hl7.fhir.api.AllergyIntolerance.criticality";
|
|
9
|
+
AllergyIntoleranceParameters["Date"] = "org.hl7.fhir.api.AllergyIntolerance.date";
|
|
10
|
+
AllergyIntoleranceParameters["Identifier"] = "org.hl7.fhir.api.AllergyIntolerance.identifier";
|
|
11
|
+
AllergyIntoleranceParameters["LastDate"] = "org.hl7.fhir.api.AllergyIntolerance.last-date";
|
|
12
|
+
AllergyIntoleranceParameters["Patient"] = "org.hl7.fhir.api.AllergyIntolerance.patient";
|
|
13
|
+
AllergyIntoleranceParameters["Recorder"] = "org.hl7.fhir.api.AllergyIntolerance.recorder";
|
|
14
|
+
AllergyIntoleranceParameters["Reporter"] = "org.hl7.fhir.api.AllergyIntolerance.reporter";
|
|
15
|
+
AllergyIntoleranceParameters["Type"] = "org.hl7.fhir.api.AllergyIntolerance.type";
|
|
16
|
+
AllergyIntoleranceParameters["VerificationStatus"] = "org.hl7.fhir.api.AllergyIntolerance.verification-status";
|
|
17
|
+
AllergyIntoleranceParameters["Asserter"] = "org.hl7.fhir.api.AllergyIntolerance.Asserter";
|
|
18
|
+
AllergyIntoleranceParameters["Id"] = "org.hl7.fhir.api.AllergyIntolerance.Id";
|
|
19
|
+
AllergyIntoleranceParameters["Note"] = "org.hl7.fhir.api.AllergyIntolerance.note";
|
|
20
|
+
AllergyIntoleranceParameters["Severity"] = "org.hl7.fhir.api.AllergyIntolerance.severity";
|
|
21
|
+
AllergyIntoleranceParameters["Onset"] = "org.hl7.fhir.api.AllergyIntolerance.onset";
|
|
22
|
+
AllergyIntoleranceParameters["Manifestation"] = "org.hl7.fhir.api.AllergyIntolerance.manifestation";
|
|
23
|
+
AllergyIntoleranceParameters["ExposureRoute"] = "org.hl7.fhir.api.AllergyIntolerance.exposure-route";
|
|
24
|
+
AllergyIntoleranceParameters["Substance"] = "org.hl7.fhir.api.AllergyIntolerance.substance";
|
|
25
|
+
AllergyIntoleranceParameters["ReactionNote"] = "org.hl7.fhir.api.AllergyIntolerance.reaction-note";
|
|
26
|
+
AllergyIntoleranceParameters["ReactionDescription"] = "org.hl7.fhir.api.AllergyIntolerance.reaction-description";
|
|
27
|
+
})(AllergyIntoleranceParameters || (AllergyIntoleranceParameters = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum AppointmentParameters {
|
|
2
|
+
Actor = "org.hl7.fhir.api.Appointment.actor",
|
|
3
|
+
Date = "org.hl7.fhir.api.Appointment.date",
|
|
4
|
+
Identifier = "org.hl7.fhir.api.Appointment.identifier",
|
|
5
|
+
Location = "org.hl7.fhir.api.Appointment.location",
|
|
6
|
+
PartStatus = "org.hl7.fhir.api.Appointment.part-status",
|
|
7
|
+
Patient = "org.hl7.fhir.api.Appointment.patient",
|
|
8
|
+
Practitioner = "org.hl7.fhir.api.Appointment.practitioner",
|
|
9
|
+
ServiceType = "org.hl7.fhir.api.Appointment.service-type",
|
|
10
|
+
Status = "org.hl7.fhir.api.Appointment.status",
|
|
11
|
+
Specialty = "org.hl7.fhir.api.Appointment.specialty"
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Create the TypeScript enumerator for the HTTP parameters of the Appointment resource
|
|
2
|
+
export var AppointmentParameters;
|
|
3
|
+
(function (AppointmentParameters) {
|
|
4
|
+
AppointmentParameters["Actor"] = "org.hl7.fhir.api.Appointment.actor";
|
|
5
|
+
AppointmentParameters["Date"] = "org.hl7.fhir.api.Appointment.date";
|
|
6
|
+
AppointmentParameters["Identifier"] = "org.hl7.fhir.api.Appointment.identifier";
|
|
7
|
+
AppointmentParameters["Location"] = "org.hl7.fhir.api.Appointment.location";
|
|
8
|
+
AppointmentParameters["PartStatus"] = "org.hl7.fhir.api.Appointment.part-status";
|
|
9
|
+
AppointmentParameters["Patient"] = "org.hl7.fhir.api.Appointment.patient";
|
|
10
|
+
AppointmentParameters["Practitioner"] = "org.hl7.fhir.api.Appointment.practitioner";
|
|
11
|
+
AppointmentParameters["ServiceType"] = "org.hl7.fhir.api.Appointment.service-type";
|
|
12
|
+
AppointmentParameters["Status"] = "org.hl7.fhir.api.Appointment.status";
|
|
13
|
+
AppointmentParameters["Specialty"] = "org.hl7.fhir.api.Appointment.specialty";
|
|
14
|
+
})(AppointmentParameters || (AppointmentParameters = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum ClinicalImpressionParameters {
|
|
2
|
+
Assessor = "org.hl7.fhir.api.ClinicalImpression.assessor",
|
|
3
|
+
Date = "org.hl7.fhir.api.ClinicalImpression.date",
|
|
4
|
+
FindingCode = "org.hl7.fhir.api.ClinicalImpression.finding-code",
|
|
5
|
+
FindingRef = "org.hl7.fhir.api.ClinicalImpression.finding-ref",
|
|
6
|
+
Identifier = "org.hl7.fhir.api.ClinicalImpression.identifier",
|
|
7
|
+
Investigation = "org.hl7.fhir.api.ClinicalImpression.investigation",
|
|
8
|
+
Patient = "org.hl7.fhir.api.ClinicalImpression.patient",
|
|
9
|
+
Previous = "org.hl7.fhir.api.ClinicalImpression.previous",
|
|
10
|
+
Problem = "org.hl7.fhir.api.ClinicalImpression.problem",
|
|
11
|
+
Status = "org.hl7.fhir.api.ClinicalImpression.status",
|
|
12
|
+
Support = "org.hl7.fhir.api.ClinicalImpression.support",
|
|
13
|
+
Subject = "org.hl7.fhir.api.ClinicalImpression.subject"
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var ClinicalImpressionParameters;
|
|
2
|
+
(function (ClinicalImpressionParameters) {
|
|
3
|
+
ClinicalImpressionParameters["Assessor"] = "org.hl7.fhir.api.ClinicalImpression.assessor";
|
|
4
|
+
ClinicalImpressionParameters["Date"] = "org.hl7.fhir.api.ClinicalImpression.date";
|
|
5
|
+
ClinicalImpressionParameters["FindingCode"] = "org.hl7.fhir.api.ClinicalImpression.finding-code";
|
|
6
|
+
ClinicalImpressionParameters["FindingRef"] = "org.hl7.fhir.api.ClinicalImpression.finding-ref";
|
|
7
|
+
ClinicalImpressionParameters["Identifier"] = "org.hl7.fhir.api.ClinicalImpression.identifier";
|
|
8
|
+
ClinicalImpressionParameters["Investigation"] = "org.hl7.fhir.api.ClinicalImpression.investigation";
|
|
9
|
+
ClinicalImpressionParameters["Patient"] = "org.hl7.fhir.api.ClinicalImpression.patient";
|
|
10
|
+
ClinicalImpressionParameters["Previous"] = "org.hl7.fhir.api.ClinicalImpression.previous";
|
|
11
|
+
ClinicalImpressionParameters["Problem"] = "org.hl7.fhir.api.ClinicalImpression.problem";
|
|
12
|
+
ClinicalImpressionParameters["Status"] = "org.hl7.fhir.api.ClinicalImpression.status";
|
|
13
|
+
ClinicalImpressionParameters["Support"] = "org.hl7.fhir.api.ClinicalImpression.support";
|
|
14
|
+
ClinicalImpressionParameters["Subject"] = "org.hl7.fhir.api.ClinicalImpression.subject";
|
|
15
|
+
})(ClinicalImpressionParameters || (ClinicalImpressionParameters = {}));
|