fhir-data-utils-ts 0.3.2 → 0.3.3
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.
|
@@ -19,6 +19,12 @@ redeclare governed claim paths, code systems, UUIDs or example values.
|
|
|
19
19
|
- Each proposal `field` names the coded target claim. Confirmation writes
|
|
20
20
|
`system|code` to that target and the terminology display to `-display`; it
|
|
21
21
|
must preserve the imported `-text` value.
|
|
22
|
+
- Review state comes only from `meta.codingProposals[].status`. An accepted
|
|
23
|
+
professional decision sets that proposal's `userSelected=true`; never use
|
|
24
|
+
`userSelected` as a draft or promotion flag.
|
|
25
|
+
- Group review UI with the package-owned clinical families: allergies and
|
|
26
|
+
intolerances, procedures, diagnostics and immunizations. Do not duplicate
|
|
27
|
+
resource-type lists in Vet, UHC or DataConv consumers.
|
|
22
28
|
- A localized generated label may use a language-qualified `-text_<BCP47>`
|
|
23
29
|
companion. It must not overwrite the imported local text before explicit
|
|
24
30
|
review.
|
|
@@ -28,6 +34,12 @@ redeclare governed claim paths, code systems, UUIDs or example values.
|
|
|
28
34
|
`entry[].data[]`.
|
|
29
35
|
- Multiple imported rows may resolve to one stable UUID ResearchSubject. Keep
|
|
30
36
|
every proposal on the clinical resource generated from its source row.
|
|
37
|
+
- Complete each ResearchSubject independently when all of its own mandatory
|
|
38
|
+
proposals are resolved. Other subjects in the same import thread never block
|
|
39
|
+
it, and review always resumes from persisted resources without re-upload.
|
|
40
|
+
- Text supplied by an individual, a source table or an automated/device flow
|
|
41
|
+
may create proposals, but does not mark an inferred code professionally
|
|
42
|
+
reviewed. Preserve origin/provenance separately from the review decision.
|
|
31
43
|
|
|
32
44
|
## Workflow
|
|
33
45
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3 - 2026-09-23
|
|
4
|
+
|
|
5
|
+
- Define product-neutral coding-review families and pending-proposal helpers.
|
|
6
|
+
- Keep review workflow in `meta.codingProposals[].status`; reserve
|
|
7
|
+
`userSelected=true` for a code explicitly selected by a reviewer.
|
|
8
|
+
|
|
3
9
|
## 0.3.2 - 2026-09-23
|
|
4
10
|
|
|
5
11
|
- Preserve every coding identity from repeatable AllergyIntolerance and
|
package/README.md
CHANGED
|
@@ -117,3 +117,15 @@ claim strings, terminology identifiers, codes or UUIDs.
|
|
|
117
117
|
coverage over converters, builders and core FHIR utilities. The package also
|
|
118
118
|
tests every stable export subpath. Release validation additionally inspects the
|
|
119
119
|
packed artifact and installs it in an isolated consumer before publication.
|
|
120
|
+
# Coding-review workflow
|
|
121
|
+
|
|
122
|
+
Imported wording remains in the resource's canonical `*-text` flat claim. Each
|
|
123
|
+
unconfirmed terminology suggestion lives beside `meta.claims` in the owning
|
|
124
|
+
contained resource's `meta.codingProposals[]`; it is never moved to
|
|
125
|
+
`ResearchSubject.meta`.
|
|
126
|
+
|
|
127
|
+
Review state comes only from `codingProposals[].status`. A Coding
|
|
128
|
+
`userSelected=true` flat claim records that a human selected the accepted code;
|
|
129
|
+
it is not a draft, publication or promotion flag. Consumers can use the shared
|
|
130
|
+
review families `allergies-intolerances`, `procedures`, `diagnostics` and
|
|
131
|
+
`immunizations` without product-specific literals.
|
|
@@ -13,6 +13,7 @@ export type FlatClaimCodingProposal = Readonly<{
|
|
|
13
13
|
language: string;
|
|
14
14
|
candidates: readonly FlatClaimCodingCandidate[];
|
|
15
15
|
selectedCandidateId?: string;
|
|
16
|
+
userSelected?: boolean;
|
|
16
17
|
}>;
|
|
17
18
|
export type FlatClaimCodingReviewResource = Readonly<{
|
|
18
19
|
resourceType: string;
|
|
@@ -43,6 +44,18 @@ export type ContainedCodingReviewItem = Readonly<{
|
|
|
43
44
|
resource: FlatClaimCodingReviewResource;
|
|
44
45
|
proposal: FlatClaimCodingProposal;
|
|
45
46
|
}>;
|
|
47
|
+
export declare const CODING_REVIEW_CATEGORIES: Readonly<{
|
|
48
|
+
readonly AllergiesIntolerances: "allergies-intolerances";
|
|
49
|
+
readonly Procedures: "procedures";
|
|
50
|
+
readonly Diagnostics: "diagnostics";
|
|
51
|
+
readonly Immunizations: "immunizations";
|
|
52
|
+
readonly Other: "other";
|
|
53
|
+
}>;
|
|
54
|
+
export type CodingReviewCategory = typeof CODING_REVIEW_CATEGORIES[keyof typeof CODING_REVIEW_CATEGORIES];
|
|
55
|
+
/** Map a FHIR resource type to its stable, product-neutral coding-review family. */
|
|
56
|
+
export declare function codingReviewCategoryForResourceType(resourceType: string): CodingReviewCategory;
|
|
57
|
+
/** A proposal remains reviewable until a reviewer accepts, rejects or defers it. */
|
|
58
|
+
export declare function isCodingProposalPending(proposal: FlatClaimCodingProposal): boolean;
|
|
46
59
|
/** Return the canonical local-text companion for a code-like flat claim. */
|
|
47
60
|
export declare function deriveCodingLocalTextClaim(targetClaim: string): string;
|
|
48
61
|
/** Return the official-display companion for a code-like flat claim. */
|
|
@@ -66,6 +79,8 @@ export declare function buildFlatClaimCodingReviewResource(input: Readonly<{
|
|
|
66
79
|
}>): FlatClaimCodingReviewResource;
|
|
67
80
|
/** Traverse every ResearchSubject entry and return resource-scoped proposals. */
|
|
68
81
|
export declare function collectBatchCodingReviewItems(batch: FhirLikeCodingReviewBatch): readonly ContainedCodingReviewItem[];
|
|
82
|
+
/** Return only unresolved contained-resource proposals; resource userSelected is not workflow state. */
|
|
83
|
+
export declare function collectPendingBatchCodingReviewItems(batch: FhirLikeCodingReviewBatch): readonly ContainedCodingReviewItem[];
|
|
69
84
|
/**
|
|
70
85
|
* Confirm one terminology candidate on the resource that owns the proposal.
|
|
71
86
|
* The coded claim and official display are added while the imported local
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { buildFlatClaimResourceEntry } from './flat-claim-resource-graph.js';
|
|
2
|
+
export const CODING_REVIEW_CATEGORIES = Object.freeze({
|
|
3
|
+
AllergiesIntolerances: 'allergies-intolerances',
|
|
4
|
+
Procedures: 'procedures',
|
|
5
|
+
Diagnostics: 'diagnostics',
|
|
6
|
+
Immunizations: 'immunizations',
|
|
7
|
+
Other: 'other',
|
|
8
|
+
});
|
|
9
|
+
const CODING_REVIEW_RESOURCE_CATEGORIES = Object.freeze({
|
|
10
|
+
AllergyIntolerance: CODING_REVIEW_CATEGORIES.AllergiesIntolerances,
|
|
11
|
+
Procedure: CODING_REVIEW_CATEGORIES.Procedures,
|
|
12
|
+
Condition: CODING_REVIEW_CATEGORIES.Diagnostics,
|
|
13
|
+
DiagnosticReport: CODING_REVIEW_CATEGORIES.Diagnostics,
|
|
14
|
+
Observation: CODING_REVIEW_CATEGORIES.Diagnostics,
|
|
15
|
+
Immunization: CODING_REVIEW_CATEGORIES.Immunizations,
|
|
16
|
+
});
|
|
17
|
+
/** Map a FHIR resource type to its stable, product-neutral coding-review family. */
|
|
18
|
+
export function codingReviewCategoryForResourceType(resourceType) {
|
|
19
|
+
return CODING_REVIEW_RESOURCE_CATEGORIES[resourceType] ?? CODING_REVIEW_CATEGORIES.Other;
|
|
20
|
+
}
|
|
21
|
+
/** A proposal remains reviewable until a reviewer accepts, rejects or defers it. */
|
|
22
|
+
export function isCodingProposalPending(proposal) {
|
|
23
|
+
return proposal.status === 'proposed';
|
|
24
|
+
}
|
|
2
25
|
/** Return the canonical local-text companion for a code-like flat claim. */
|
|
3
26
|
export function deriveCodingLocalTextClaim(targetClaim) {
|
|
4
27
|
return `${requiredCodingTarget(targetClaim)}-text`;
|
|
@@ -54,6 +77,10 @@ export function collectBatchCodingReviewItems(batch) {
|
|
|
54
77
|
}
|
|
55
78
|
return Object.freeze(items);
|
|
56
79
|
}
|
|
80
|
+
/** Return only unresolved contained-resource proposals; resource userSelected is not workflow state. */
|
|
81
|
+
export function collectPendingBatchCodingReviewItems(batch) {
|
|
82
|
+
return Object.freeze(collectBatchCodingReviewItems(batch).filter(item => isCodingProposalPending(item.proposal)));
|
|
83
|
+
}
|
|
57
84
|
/**
|
|
58
85
|
* Confirm one terminology candidate on the resource that owns the proposal.
|
|
59
86
|
* The coded claim and official display are added while the imported local
|
|
@@ -72,6 +99,7 @@ export function applyFlatClaimCodingSelection(resource, proposalId, candidateId)
|
|
|
72
99
|
...proposal,
|
|
73
100
|
status: 'accepted',
|
|
74
101
|
selectedCandidateId: candidate.id,
|
|
102
|
+
userSelected: true,
|
|
75
103
|
});
|
|
76
104
|
const updatedProposals = proposals.map((item, index) => (index === proposalIndex ? updatedProposal : item));
|
|
77
105
|
return Object.freeze({
|
|
@@ -81,6 +109,7 @@ export function applyFlatClaimCodingSelection(resource, proposalId, candidateId)
|
|
|
81
109
|
...resource.meta.claims,
|
|
82
110
|
[proposal.field]: `${candidate.system}|${candidate.code}`,
|
|
83
111
|
[deriveCodingDisplayClaim(proposal.field)]: candidate.display,
|
|
112
|
+
[`${resource.resourceType}.userSelected`]: 'true',
|
|
84
113
|
}),
|
|
85
114
|
codingProposals: Object.freeze(updatedProposals),
|
|
86
115
|
}),
|
|
@@ -116,6 +145,7 @@ const CONDITION_EXPECTED_ACCEPTED_CLAIMS = Object.freeze({
|
|
|
116
145
|
...CONDITION_EXAMPLE_RESOURCE.meta.claims,
|
|
117
146
|
[CONDITION_EXAMPLE_INPUT.targetClaim]: `${CONDITION_EXAMPLE_CANDIDATE.system}|${CONDITION_EXAMPLE_CANDIDATE.code}`,
|
|
118
147
|
[deriveCodingDisplayClaim(CONDITION_EXAMPLE_INPUT.targetClaim)]: CONDITION_EXAMPLE_CANDIDATE.display,
|
|
148
|
+
[`${CONDITION_EXAMPLE_RESOURCE.resourceType}.userSelected`]: 'true',
|
|
119
149
|
});
|
|
120
150
|
/** Package-owned reusable fixture; tests and consumer examples must import it. */
|
|
121
151
|
export const CODING_REVIEW_EXAMPLES = Object.freeze({
|