gdc-common-utils-ts 2.9.14 → 2.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +6 -0
  2. package/dist/constants/hl7-roles.d.ts +12 -1
  3. package/dist/constants/hl7-roles.js +12 -1
  4. package/dist/convert/convert-shared.js +1 -1
  5. package/dist/examples/shared.d.ts +2 -0
  6. package/dist/examples/shared.js +3 -1
  7. package/dist/models/animal-onboarding.d.ts +5 -2
  8. package/dist/models/animal-onboarding.js +7 -3
  9. package/dist/utils/allergy-intolerance-entry-editor.d.ts +7 -2
  10. package/dist/utils/allergy-intolerance-entry-editor.js +7 -4
  11. package/dist/utils/bundle-entry-editor.d.ts +12 -0
  12. package/dist/utils/bundle-entry-editor.js +57 -0
  13. package/dist/utils/care-plan-entry-editor.d.ts +21 -0
  14. package/dist/utils/care-plan-entry-editor.js +20 -3
  15. package/dist/utils/clinical-impression-entry-editor.d.ts +7 -0
  16. package/dist/utils/clinical-impression-entry-editor.js +6 -0
  17. package/dist/utils/condition-entry-editor.d.ts +17 -0
  18. package/dist/utils/condition-entry-editor.js +24 -6
  19. package/dist/utils/coverage-entry-editor.d.ts +12 -0
  20. package/dist/utils/coverage-entry-editor.js +14 -6
  21. package/dist/utils/device-entry-editor.d.ts +6 -0
  22. package/dist/utils/device-entry-editor.js +7 -3
  23. package/dist/utils/device-use-statement-entry-editor.d.ts +5 -0
  24. package/dist/utils/device-use-statement-entry-editor.js +6 -3
  25. package/dist/utils/diagnostic-report-entry-editor.d.ts +11 -0
  26. package/dist/utils/diagnostic-report-entry-editor.js +15 -8
  27. package/dist/utils/document-reference-entry-editor.d.ts +12 -0
  28. package/dist/utils/document-reference-entry-editor.js +14 -6
  29. package/dist/utils/encounter-entry-editor.d.ts +17 -0
  30. package/dist/utils/encounter-entry-editor.js +20 -9
  31. package/dist/utils/family-organization-summary.d.ts +1 -1
  32. package/dist/utils/family-organization-summary.js +15 -3
  33. package/dist/utils/flag-entry-editor.d.ts +13 -2
  34. package/dist/utils/flag-entry-editor.js +14 -7
  35. package/dist/utils/immunization-entry-editor.d.ts +44 -2
  36. package/dist/utils/immunization-entry-editor.js +57 -17
  37. package/dist/utils/medication-statement-entry-editor.d.ts +29 -6
  38. package/dist/utils/medication-statement-entry-editor.js +28 -12
  39. package/dist/utils/observation-component-entry-editor.d.ts +17 -0
  40. package/dist/utils/observation-component-entry-editor.js +42 -15
  41. package/dist/utils/observation-entry-editor.d.ts +8 -0
  42. package/dist/utils/observation-entry-editor.js +7 -0
  43. package/dist/utils/procedure-entry-editor.d.ts +22 -4
  44. package/dist/utils/procedure-entry-editor.js +21 -8
  45. package/dist/utils/related-person-entry-editor.d.ts +6 -0
  46. package/dist/utils/related-person-entry-editor.js +7 -2
  47. package/dist/utils/vital-sign-entry-editor.d.ts +6 -0
  48. package/dist/utils/vital-sign-entry-editor.js +10 -5
  49. package/package.json +1 -1
@@ -8,32 +8,46 @@ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor.js
8
8
  * resource at a time without exposing bundle-internal plumbing.
9
9
  */
