@clinia/context-engine-js 0.9.0 → 0.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @clinia/context-engine-js
2
2
 
3
+ ## 0.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8d9e981: - The evidence on a resolution decision no longer lists the `hierarchical-code-match` kind, and the clients no longer have a type for it. No decision ever carried it.
8
+ - In the Python client, each generated evidence class after it moves down one number: `Evidence4` is now `Evidence3`, through `Evidence17`, now `Evidence16`. Code that names one of them by number names a different kind of evidence.
9
+
10
+ ## 0.10.1-rc.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 8d9e981: - The evidence on a resolution decision no longer lists the `hierarchical-code-match` kind, and the clients no longer have a type for it. No decision ever carried it.
15
+ - In the Python client, each generated evidence class after it moves down one number: `Evidence4` is now `Evidence3`, through `Evidence17`, now `Evidence16`. Code that names one of them by number names a different kind of evidence.
16
+
17
+ ## 0.10.0
18
+
19
+ ### Minor Changes
20
+
21
+ - 7e113a5: - Medication `extracted_fact` nodes carry `identity`: the record's own ingredients, route, and dose forms for `other`.
22
+ - They also carry `identityEvidence`: how each part was decided.
23
+ - For ingredients and dose form: every candidate the vocabulary found, or why it found none.
24
+ - For the route: every step's decision, as `routeDecision.evidence` gave it.
25
+ - `routeDecision` is gone. Read the route from `identity.route` and its decisions from `identityEvidence.route`.
26
+
27
+ ## 0.10.0-rc.1
28
+
29
+ No changes in this release.
30
+
31
+ ## 0.10.0-rc.0
32
+
33
+ ### Minor Changes
34
+
35
+ - 7e113a5: - Medication `extracted_fact` nodes carry `identity`: the record's own ingredients, route, and dose forms for `other`.
36
+ - They also carry `identityEvidence`: how each part was decided.
37
+ - For ingredients and dose form: every candidate the vocabulary found, or why it found none.
38
+ - For the route: every step's decision, as `routeDecision.evidence` gave it.
39
+ - `routeDecision` is gone. Read the route from `identity.route` and its decisions from `identityEvidence.route`.
40
+
3
41
  ## 0.9.0
4
42
 
5
43
  ### Minor Changes
