@clinia/context-engine-js 0.9.0 → 0.10.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.
- package/CHANGELOG.md +24 -0
- package/dist/generated/context-engine.d.ts +125 -26
- package/dist/generated/types.d.ts +3 -2
- package/dist/resources/graph.d.ts +6 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @clinia/context-engine-js
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7e113a5: - Medication `extracted_fact` nodes carry `identity`: the record's own ingredients, route, and dose forms for `other`.
|
|
8
|
+
- They also carry `identityEvidence`: how each part was decided.
|
|
9
|
+
- For ingredients and dose form: every candidate the vocabulary found, or why it found none.
|
|
10
|
+
- For the route: every step's decision, as `routeDecision.evidence` gave it.
|
|
11
|
+
- `routeDecision` is gone. Read the route from `identity.route` and its decisions from `identityEvidence.route`.
|
|
12
|
+
|
|
13
|
+
## 0.10.0-rc.1
|
|
14
|
+
|
|
15
|
+
No changes in this release.
|
|
16
|
+
|
|
17
|
+
## 0.10.0-rc.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
|
+
|
|
3
27
|
## 0.9.0
|
|
4
28
|
|
|
5
29
|
### 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
|
-
|
|
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
|
|
1647
|
-
|
|
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
|
|
1650
|
-
|
|
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
|
/**
|
|
@@ -3946,7 +4039,7 @@ export interface operations {
|
|
|
3946
4039
|
"application/json": components["schemas"]["BrowseResult"];
|
|
3947
4040
|
};
|
|
3948
4041
|
};
|
|
3949
|
-
/** @description Patient not found */
|
|
4042
|
+
/** @description Patient or path not found */
|
|
3950
4043
|
404: {
|
|
3951
4044
|
headers: {
|
|
3952
4045
|
[name: string]: unknown;
|
|
@@ -3985,7 +4078,7 @@ export interface operations {
|
|
|
3985
4078
|
"application/json": components["schemas"]["ReadResponse"];
|
|
3986
4079
|
};
|
|
3987
4080
|
};
|
|
3988
|
-
/** @description Patient not found */
|
|
4081
|
+
/** @description Patient or path not found */
|
|
3989
4082
|
404: {
|
|
3990
4083
|
headers: {
|
|
3991
4084
|
[name: string]: unknown;
|
|
@@ -5014,10 +5107,16 @@ export interface operations {
|
|
|
5014
5107
|
perPage?: number;
|
|
5015
5108
|
/** @description Conditions to filter on, ANDed together. Omitted or empty matches every relationship. */
|
|
5016
5109
|
filter?: {
|
|
5017
|
-
/** @description Restrict to this
|
|
5110
|
+
/** @description Restrict to relationships of this type. */
|
|
5018
5111
|
type?: {
|
|
5019
|
-
/**
|
|
5020
|
-
|
|
5112
|
+
/**
|
|
5113
|
+
* @description Matches exactly this value.
|
|
5114
|
+
* @enum {string}
|
|
5115
|
+
*/
|
|
5116
|
+
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";
|
|
5117
|
+
} | {
|
|
5118
|
+
/** @description Matches any of these values. At most 500. */
|
|
5119
|
+
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
5120
|
};
|
|
5022
5121
|
/** @description Restrict to relationships recorded from this source. */
|
|
5023
5122
|
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
|
|
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:
|
|
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:
|
|
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.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "TypeScript client for the Clinia Context Engine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"clinia",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^24.0.0",
|
|
49
49
|
"openapi-typescript": "^7.13.0",
|
|
50
|
-
"tsup": "^
|
|
50
|
+
"tsup": "^9.0.0",
|
|
51
51
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
52
52
|
"vitest": "^5.0.0"
|
|
53
53
|
},
|