10
10
  export class ObservationComponentEntryEditor extends ClinicalResourceEntryEditor {
11
- setCode(code) {
12
- const token = typeof code === 'string' ? code.trim() : code.claim;
13
- this.setClaim(ObservationClaim.Code, token);
14
- if (typeof code !== 'string') {
15
- this.setClaim(ObservationClaim.CodeSystem, code.system);
16
- this.setClaim(ObservationClaim.CodeValue, code.code);
17
- if (code.display) {
18
- this.setClaim(ObservationClaim.CodeDisplay, code.display);
19
- }
11
+ setCode(codeOrSystem, codeValue) {
12
+ if (typeof codeOrSystem !== 'string') {
13
+ this.setCodingTokenSystemAndCode(ObservationClaim.Code, codeOrSystem.system, codeOrSystem.code);
14
+ this.setClaim(ObservationClaim.CodeSystem, codeOrSystem.system);
15
+ this.setClaim(ObservationClaim.CodeValue, codeOrSystem.code);
16
+ if (codeOrSystem.display)
17
+ this.setClaim(ObservationClaim.CodeDisplay, codeOrSystem.display);
18
+ return this;
20
19
  }
20
+ this.setCodingTokenCode(ObservationClaim.Code, codeOrSystem, codeValue);
21
+ this.setClaim(ObservationClaim.CodeSystem, this.getCodingTokenSystem(ObservationClaim.Code) || '');
22
+ this.setClaim(ObservationClaim.CodeValue, this.getCodingTokenCode(ObservationClaim.Code) || '');
21
23
  return this;
22
24
  }
23
25
  getCode() {
24
- return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Code));
26
+ return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeValue))
27
+ || this.getCodingTokenCode(ObservationClaim.Code);
25
28
  }
26
29
  setCodeSystem(system) {
30
+ this.setCodingTokenSystem(ObservationClaim.Code, system);
27
31
  return this.setClaim(ObservationClaim.CodeSystem, String(system).trim());
28
32
  }
29
33
  getCodeSystem() {
30
34
  return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeSystem));
31
35
  }
32
36
  setCodeValue(value) {
37
+ this.setCodingTokenCode(ObservationClaim.Code, value);
33
38
  return this.setClaim(ObservationClaim.CodeValue, String(value).trim());
34
39
  }
35
40
  getCodeValue() {
36
- return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeValue));
41
+ return this.getCode();
42
+ }
43
+ setSystemAndCode(system, code) {
44
+ this.setCodingTokenSystemAndCode(ObservationClaim.Code, system, code);
45
+ this.setClaim(ObservationClaim.CodeSystem, String(system || '').trim());
46
+ this.setClaim(ObservationClaim.CodeValue, String(code || '').trim());
47
+ return this;
48
+ }
49
+ getSystemAndCode() {
50
+ return this.getCodingTokenSystemAndCode(ObservationClaim.Code);
37
51
  }
38
52
  setCodeDisplay(display) {
39
53
  return this.setClaim(ObservationClaim.CodeDisplay, String(display).trim());
@@ -59,6 +73,13 @@ export class ObservationComponentEntryEditor extends ClinicalResourceEntryEditor
59
73
  getCodeTextLocal() {
60
74
  return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.CodeText));
61
75
  }
76
+ setValueConcept(valueOrSystem, codeValue) { return this.setCodingTokenCode(ObservationClaim.ValueConcept, valueOrSystem, codeValue); }
77
+ getValueConcept() { return this.getCodingTokenSystemAndCode(ObservationClaim.ValueConcept); }
78
+ getValueConceptCode() { return this.getCodingTokenCode(ObservationClaim.ValueConcept); }
79
+ setValueConceptCodeSystem(system) { return this.setCodingTokenSystem(ObservationClaim.ValueConcept, system); }
80
+ getValueConceptCodeSystem() { return this.getCodingTokenSystem(ObservationClaim.ValueConcept); }
81
+ setValueConceptSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ObservationClaim.ValueConcept, system, code); }
82
+ getValueConceptSystemAndCode() { return this.getCodingTokenSystemAndCode(ObservationClaim.ValueConcept); }
62
83
  /** Compatibility alias for older examples/tests. Prefer `setCodeTextLocal(...)`. */