@@ -1231,7 +1231,8 @@ export interface components {
1231
1231
  orderValidUntil?: string;
1232
1232
  /** @description ISO date when a clinician stated it held. Shows it held then, not when it started. */
1233
1233
  assertedAt?: string;
1234
- routeDecision?: components["schemas"]["MedicationRouteDecision"];
1234
+ identity?: components["schemas"]["MedicationIdentity"];
1235
+ identityEvidence?: components["schemas"]["MedicationIdentityEvidence"];
1235
1236
  /** @description Where this fact was extracted from. */
1236
1237
  source: {
1237
1238
  /**
@@ -1643,17 +1644,125 @@ export interface components {
1643
1644
  ingestionId: string;
1644
1645
  };
1645
1646
  };
1646
- /** @description How a medication record's route was decided: `route` is the route it was given, absent when no step placed it, and `evidence` holds every step's decision. Depending on how it was ingested, a medication record carries it. */
1647
- MedicationRouteDecision: {
1647
+ /** @description What identifies a medication: its ingredients, its route, and for `other` the product's dose forms. Depending on how it was ingested, a medication record carries its own, and a fact the one its members share. Such a fact is returned as its identity, codes, status and effective period, and leaves its dose, route text and dates on its members. Its `display` then reads as its identity, and it carries none when no identity was found. */
1648
+ MedicationIdentity: {
1649
+ /** @description Each RxNorm ingredient, at its precise grain when it is given as a salt or ester, sorted by code. */
1650
+ ingredients: {
1651
+ system: string;
1652
+ code: string;
1653
+ display?: string;
1654
+ }[];
1648
1655
  route?: components["schemas"]["MedicationRoute"];
1649
- /** @description Every decision the steps made about the route, in the order the steps ran. */
1650
- evidence: components["schemas"]["MedicationRouteEvidence"][];
1656
+ /** @description The product's RxNorm dose forms, sorted by code. Only for `other`, and absent when unknown. */
1657
+ doseForms?: {
1658
+ system: string;
1659
+ code: string;
1660
+ display?: string;
1661
+ }[];
1651
1662
  };
1652
1663
  /**
1653
1664
  * @description A route group, or `other` for a route outside every group. Absent from an identity when the route is unknown.
1654
1665
  * @enum {string}
1655
1666
  */
1656
1667
  MedicationRoute: "oral" | "rectal" | "sublingual" | "buccal" | "nasogastric" | "intramuscular" | "intravenous" | "subcutaneous" | "intradermal" | "intrathecal" | "intraperitoneal" | "intra-articular" | "intraosseous" | "hemodialysis" | "urethral" | "intrauterine" | "intraocular" | "intravesical" | "topical" | "transdermal" | "ophthalmic" | "otic" | "nasal" | "vaginal" | "inhalation" | "nebulization" | "other";
1668
+ /** @description How each part of a medication record's identity was decided. `ingredients` and `doseForms` are absent when no lookup was stored for them. Depending on how it was ingested, a medication record carries it. */
1669
+ MedicationIdentityEvidence: {
1670
+ ingredients?: components["schemas"]["MedicationConceptEvidence"];
1671
+ doseForms?: components["schemas"]["MedicationConceptEvidence"];
1672
+ /** @description Every step's decision about the route, in the order the steps ran. */
1673
+ route: components["schemas"]["MedicationRouteEvidence"][];
1674
+ };
1675
+ /** @description How the vocabulary grounded a medication record's ingredients or its dose form: every candidate it found, or why it found none. */
1676
+ MedicationConceptEvidence: {
1677
+ /** @enum {string} */
1678
+ status: "grounded";
1679
+ /** @description Every candidate found, best first. The first one gives the identity. */
1680
+ candidates: {
1681
+ /**
1682
+ * @description The lookup step: `code`, `crosswalk`, `exact-name` or `normalized-name`, in the order they run.
1683
+ * @enum {string}
1684
+ */
1685
+ method: "code" | "crosswalk" | "exact-name" | "normalized-name";
1686
+ /** @description How closely the candidate matched, from 0 to 1. */
1687
+ score: number;
1688
+ /** @description The concepts it names. A combination product names several. */
1689
+ members: {
1690
+ /** @description The concept, as an RxNorm coding. */
1691
+ concept: {
1692
+ system: string;
1693
+ code: string;
1694
+ display?: string;
1695
+ };
1696
+ /** @description Its precise forms, such as an ingredient's salts or esters. Empty when the vocabulary names none. */
1697
+ precise: {
1698
+ system: string;
1699
+ code: string;
1700
+ display?: string;
1701
+ }[];
1702
+ }[];
1703
+ }[];
1704
+ } | {
1705
+ /** @enum {string} */
1706
+ status: "abstained";
1707
+ /**
1708
+ * @description Why no candidate was found: every step that ran gave up (`cascade-exhausted`), the record carries nothing to look up (`nothing-to-resolve`), or the vocabulary is not set up for it.
1709
+ * @enum {string}
1710
+ */
1711
+ reason: "cascade-exhausted" | "nothing-to-resolve" | "unsupported-domain" | "unserved-target-system";
1712
+ /** @description How each step that ran gave up, in the order they ran. Empty unless `reason` is `cascade-exhausted`. */
1713
+ attempts: ({
1714
+ /**
1715
+ * @description The lookup step: `code`, `crosswalk`, `exact-name` or `normalized-name`, in the order they run.
1716
+ * @enum {string}
1717
+ */
1718
+ method: "code" | "crosswalk" | "exact-name" | "normalized-name";
1719
+ /**
1720
+ * @description Why the step gave up on these codes: a system it does not recognize, a system it does not serve, a code it does not hold, a code with no RxNorm equivalent, or a concept with no ingredient or dose form.
1721
+ * @enum {string}
1722
+ */
1723
+ reason: "unrecognized-system" | "unserved-system" | "unknown-code" | "no-crosswalk-equivalent" | "no-roll-up";
1724
+ /** @description The codes the step looked up, each system as the record spelled it or as its URI. */
1725
+ codes: {
1726
+ system: string;
1727
+ code: string;
1728
+ }[];
1729
+ } | {
1730
+ /**
1731
+ * @description The lookup step: `code`, `crosswalk`, `exact-name` or `normalized-name`, in the order they run.
1732
+ * @enum {string}
1733
+ */
1734
+ method: "code" | "crosswalk" | "exact-name" | "normalized-name";
1735
+ /** @enum {string} */
1736
+ reason: "no-name-match";
1737
+ /** @description The names the step looked up. */
1738
+ names: string[];
1739
+ } | {
1740
+ /**
1741
+ * @description The lookup step: `code`, `crosswalk`, `exact-name` or `normalized-name`, in the order they run.
1742
+ * @enum {string}
1743
+ */
1744
+ method: "code" | "crosswalk" | "exact-name" | "normalized-name";
1745
+ /** @enum {string} */
1746
+ reason: "ambiguous-name";
1747
+ /** @description The names the step looked up. */
1748
+ names: string[];
1749
+ /** @description Each set of concepts the close names lead to, best match first. */
1750
+ sets: {
1751
+ /** @description The concept, as an RxNorm coding. */
1752
+ concept: {
1753
+ system: string;
1754
+ code: string;
1755
+ display?: string;
1756
+ };
1757
+ /** @description Its precise forms, such as an ingredient's salts or esters. Empty when the vocabulary names none. */
1758
+ precise: {
1759
+ system: string;
1760
+ code: string;
1761
+ display?: string;
1762
+ }[];
1763
+ }[][];
1764
+ })[];
1765
+ };
1657
1766
  /** @description One step's decision about a medication record's route: the route it named and how. `code-match` reads the product's dose form, `phrase-match` the record's texts, `evaluation` and `judgement` ask a model. A model's decision below its confidence threshold, or one the model is not sure of, stays as evidence without giving the route. */
1658
1767
  MedicationRouteEvidence: {
1659
1768
  route: components["schemas"]["MedicationRoute"];
@@ -2137,22 +2246,6 @@ export interface components {
2137
2246
  /** @description Score this member was ranked with when the field was decided. */
2138
2247
  score: number;
2139
2248
  };
2140
- /** @description What identifies a medication: its ingredients, its route, and for `other` the product's dose forms. Depending on how it was ingested, a medication is returned as its identity, codes, status and effective period, and leaves its dose, route text and dates on its members. Its `display` then reads as its identity, and it carries none when no identity was found. */
2141
- MedicationIdentity: {
2142
- /** @description Each RxNorm ingredient, at its precise grain when it is given as a salt or ester, sorted by code. */
2143
- ingredients: {
2144
- system: string;
2145
- code: string;
2146
- display?: string;
2147
- }[];
2148
- route?: components["schemas"]["MedicationRoute"];
2149
- /** @description The product's RxNorm dose forms, sorted by code. Only for `other`, and absent when unknown. */
2150
- doseForms?: {
2151
- system: string;
2152
- code: string;
2153
- display?: string;
2154
- }[];
2155
- };
2156
2249
  /** @description An `extracted_narrative` node in the patient context graph. */
2157
2250
  ExtractedNarrativeNode: {
2158
2251
  /**
@@ -2641,21 +2734,6 @@ export interface components {
2641
2734
  systemRecognized: boolean;
2642
2735
  /** @description The code that both entities share in the given code system. */
2643
2736
  code: string;
2644
- } | {
2645
- /** @enum {string} */
2646
- kind: "hierarchical-code-match";
2647
- /** @enum {string} */
2648
- layer: "deterministic-code";
2649
- /** @description The code system the match was made in: its canonical URI when recognized, the source spelling otherwise. */
2650
- system: string;
2651
- /** @description Whether the code system was one the vocabulary layer recognizes at decision time. */
2652
- systemRecognized: boolean;
2653
- /** @description The code from entity A. */
2654
- codeA: string;
2655
- /** @description The code from entity B. */
2656
- codeB: string;
2657
- /** @description The ancestor code that links the two entities' codes hierarchically. */
2658
- ancestorCode: string;
2659
2737
  } | {
2660
2738
  /** @enum {string} */
2661
2739
  kind: "code-mismatch";
@@ -3946,7 +4024,7 @@ export interface operations {
3946
4024
  "application/json": components["schemas"]["BrowseResult"];
3947
4025
  };
3948
4026
  };
3949
- /** @description Patient not found */
4027
+ /** @description Patient or path not found */
3950
4028
  404: {
3951
4029
  headers: {
3952
4030
  [name: string]: unknown;
@@ -3985,7 +4063,7 @@ export interface operations {
3985
4063
  "application/json": components["schemas"]["ReadResponse"];
3986
4064
  };
3987
4065
  };
3988
- /** @description Patient not found */
4066
+ /** @description Patient or path not found */
3989
4067
  404: {
3990
4068
  headers: {
3991
4069
  [name: string]: unknown;
@@ -5014,10 +5092,16 @@ export interface operations {
5014
5092
  perPage?: number;
5015
5093
  /** @description Conditions to filter on, ANDed together. Omitted or empty matches every relationship. */
5016
5094
  filter?: {
5017
- /** @description Restrict to this relationship type. */
5095
+ /** @description Restrict to relationships of this type. */
5018
5096
  type?: {
5019
- /** @description Matches exactly this value. */
5020
- eq: string;
5097
+ /**
5098
+ * @description Matches exactly this value.
5099
+ * @enum {string}
5100
+ */
5101
+ eq: "prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts";
5102
+ } | {
5103
+ /** @description Matches any of these values. At most 500. */
5104
+ any: ("prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts")[];
5021
5105
  };
5022
5106
  /** @description Restrict to relationships recorded from this source. */
5023
5107
  source?: {
@@ -27,13 +27,14 @@ export type BrowseResult = components["schemas"]["BrowseResult"];
27
27
  export type ReadResponse = components["schemas"]["ReadResponse"];
28
28
  export type Node = components["schemas"]["Node"];
29
29
  export type ExtractedFactNode = components["schemas"]["ExtractedFactNode"];
30
- export type MedicationRouteDecision = components["schemas"]["MedicationRouteDecision"];
30
+ export type MedicationIdentity = components["schemas"]["MedicationIdentity"];
31
31
  export type MedicationRoute = components["schemas"]["MedicationRoute"];
32
+ export type MedicationIdentityEvidence = components["schemas"]["MedicationIdentityEvidence"];
33
+ export type MedicationConceptEvidence = components["schemas"]["MedicationConceptEvidence"];
32
34
  export type MedicationRouteEvidence = components["schemas"]["MedicationRouteEvidence"];
33
35
  export type FactNode = components["schemas"]["FactNode"];
34
36
  export type FactConflicts = components["schemas"]["FactConflicts"];
35
37
  export type ScoredFactMember = components["schemas"]["ScoredFactMember"];
36
- export type MedicationIdentity = components["schemas"]["MedicationIdentity"];
37
38
  export type ExtractedNarrativeNode = components["schemas"]["ExtractedNarrativeNode"];
38
39
  export type NarrativePassageNode = components["schemas"]["NarrativePassageNode"];
39
40
  export type NarrativeNode = components["schemas"]["NarrativeNode"];
@@ -1091,7 +1091,9 @@ export declare class GraphResource {
1091
1091
  perPage?: number;
1092
1092
  filter?: {
1093
1093
  type?: {
1094
- eq: string;
1094
+ eq: "prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts";
1095
+ } | {
1096
+ any: ("prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts")[];
1095
1097
  };
1096
1098
  source?: {
1097
1099
  eq: "explicit_reference" | "knowledge_base" | "temporal_inference" | "llm_inferred" | "narrative_verification";
@@ -1139,7 +1141,9 @@ export declare class GraphResource {
1139
1141
  perPage?: number;
1140
1142
  filter?: {
1141
1143
  type?: {
1142
- eq: string;
1144
+ eq: "prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts";
1145
+ } | {
1146
+ any: ("prescribed_for" | "monitors" | "occurred_during" | "has_complication" | "manifestation_of" | "progression_of" | "risk_factor_for" | "commonly_comorbid" | "same_disease_axis" | "related_to" | "corroborates" | "enriches" | "conflicts")[];
1143
1147
  };
1144
1148
  source?: {
1145
1149
  eq: "explicit_reference" | "knowledge_base" | "temporal_inference" | "llm_inferred" | "narrative_verification";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clinia/context-engine-js",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "TypeScript client for the Clinia Context Engine",
5
5
  "keywords": [
6
6
  "clinia",
@@ -45,9 +45,9 @@
45
45
  "openapi-fetch": "^0.17.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/node": "^24.0.0",
48
+ "@types/node": "^26.6.6",
49
49
  "openapi-typescript": "^7.13.0",
50
- "tsup": "^8.5.1",
50
+ "tsup": "^9.0.0",
51
51
  "typescript": "npm:@typescript/typescript6@^6.0.2",
52
52
  "vitest": "^5.0.0"
53
53
  },