fhir-data-utils-ts 0.3.6 → 0.4.0

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.
Files changed (35) hide show
  1. package/.codex/skills/govern-fhir-data-utilities/SKILL.md +12 -0
  2. package/.codex/skills/govern-fhir-observation-components/SKILL.md +11 -0
  3. package/CHANGELOG.md +20 -0
  4. package/README.md +18 -0
  5. package/dist/care-emergency-alert.d.ts +70 -0
  6. package/dist/care-emergency-alert.js +135 -0
  7. package/dist/claims/communication-request-claims.d.ts +21 -0
  8. package/dist/claims/communication-request-claims.js +27 -0
  9. package/dist/claims/composition-claims.d.ts +1 -0
  10. package/dist/claims/composition-claims.js +1 -0
  11. package/dist/claims/encounter-claims.d.ts +1 -0
  12. package/dist/claims/encounter-claims.js +2 -0
  13. package/dist/claims/index.d.ts +2 -0
  14. package/dist/claims/index.js +2 -0
  15. package/dist/claims/service-request-claims.d.ts +24 -0
  16. package/dist/claims/service-request-claims.js +33 -0
  17. package/dist/constants/fhir-resource-types.d.ts +3 -0
  18. package/dist/constants/fhir-resource-types.js +1 -0
  19. package/dist/converters/convert-communication-request.d.ts +5 -0
  20. package/dist/converters/convert-communication-request.js +40 -0
  21. package/dist/converters/convert-composition.js +12 -2
  22. package/dist/converters/convert-encounter.js +2 -0
  23. package/dist/converters/convert-service-request.d.ts +5 -0
  24. package/dist/converters/convert-service-request.js +47 -0
  25. package/dist/converters/index.d.ts +2 -0
  26. package/dist/converters/index.js +2 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +1 -0
  29. package/dist/observation-claims.d.ts +3 -0
  30. package/dist/observation-claims.js +3 -0
  31. package/dist/vital-sign-observations.d.ts +75 -1
  32. package/dist/vital-sign-observations.js +225 -9
  33. package/docs/CARE_EMERGENCY_ALERT_CONTRACTS.md +50 -0
  34. package/docs/VITAL_SIGN_DAILY_DOCUMENT.md +79 -0
  35. package/package.json +5 -1
@@ -0,0 +1,79 @@
1
+ # Daily vital-sign document lifecycle
2
+
3
+ This package owns the product-neutral FHIR data contract used by web portals,
4
+ telephone assistants, chatbots and device importers. It does not decide who
5
+ may attest, write an index, anchor a hash on a ledger or contribute data to a
6
+ research study.
7
+
8
+ ## Repeated readings
9
+
10
+ `buildRepeatedVitalSignAverage(...)` requires exactly three readings separated
11
+ by two minutes. It returns:
12
+
13
+ - three raw `Observation` graphs with `status=registered`;
14
+ - one arithmetic-mean `Observation` with `status=preliminary`;
15
+ - `Observation.date-when=MORN|AFT|EVE|NIGHT` on raw and mean observations;
16
+ - `Observation.derived-from` references from the mean to all raw observations.
17
+
18
+ Blood pressure remains one native Observation with systolic and diastolic
19
+ components. Its flat representation keeps the established primary
20
+ `Observation.has-member` graph. No `bp-*`, `component-*`, containment or split
21
+ coding claims are written.
22
+
23
+ ```ts
24
+ const morningBloodPressure = buildRepeatedVitalSignAverage({
25
+ entryId: averageObservationId,
26
+ subjectReference,
27
+ deviceReference,
28
+ kind: 'blood-pressure',
29
+ eventTiming: 'MORN',
30
+ readings: threeTimestampedReadings,
31
+ })
32
+ ```
33
+
34
+ Temperature accepts governed UCUM Celsius or Fahrenheit units. Body weight
35
+ accepts governed UCUM kilograms or avoirdupois pounds. A UI selects one of the
36
+ exported `VitalSignUnit` constants; it never assembles a UCUM token itself.
37
+
38
+ ## One document per local day
39
+
40
+ `buildVitalSignDailyDocument(...)` validates every Observation against an
41
+ explicit IANA time zone and local calendar date. It returns one preliminary
42
+ `Composition` followed by every Observation graph entry. The Composition
43
+ references only the top-level Observations through `Composition.entry`; reduced
44
+ blood-pressure members remain reachable through `Observation.has-member`.
45
+
46
+ ```ts
47
+ const dailyDraft = buildVitalSignDailyDocument({
48
+ entryId: dailyCompositionId,
49
+ identifier: dailyDocumentIdentifier,
50
+ subjectReference,
51
+ authorReference,
52
+ localDate,
53
+ timeZone,
54
+ observationGraphs: [
55
+ ...morningBloodPressure.sourceGraphs,
56
+ morningBloodPressure.averageGraph,
57
+ ],
58
+ })
59
+ ```
60
+
61
+ The draft is readable as preliminary clinical work. It is not final evidence
62
+ and this package does not make it eligible for an individual index, Digital
63
+ Twin or research projection.
64
+
65
+ `finalizeVitalSignDailyDocument(...)` requires a preliminary document, records
66
+ the professional attester and confirmation time, and returns a new immutable
67
+ graph with the Composition and all top-level Observations set to `final`.
68
+
69
+ ```ts
70
+ const finalDailyDocument = finalizeVitalSignDailyDocument(dailyDraft, {
71
+ attesterReference,
72
+ confirmedAt,
73
+ })
74
+ ```
75
+
76
+ The owning service may now serialize and hash this one daily document graph.
77
+ Index, ledger and research writes remain separate policy-controlled operations;
78
+ failure in one must not silently claim success in another.
79
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-data-utils-ts",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "FHIR-version-neutral flat-claim and SearchParameter data utilities",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -19,6 +19,10 @@
19
19
  "types": "./dist/flat-claim-resource-graph.d.ts",
20
20
  "default": "./dist/flat-claim-resource-graph.js"
21
21
  },
22
+ "./care-emergency-alert": {
23
+ "types": "./dist/care-emergency-alert.d.ts",
24
+ "default": "./dist/care-emergency-alert.js"
25
+ },
22
26
  "./search-parameters": {
23
27
  "types": "./dist/search-parameters.d.ts",
24
28
  "default": "./dist/search-parameters.js"