63
84
  setLocalText(text) {
64
85
  return this.setCodeTextLocal(text);
@@ -77,13 +98,19 @@ export class ObservationComponentEntryEditor extends ClinicalResourceEntryEditor
77
98
  const numeric = Number(raw);
78
99
  return Number.isFinite(numeric) ? numeric : undefined;
79
100
  }
80
- setValueQuantityUnit(unit) {
81
- const normalized = typeof unit === 'string' ? unit.trim() : unit.claim;
82
- return this.setClaim(ObservationClaim.ValueQuantityUnit, normalized);
101
+ setValueQuantityUnit(unitOrSystem, codeValue) {
102
+ return typeof unitOrSystem === 'string'
103
+ ? this.setCodingTokenCode(ObservationClaim.ValueQuantityUnit, unitOrSystem, codeValue)
104
+ : this.setCodingTokenSystemAndCode(ObservationClaim.ValueQuantityUnit, unitOrSystem.system, unitOrSystem.code);
83
105
  }
84
106
  getValueQuantityUnit() {
85
- return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.ValueQuantityUnit));
107
+ return this.getCodingTokenSystemAndCode(ObservationClaim.ValueQuantityUnit);
86
108
  }
109
+ getValueQuantityUnitCode() { return this.getCodingTokenCode(ObservationClaim.ValueQuantityUnit); }
110
+ setValueQuantityUnitCodeSystem(system) { return this.setCodingTokenSystem(ObservationClaim.ValueQuantityUnit, system); }
111
+ getValueQuantityUnitCodeSystem() { return this.getCodingTokenSystem(ObservationClaim.ValueQuantityUnit); }
112
+ setValueQuantityUnitSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ObservationClaim.ValueQuantityUnit, system, code); }
113
+ getValueQuantityUnitSystemAndCode() { return this.getCodingTokenSystemAndCode(ObservationClaim.ValueQuantityUnit); }
87
114
  setValueString(value) {
88
115
  return this.setClaim(ObservationClaim.ValueString, String(value).trim());
89
116
  }
@@ -6,6 +6,14 @@ import { VitalSignEntryEditor } from './vital-sign-entry-editor.js';
6
6
  * accessors in a bundle authoring flow.
7
7
  */
8
8
  export declare class ObservationEntryEditor extends VitalSignEntryEditor {
9
+ setMethod(value?: string | null): this;
10
+ setMethod(codeSystem: string, codeValue: string): this;
11
+ getMethod(): string | undefined;
12
+ getMethodCode(): string | undefined;
13
+ setMethodCodeSystem(system?: string | null): this;
14
+ getMethodCodeSystem(): string | undefined;
15
+ setMethodSystemAndCode(system?: string | null, code?: string | null): this;
16
+ getMethodSystemAndCode(): string | undefined;
9
17
  /** Writes the based-on reference. */
10
18
  setBasedOn(reference: string): this;
11
19
  /** Reads the based-on reference. */
@@ -18,6 +18,13 @@ import { registerBundleEntryEditor } from './bundle-editor-registry.js';
18
18
  * accessors in a bundle authoring flow.
19
19
  */
20
20
  export class ObservationEntryEditor extends VitalSignEntryEditor {
21
+ setMethod(valueOrSystem, codeValue) { return this.setCodingTokenCode(ObservationClaim.Method, valueOrSystem, codeValue); }
22
+ getMethod() { return this.getCodingTokenSystemAndCode(ObservationClaim.Method); }
23
+ getMethodCode() { return this.getCodingTokenCode(ObservationClaim.Method); }
24
+ setMethodCodeSystem(system) { return this.setCodingTokenSystem(ObservationClaim.Method, system); }
25
+ getMethodCodeSystem() { return this.getCodingTokenSystem(ObservationClaim.Method); }
26
+ setMethodSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ObservationClaim.Method, system, code); }
27
+ getMethodSystemAndCode() { return this.getCodingTokenSystemAndCode(ObservationClaim.Method); }
21
28
  /** Writes the based-on reference. */
22
29
  setBasedOn(reference) {
23
30
  return this.setClaim(ObservationClaim.BasedOn, String(reference).trim());
@@ -24,10 +24,15 @@ export declare class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
24
24
  setDate(date?: string | null): this;
25
25
  /** Reads the procedure date. */
26
26
  getDate(): string | undefined;
27
- /** Writes the procedure code. */
27
+ /** Writes the procedure code from `code`, `system|code`, or separate `system, code` arguments. */
28
28
  setCode(code?: string | null): this;
29
- /** Reads the procedure code. */
29
+ setCode(codeSystem: string, codeValue: string): this;
30
+ /** Reads only the procedure code value. */
30
31
  getCode(): string | undefined;
32
+ setCodeSystem(system?: string | null): this;
33
+ getCodeSystem(): string | undefined;
34
+ setSystemAndCode(system?: string | null, code?: string | null): this;
35
+ getSystemAndCode(): string | undefined;
31
36
  /** Writes the local code text. */
32
37
  setCodeTextLocal(text?: string | null): this;
33
38
  /** Reads the local code text. */
@@ -44,10 +49,23 @@ export declare class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
44
49
  setLocation(reference?: string | null): this;
45
50
  /** Reads the location reference. */
46
51
  getLocation(): string | undefined;
47
- /** Writes the reason code. */
52
+ /** Writes the reason code from `code`, `system|code`, or separate `system, code` arguments. */
48
53
  setReasonCode(code?: string | null): this;
49
- /** Reads the reason code. */
54
+ setReasonCode(codeSystem: string, codeValue: string): this;
55
+ /** Reads only the reason code value. */
50
56
  getReasonCode(): string | undefined;
57
+ setReasonCodeSystem(system?: string | null): this;
58
+ getReasonCodeSystem(): string | undefined;
59
+ setReasonSystemAndCode(system?: string | null, code?: string | null): this;
60
+ getReasonSystemAndCode(): string | undefined;
61
+ setBodySite(code?: string | null): this;
62
+ setBodySite(codeSystem: string, codeValue: string): this;
63
+ getBodySite(): string | undefined;
64
+ getBodySiteCode(): string | undefined;
65
+ setBodySiteCodeSystem(system?: string | null): this;
66
+ getBodySiteCodeSystem(): string | undefined;
67
+ setBodySiteSystemAndCode(system?: string | null, code?: string | null): this;
68
+ getBodySiteSystemAndCode(): string | undefined;
51
69
  /** Writes the note text. */
52
70
  setNote(note?: string | null): this;
53
71
  /** Reads the note text. */
@@ -27,10 +27,13 @@ export class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
27
27
  setDate(date) { return this.setScalarClaim(ProcedureClaim.Date, date); }
28
28
  /** Reads the procedure date. */
29
29
  getDate() { return this.getScalarClaim(ProcedureClaim.Date); }
30
- /** Writes the procedure code. */
31
- setCode(code) { return this.setScalarClaim(ProcedureClaim.Code, code); }
32
- /** Reads the procedure code. */
33
- getCode() { return this.getScalarClaim(ProcedureClaim.Code); }
30
+ setCode(codeOrSystem, codeValue) { return this.setCodingTokenCode(ProcedureClaim.Code, codeOrSystem, codeValue); }
31
+ /** Reads only the procedure code value. */
32
+ getCode() { return this.getCodingTokenCode(ProcedureClaim.Code); }
33
+ setCodeSystem(system) { return this.setCodingTokenSystem(ProcedureClaim.Code, system); }
34
+ getCodeSystem() { return this.getCodingTokenSystem(ProcedureClaim.Code); }
35
+ setSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ProcedureClaim.Code, system, code); }
36
+ getSystemAndCode() { return this.getCodingTokenSystemAndCode(ProcedureClaim.Code); }
34
37
  /** Writes the local code text. */
35
38
  setCodeTextLocal(text) { return this.setScalarClaim(ProcedureClaim.CodeText, text); }
36
39
  /** Reads the local code text. */
@@ -47,10 +50,20 @@ export class ProcedureEntryEditor extends ClinicalResourceEntryEditor {
47
50
  setLocation(reference) { return this.setScalarClaim(ProcedureClaim.Location, reference); }
48
51
  /** Reads the location reference. */
49
52
  getLocation() { return this.getScalarClaim(ProcedureClaim.Location); }
50
- /** Writes the reason code. */
51
- setReasonCode(code) { return this.setScalarClaim(ProcedureClaim.ReasonCode, code); }
52
- /** Reads the reason code. */
53
- getReasonCode() { return this.getScalarClaim(ProcedureClaim.ReasonCode); }
53
+ setReasonCode(codeOrSystem, codeValue) { return this.setCodingTokenCode(ProcedureClaim.ReasonCode, codeOrSystem, codeValue); }
54
+ /** Reads only the reason code value. */
55
+ getReasonCode() { return this.getCodingTokenCode(ProcedureClaim.ReasonCode); }
56
+ setReasonCodeSystem(system) { return this.setCodingTokenSystem(ProcedureClaim.ReasonCode, system); }
57
+ getReasonCodeSystem() { return this.getCodingTokenSystem(ProcedureClaim.ReasonCode); }
58
+ setReasonSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ProcedureClaim.ReasonCode, system, code); }
59
+ getReasonSystemAndCode() { return this.getCodingTokenSystemAndCode(ProcedureClaim.ReasonCode); }
60
+ setBodySite(codeOrSystem, codeValue) { return this.setCodingTokenCode(ProcedureClaim.BodySite, codeOrSystem, codeValue); }
61
+ getBodySite() { return this.getCodingTokenSystemAndCode(ProcedureClaim.BodySite); }
62
+ getBodySiteCode() { return this.getCodingTokenCode(ProcedureClaim.BodySite); }
63
+ setBodySiteCodeSystem(system) { return this.setCodingTokenSystem(ProcedureClaim.BodySite, system); }
64
+ getBodySiteCodeSystem() { return this.getCodingTokenSystem(ProcedureClaim.BodySite); }
65
+ setBodySiteSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ProcedureClaim.BodySite, system, code); }
66
+ getBodySiteSystemAndCode() { return this.getCodingTokenSystemAndCode(ProcedureClaim.BodySite); }
54
67
  /** Writes the note text. */
55
68
  setNote(note) { return this.setScalarClaim(ProcedureClaim.Note, note); }
56
69
  /** Reads the note text. */
@@ -14,7 +14,13 @@ export declare class RelatedPersonEntryEditor extends BundleEntryEditor {
14
14
  setSubject(value?: string | null): this;
15
15
  getSubject(): string | undefined;
16
16
  setRelationship(value?: string | null): this;
17
+ setRelationship(codeSystem: string, codeValue: string): this;
17
18
  getRelationship(): string | undefined;
19
+ getRelationshipCode(): string | undefined;
20
+ setRelationshipCodeSystem(system?: string | null): this;
21
+ getRelationshipCodeSystem(): string | undefined;
22
+ setRelationshipSystemAndCode(system?: string | null, code?: string | null): this;
23
+ getRelationshipSystemAndCode(): string | undefined;
18
24
  setRoleList(values: readonly string[]): this;
19
25
  getRoleList(): string[];
20
26
  setName(value?: string | null): this;
@@ -66,8 +66,13 @@ export class RelatedPersonEntryEditor extends BundleEntryEditor {
66
66
  }
67
67
  setSubject(value) { return this.setOptionalText(RelatedPersonClaim.Patient, value); }
68
68
  getSubject() { return this.getOptionalText(RelatedPersonClaim.Patient); }
69
- setRelationship(value) { return this.setOptionalText(RelatedPersonClaim.Relationship, value); }
70
- getRelationship() { return this.getOptionalText(RelatedPersonClaim.Relationship); }
69
+ setRelationship(valueOrSystem, codeValue) { return this.setCodingTokenCode(RelatedPersonClaim.Relationship, valueOrSystem, codeValue); }
70
+ getRelationship() { return this.getCodingTokenSystemAndCode(RelatedPersonClaim.Relationship); }
71
+ getRelationshipCode() { return this.getCodingTokenCode(RelatedPersonClaim.Relationship); }
72
+ setRelationshipCodeSystem(system) { return this.setCodingTokenSystem(RelatedPersonClaim.Relationship, system); }
73
+ getRelationshipCodeSystem() { return this.getCodingTokenSystem(RelatedPersonClaim.Relationship); }
74
+ setRelationshipSystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(RelatedPersonClaim.Relationship, system, code); }
75
+ getRelationshipSystemAndCode() { return this.getCodingTokenSystemAndCode(RelatedPersonClaim.Relationship); }
71
76
  setRoleList(values) { return this.setList(RelatedPersonClaim.Role, values); }
72
77
  getRoleList() { return this.getList(RelatedPersonClaim.Role); }
73
78
  setName(value) { return this.setOptionalText(RelatedPersonClaim.Name, value); }
@@ -30,8 +30,14 @@ export declare class VitalSignEntryEditor extends ObservationComponentEntryEdito
30
30
  getStatus(): string | undefined;
31
31
  /** Sets the observation category, usually one of the shared vital-sign category descriptors. */
32
32
  setCategory(category: CodingDescriptor | string): this;
33
+ setCategory(codeSystem: string, codeValue: string): this;
33
34
  /** Returns the observation category token. */
34
35
  getCategory(): string | undefined;
36
+ getCategoryCode(): string | undefined;
37
+ setCategoryCodeSystem(system?: string | null): this;
38
+ getCategoryCodeSystem(): string | undefined;
39
+ setCategorySystemAndCode(system?: string | null, code?: string | null): this;
40
+ getCategorySystemAndCode(): string | undefined;
35
41
  /** Sets the observation date/effective time. */
36
42
  setDate(date: string): this;
37
43
  /** Returns the observation date/effective time. */
@@ -67,15 +67,20 @@ export class VitalSignEntryEditor extends ObservationComponentEntryEditor {
67
67
  getStatus() {
68
68
  return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Status));
69
69
  }
70
- /** Sets the observation category, usually one of the shared vital-sign category descriptors. */
71
- setCategory(category) {
72
- const normalized = typeof category === 'string' ? category.trim() : category.claim;
73
- return this.setClaim(ObservationClaim.Category, normalized);
70
+ setCategory(categoryOrSystem, codeValue) {
71
+ return typeof categoryOrSystem === 'string'
72
+ ? this.setCodingTokenCode(ObservationClaim.Category, categoryOrSystem, codeValue)
73
+ : this.setCodingTokenSystemAndCode(ObservationClaim.Category, categoryOrSystem.system, categoryOrSystem.code);
74
74
  }
75
75
  /** Returns the observation category token. */
76
76
  getCategory() {
77
- return normalizeOptionalIdentifier(this.getClaim(ObservationClaim.Category));
77
+ return this.getCodingTokenSystemAndCode(ObservationClaim.Category);
78
78
  }
79
+ getCategoryCode() { return this.getCodingTokenCode(ObservationClaim.Category); }
80
+ setCategoryCodeSystem(system) { return this.setCodingTokenSystem(ObservationClaim.Category, system); }
81
+ getCategoryCodeSystem() { return this.getCodingTokenSystem(ObservationClaim.Category); }
82
+ setCategorySystemAndCode(system, code) { return this.setCodingTokenSystemAndCode(ObservationClaim.Category, system, code); }
83
+ getCategorySystemAndCode() { return this.getCodingTokenSystemAndCode(ObservationClaim.Category); }
79
84
  /** Sets the observation date/effective time. */
80
85
  setDate(date) {
81
86
  const normalized = String(date).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.9.14",
3
+ "version": "2.9.16",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },