@photonhealth/client 0.0.0-stage → 2.0.0-rc.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/LICENSE +15 -0
- package/README.md +89 -2
- package/dist/api/changes/applyOption.d.ts +41 -0
- package/dist/api/changes/applyOption.d.ts.map +1 -0
- package/dist/api/changes/applyOption.js +76 -0
- package/dist/api/changes/applyOption.js.map +1 -0
- package/dist/api/changes/classifyChanges.d.ts +9 -0
- package/dist/api/changes/classifyChanges.d.ts.map +1 -0
- package/dist/api/changes/classifyChanges.js +2 -0
- package/dist/api/changes/classifyChanges.js.map +1 -0
- package/dist/api/changes/index.d.ts +3 -0
- package/dist/api/changes/index.d.ts.map +1 -0
- package/dist/api/changes/index.js +3 -0
- package/dist/api/changes/index.js.map +1 -0
- package/dist/api/client.d.ts +43 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +77 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/health.d.ts +4 -0
- package/dist/api/health.d.ts.map +1 -0
- package/dist/api/health.js +6 -0
- package/dist/api/health.js.map +1 -0
- package/dist/api/index.d.ts +22 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +21 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/order.d.ts +33 -0
- package/dist/api/order.d.ts.map +1 -0
- package/dist/api/order.js +33 -0
- package/dist/api/order.js.map +1 -0
- package/dist/api/patient.d.ts +33 -0
- package/dist/api/patient.d.ts.map +1 -0
- package/dist/api/patient.js +33 -0
- package/dist/api/patient.js.map +1 -0
- package/dist/api/prescription.d.ts +31 -0
- package/dist/api/prescription.d.ts.map +1 -0
- package/dist/api/prescription.js +30 -0
- package/dist/api/prescription.js.map +1 -0
- package/dist/api/results.d.ts +30 -0
- package/dist/api/results.d.ts.map +1 -0
- package/dist/api/results.js +26 -0
- package/dist/api/results.js.map +1 -0
- package/dist/gql/gql.d.ts +21 -0
- package/dist/gql/gql.d.ts.map +1 -0
- package/dist/gql/gql.js +13 -0
- package/dist/gql/gql.js.map +1 -0
- package/dist/gql/graphql.d.ts +9674 -0
- package/dist/gql/graphql.d.ts.map +1 -0
- package/dist/gql/graphql.js +4030 -0
- package/dist/gql/graphql.js.map +1 -0
- package/dist/gql/index.d.ts +2 -0
- package/dist/gql/index.d.ts.map +1 -0
- package/dist/gql/index.js +3 -0
- package/dist/gql/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/photon/auth.d.ts +48 -0
- package/dist/photon/auth.d.ts.map +1 -0
- package/dist/photon/auth.js +34 -0
- package/dist/photon/auth.js.map +1 -0
- package/dist/photon/choices.d.ts +44 -0
- package/dist/photon/choices.d.ts.map +1 -0
- package/dist/photon/choices.js +58 -0
- package/dist/photon/choices.js.map +1 -0
- package/dist/photon/context.d.ts +29 -0
- package/dist/photon/context.d.ts.map +1 -0
- package/dist/photon/context.js +2 -0
- package/dist/photon/context.js.map +1 -0
- package/dist/photon/environments.d.ts +26 -0
- package/dist/photon/environments.d.ts.map +1 -0
- package/dist/photon/environments.js +26 -0
- package/dist/photon/environments.js.map +1 -0
- package/dist/photon/errors.d.ts +26 -0
- package/dist/photon/errors.d.ts.map +1 -0
- package/dist/photon/errors.js +42 -0
- package/dist/photon/errors.js.map +1 -0
- package/dist/photon/index.d.ts +23 -0
- package/dist/photon/index.d.ts.map +1 -0
- package/dist/photon/index.js +11 -0
- package/dist/photon/index.js.map +1 -0
- package/dist/photon/inputs.d.ts +7 -0
- package/dist/photon/inputs.d.ts.map +1 -0
- package/dist/photon/inputs.js +25 -0
- package/dist/photon/inputs.js.map +1 -0
- package/dist/photon/links.d.ts +68 -0
- package/dist/photon/links.d.ts.map +1 -0
- package/dist/photon/links.js +187 -0
- package/dist/photon/links.js.map +1 -0
- package/dist/photon/live.d.ts +62 -0
- package/dist/photon/live.d.ts.map +1 -0
- package/dist/photon/live.js +107 -0
- package/dist/photon/live.js.map +1 -0
- package/dist/photon/map.d.ts +10 -0
- package/dist/photon/map.d.ts.map +1 -0
- package/dist/photon/map.js +211 -0
- package/dist/photon/map.js.map +1 -0
- package/dist/photon/order.d.ts +148 -0
- package/dist/photon/order.d.ts.map +1 -0
- package/dist/photon/order.js +491 -0
- package/dist/photon/order.js.map +1 -0
- package/dist/photon/patient.d.ts +78 -0
- package/dist/photon/patient.d.ts.map +1 -0
- package/dist/photon/patient.js +316 -0
- package/dist/photon/patient.js.map +1 -0
- package/dist/photon/photon.d.ts +150 -0
- package/dist/photon/photon.d.ts.map +1 -0
- package/dist/photon/photon.js +315 -0
- package/dist/photon/photon.js.map +1 -0
- package/dist/photon/prescription.d.ts +132 -0
- package/dist/photon/prescription.d.ts.map +1 -0
- package/dist/photon/prescription.js +381 -0
- package/dist/photon/prescription.js.map +1 -0
- package/dist/photon/session.d.ts +84 -0
- package/dist/photon/session.d.ts.map +1 -0
- package/dist/photon/session.js +350 -0
- package/dist/photon/session.js.map +1 -0
- package/dist/photon/types.d.ts +411 -0
- package/dist/photon/types.d.ts.map +1 -0
- package/dist/photon/types.js +7 -0
- package/dist/photon/types.js.map +1 -0
- package/dist/test-utils/msw.d.ts +23 -0
- package/dist/test-utils/msw.d.ts.map +1 -0
- package/dist/test-utils/msw.js +51 -0
- package/dist/test-utils/msw.js.map +1 -0
- package/dist/testing/fixtures.d.ts +51 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +166 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/scriptedClient.d.ts +38 -0
- package/dist/testing/scriptedClient.d.ts.map +1 -0
- package/dist/testing/scriptedClient.js +52 -0
- package/dist/testing/scriptedClient.js.map +1 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +10 -0
- package/dist/testing.js.map +1 -0
- package/package.json +67 -4
- package/src/api/changes/applyOption.ts +103 -0
- package/src/api/changes/classifyChanges.ts +10 -0
- package/src/api/changes/index.ts +2 -0
- package/src/api/client.ts +124 -0
- package/src/api/health.ts +7 -0
- package/src/api/index.ts +22 -0
- package/src/api/order.ts +64 -0
- package/src/api/patient.ts +58 -0
- package/src/api/prescription.ts +68 -0
- package/src/api/results.ts +45 -0
- package/src/gql/gql.ts +56 -0
- package/src/gql/graphql.ts +5344 -0
- package/src/gql/index.ts +2 -0
- package/src/index.ts +14 -0
- package/src/operations/fragments.graphql +351 -0
- package/src/operations/health.graphql +4 -0
- package/src/operations/order.graphql +42 -0
- package/src/operations/patient.graphql +36 -0
- package/src/operations/prescription.graphql +70 -0
- package/src/photon/auth.ts +70 -0
- package/src/photon/choices.ts +79 -0
- package/src/photon/context.ts +30 -0
- package/src/photon/environments.ts +47 -0
- package/src/photon/errors.ts +56 -0
- package/src/photon/index.ts +35 -0
- package/src/photon/inputs.ts +24 -0
- package/src/photon/links.ts +197 -0
- package/src/photon/live.ts +135 -0
- package/src/photon/map.ts +255 -0
- package/src/photon/order.ts +581 -0
- package/src/photon/patient.ts +346 -0
- package/src/photon/photon.ts +513 -0
- package/src/photon/prescription.ts +447 -0
- package/src/photon/session.ts +445 -0
- package/src/photon/types.ts +329 -0
- package/src/test-utils/msw.ts +61 -0
- package/src/testing/fixtures.ts +191 -0
- package/src/testing/scriptedClient.ts +52 -0
- package/src/testing.ts +22 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { getPatient, syncPatient, updatePatient } from "../api/index.js";
|
|
2
|
+
import { choicesIn, declaredChoice, optionKey, withChoice } from "./choices.js";
|
|
3
|
+
import { PhotonError } from "./errors.js";
|
|
4
|
+
import { LiveRecord } from "./live.js";
|
|
5
|
+
import { noChanges, toChanges, toPatient } from "./map.js";
|
|
6
|
+
const candidateOf = (p) => ({
|
|
7
|
+
id: p.id,
|
|
8
|
+
firstName: p.demographic?.name.first ?? "",
|
|
9
|
+
lastName: p.demographic?.name.last ?? null,
|
|
10
|
+
dateOfBirth: p.demographic?.dateOfBirth ?? null,
|
|
11
|
+
});
|
|
12
|
+
const validDob = (dob) => Boolean(dob && /^\d{4}-\d{2}-\d{2}$/.test(dob));
|
|
13
|
+
const trimmed = (v) => v?.trim() || undefined;
|
|
14
|
+
/** What's synced before the record: trimmed, empty fields dropped, a date of birth only when it's a whole date. */
|
|
15
|
+
function cleanDemographic(d) {
|
|
16
|
+
const first = trimmed(d.name?.first);
|
|
17
|
+
const last = trimmed(d.name?.last);
|
|
18
|
+
const clean = {
|
|
19
|
+
...(first || last ? { name: { first, last } } : {}),
|
|
20
|
+
...(validDob(d.dateOfBirth) ? { dateOfBirth: d.dateOfBirth } : {}),
|
|
21
|
+
...(d.sex ? { sex: d.sex } : {}),
|
|
22
|
+
...(trimmed(d.gender) ? { gender: trimmed(d.gender) } : {}),
|
|
23
|
+
...(trimmed(d.phone) ? { phone: trimmed(d.phone) } : {}),
|
|
24
|
+
...(trimmed(d.email) ? { email: trimmed(d.email) } : {}),
|
|
25
|
+
...(d.address ? { address: d.address } : {}),
|
|
26
|
+
};
|
|
27
|
+
return clean;
|
|
28
|
+
}
|
|
29
|
+
const mergeDemographic = (a, b) => ({
|
|
30
|
+
...a,
|
|
31
|
+
...b,
|
|
32
|
+
...(a.name || b.name ? { name: { ...a.name, ...b.name } } : {}),
|
|
33
|
+
...(a.address || b.address ? { address: { ...a.address, ...b.address } } : {}),
|
|
34
|
+
});
|
|
35
|
+
const clinicalIds = (p) => new Set([...(p?.clinical?.allergies ?? []), ...(p?.clinical?.medications ?? []), ...(p?.clinical?.diagnoses ?? [])].map((e) => e.id));
|
|
36
|
+
/**
|
|
37
|
+
* A patient — from an id, from a record the host has, or not yet known. `sync({ demographic })` sends what
|
|
38
|
+
* you know, and the server decides — the patient (found, or created when nothing matches and it has enough),
|
|
39
|
+
* candidates (pick one), or nothing yet (`changes` says what's missing). Keep adding what you know until it
|
|
40
|
+
* has an id; then `update(fields)` changes that patient. The client never decides "now create".
|
|
41
|
+
*
|
|
42
|
+
* Sync what's been committed (a field the prescriber left), not every keystroke: a sync with enough to
|
|
43
|
+
* create can create. While they type, `search` — it only lists who it might be.
|
|
44
|
+
*/
|
|
45
|
+
export class Patient extends LiveRecord {
|
|
46
|
+
#ctx;
|
|
47
|
+
/** Everything synced so far, before the record — each sync adds to it. */
|
|
48
|
+
#known = {};
|
|
49
|
+
#lastQuery = null;
|
|
50
|
+
/** The search in flight: any newer query aborts it. */
|
|
51
|
+
#searching = null;
|
|
52
|
+
/** The last clinical patch — what a choice's path applies to. */
|
|
53
|
+
#lastClinical = {};
|
|
54
|
+
#declared = new Set();
|
|
55
|
+
/**
|
|
56
|
+
* Lists recorded as "none" here: their record says `[]`, not null (not recorded). network-api can't read a
|
|
57
|
+
* "none" back for these yet (docs/api-gaps.md) — so only this object knows, until an entry is added to the list.
|
|
58
|
+
*/
|
|
59
|
+
#none = new Set();
|
|
60
|
+
constructor(ctx, record, changes) {
|
|
61
|
+
super(record, { candidates: [], pickedNames: {} }, changes);
|
|
62
|
+
this.#ctx = ctx;
|
|
63
|
+
}
|
|
64
|
+
onRecord() {
|
|
65
|
+
this.#ctx.register(this);
|
|
66
|
+
}
|
|
67
|
+
settle(state, changes) {
|
|
68
|
+
super.settle(state && this.#withNone(state), changes);
|
|
69
|
+
}
|
|
70
|
+
adopt(state, changes) {
|
|
71
|
+
super.adopt(this.#withNone(state), changes);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What's been sent to find or add the patient, before the record — e.g. a host's details the server hasn't
|
|
75
|
+
* matched yet (not enough to add them). A form starts from it.
|
|
76
|
+
*/
|
|
77
|
+
get known() {
|
|
78
|
+
return this.#known;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* SyncPatient: send what's known. Before a record it's added to what was sent before, and the server finds,
|
|
82
|
+
* lists candidates, says what's missing, or creates. With a record, the server syncs these fields to it.
|
|
83
|
+
*/
|
|
84
|
+
sync(input) {
|
|
85
|
+
if (this.id)
|
|
86
|
+
return input.demographic || input.clinical
|
|
87
|
+
? this.#write("sync", input)
|
|
88
|
+
: Promise.resolve({ changes: this.changes });
|
|
89
|
+
if (input.clinical)
|
|
90
|
+
return Promise.reject(new PhotonError("invalid", "Clinical changes need the patient's id: sync them first."));
|
|
91
|
+
return this.#match(input.demographic ?? {});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* UpdatePatient: change this patient — only what's given: demographics and/or clinical lists
|
|
95
|
+
* (`{ allergies: { add: [{ name }] } }`, `{ allergies: { none: true } }` for no known allergies). Needs its id.
|
|
96
|
+
*/
|
|
97
|
+
update(input) {
|
|
98
|
+
if (!this.id)
|
|
99
|
+
return Promise.reject(new PhotonError("invalid", "update() needs the patient's id; until it has one, sync()."));
|
|
100
|
+
return this.#write("update", input);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Type-ahead, before the record: who it might be, from what's known plus what's being typed (not kept —
|
|
104
|
+
* `sync` commits). Sent without sex, so it can never add anyone (network-api adds a patient only with first,
|
|
105
|
+
* last, date of birth and sex), and what it finds is only listed in `candidates` — even a sure match is the
|
|
106
|
+
* prescriber's pick mid-typing. A newer search or sync aborts one in flight; the same query isn't sent twice.
|
|
107
|
+
*/
|
|
108
|
+
search(input) {
|
|
109
|
+
if (this.id)
|
|
110
|
+
return Promise.resolve({ changes: this.changes });
|
|
111
|
+
const { sex: _, ...query } = cleanDemographic(mergeDemographic(this.#known, input.demographic ?? {}));
|
|
112
|
+
const key = JSON.stringify(query);
|
|
113
|
+
if (!Object.keys(query).length || key === this.#lastQuery)
|
|
114
|
+
return Promise.resolve({ changes: this.changes });
|
|
115
|
+
this.#lastQuery = key;
|
|
116
|
+
this.#searching?.abort();
|
|
117
|
+
const search = new AbortController();
|
|
118
|
+
this.#searching = search;
|
|
119
|
+
return this.run("loading", async () => {
|
|
120
|
+
if (key !== this.#lastQuery || this.id)
|
|
121
|
+
return { changes: this.changes };
|
|
122
|
+
let outcome;
|
|
123
|
+
try {
|
|
124
|
+
outcome = await syncPatient(this.#ctx.client, { demographic: query }, search.signal);
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
if (search.signal.aborted)
|
|
128
|
+
return { changes: this.changes }; // a newer query answers instead
|
|
129
|
+
throw e;
|
|
130
|
+
}
|
|
131
|
+
if (key !== this.#lastQuery || this.id)
|
|
132
|
+
return { changes: this.changes };
|
|
133
|
+
const found = outcome.kind === "ambiguous"
|
|
134
|
+
? outcome.candidates.map((c) => ({ ...c }))
|
|
135
|
+
: outcome.patient
|
|
136
|
+
? [candidateOf(toPatient(outcome.patient))]
|
|
137
|
+
: [];
|
|
138
|
+
this.patch({ candidates: found });
|
|
139
|
+
return { changes: this.changes };
|
|
140
|
+
}).finally(() => {
|
|
141
|
+
if (this.#searching === search)
|
|
142
|
+
this.#searching = null;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** One of `candidates`: read it, and this becomes that patient. Phone / email sent to find them fill gaps on it. */
|
|
146
|
+
pick(candidateId) {
|
|
147
|
+
return this.run("loading", async () => {
|
|
148
|
+
const result = this.#settle(await getPatient(this.#ctx.client, candidateId));
|
|
149
|
+
this.patch({ candidates: [] });
|
|
150
|
+
return result;
|
|
151
|
+
}).then((result) => this.#fillMissingContact(result));
|
|
152
|
+
}
|
|
153
|
+
/** A choice the server asked for (e.g. which penicillin): sent again with the pick applied to the last patch. */
|
|
154
|
+
choose(option) {
|
|
155
|
+
if (option.id && option.displayName)
|
|
156
|
+
this.patch({ pickedNames: { ...this.snapshot.pickedNames, [option.id]: option.displayName } });
|
|
157
|
+
const rooted = option.path?.startsWith("clinical.");
|
|
158
|
+
const clinical = rooted
|
|
159
|
+
? (withChoice({ clinical: this.#lastClinical }, option).clinical ?? {})
|
|
160
|
+
: withChoice(this.#lastClinical, option);
|
|
161
|
+
return this.update({ clinical });
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The Photon Rx app's link to this patient (`/patient/<id>`); `ph.url(this)`. Refused before the record: there's
|
|
165
|
+
* no id to link to, and a link never carries their details.
|
|
166
|
+
*/
|
|
167
|
+
url() {
|
|
168
|
+
return this.#ctx.url(this);
|
|
169
|
+
}
|
|
170
|
+
/** The same, embeddable in an iframe; `ph.frame(this)`. */
|
|
171
|
+
frame() {
|
|
172
|
+
return this.#ctx.frame(this);
|
|
173
|
+
}
|
|
174
|
+
/** Read it again. */
|
|
175
|
+
reload() {
|
|
176
|
+
if (!this.id)
|
|
177
|
+
return Promise.resolve({ changes: this.changes });
|
|
178
|
+
return this.run("loading", async () => this.#settle(await getPatient(this.#ctx.client, this.id)));
|
|
179
|
+
}
|
|
180
|
+
#write(kind, input) {
|
|
181
|
+
return this.run("saving", async () => {
|
|
182
|
+
const id = this.id;
|
|
183
|
+
const before = clinicalIds(this.state);
|
|
184
|
+
if (input.clinical)
|
|
185
|
+
this.#lastClinical = input.clinical;
|
|
186
|
+
const outcome = kind === "sync"
|
|
187
|
+
? await syncPatient(this.#ctx.client, { id, ...input })
|
|
188
|
+
: await updatePatient(this.#ctx.client, id, input);
|
|
189
|
+
this.#noteNone(input);
|
|
190
|
+
const result = this.#settle(outcome);
|
|
191
|
+
if (input.clinical)
|
|
192
|
+
this.#nameNewEntries(input.clinical, before);
|
|
193
|
+
return result;
|
|
194
|
+
}).then((result) => this.#takeDeclared(result));
|
|
195
|
+
}
|
|
196
|
+
#match(demographic) {
|
|
197
|
+
this.#known = mergeDemographic(this.#known, demographic);
|
|
198
|
+
const query = cleanDemographic(this.#known);
|
|
199
|
+
if (!Object.keys(query).length)
|
|
200
|
+
return Promise.resolve({ changes: this.changes });
|
|
201
|
+
const key = JSON.stringify(query);
|
|
202
|
+
// The same query gets the same answer: keep it (blur and a debounce often ask twice).
|
|
203
|
+
if (key === this.#lastQuery)
|
|
204
|
+
return Promise.resolve({ changes: this.changes });
|
|
205
|
+
this.#lastQuery = key;
|
|
206
|
+
this.#searching?.abort();
|
|
207
|
+
return this.run("loading", async () => {
|
|
208
|
+
// A newer query was made while this one waited: it answers instead.
|
|
209
|
+
if (key !== this.#lastQuery || this.id)
|
|
210
|
+
return { changes: this.changes };
|
|
211
|
+
const outcome = await syncPatient(this.#ctx.client, { demographic: query });
|
|
212
|
+
// Answered after a newer query was made: only a patient found (or added) still counts.
|
|
213
|
+
if (key !== this.#lastQuery && !(outcome.kind === "ok" && outcome.patient))
|
|
214
|
+
return { changes: this.changes };
|
|
215
|
+
if (outcome.kind === "ambiguous") {
|
|
216
|
+
this.patch({ candidates: outcome.candidates.map((c) => ({ ...c })), changes: noChanges });
|
|
217
|
+
return { changes: noChanges };
|
|
218
|
+
}
|
|
219
|
+
this.patch({ candidates: [] });
|
|
220
|
+
return this.#settle(outcome);
|
|
221
|
+
}).then((result) => this.#fillMissingContact(result));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Phone / email sent to help find the patient: once a sync or a pick gives the record, save the ones it
|
|
225
|
+
* doesn't have — fill in, never overwrite.
|
|
226
|
+
*/
|
|
227
|
+
async #fillMissingContact(result) {
|
|
228
|
+
const d = this.state?.demographic;
|
|
229
|
+
if (!this.id || !d)
|
|
230
|
+
return result;
|
|
231
|
+
const missing = {
|
|
232
|
+
...(this.#known.phone && !d.phone ? { phone: trimmed(this.#known.phone) } : {}),
|
|
233
|
+
...(this.#known.email && !d.email ? { email: trimmed(this.#known.email) } : {}),
|
|
234
|
+
};
|
|
235
|
+
this.#known = {};
|
|
236
|
+
return Object.keys(missing).length ? this.update({ demographic: missing }) : result;
|
|
237
|
+
}
|
|
238
|
+
/** A choice the server declared (one option, an exact match) or a clinical match it is sure of is taken without asking — once each. */
|
|
239
|
+
#takeDeclared(result) {
|
|
240
|
+
const option = declaredChoice(this.changes) ?? this.#clinicalMatch();
|
|
241
|
+
const key = option && optionKey(option);
|
|
242
|
+
if (!option || !key || this.#declared.has(key))
|
|
243
|
+
return result;
|
|
244
|
+
this.#declared.add(key);
|
|
245
|
+
return this.choose(option);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* An allergy, medication or diagnosis the server is sure of: its only option (a single row), or its one
|
|
249
|
+
* HIGH-confidence option ("callers may auto-resolve when HIGH"). Taken like a declared match.
|
|
250
|
+
*/
|
|
251
|
+
#clinicalMatch() {
|
|
252
|
+
for (const change of choicesIn(this.changes)) {
|
|
253
|
+
if (!/allergies|medications|diagnoses/.test(change.key))
|
|
254
|
+
continue;
|
|
255
|
+
const options = change.options.filter((o) => o.path);
|
|
256
|
+
const high = options.filter((o) => o.matchReasons.some((r) => r.confidence === "HIGH"));
|
|
257
|
+
if (options.length === 1)
|
|
258
|
+
return options[0];
|
|
259
|
+
if (high.length === 1)
|
|
260
|
+
return high[0];
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
/** What a write recorded: "none" for a list, or an entry on it (it isn't "none" any more). */
|
|
265
|
+
#noteNone(input) {
|
|
266
|
+
const patches = {
|
|
267
|
+
medications: input.clinical?.medications,
|
|
268
|
+
diagnoses: input.clinical?.diagnoses,
|
|
269
|
+
benefits: input.demographic?.benefits,
|
|
270
|
+
};
|
|
271
|
+
for (const [list, patch] of Object.entries(patches)) {
|
|
272
|
+
if (patch?.none)
|
|
273
|
+
this.#none.add(list);
|
|
274
|
+
if (patch?.add?.length)
|
|
275
|
+
this.#none.delete(list);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** The record with each list recorded as "none" here as `[]` (network-api answers those as nothing on file). */
|
|
279
|
+
#withNone(p) {
|
|
280
|
+
if (!this.#none.size)
|
|
281
|
+
return p;
|
|
282
|
+
const none = (list, name) => list ?? (this.#none.has(name) ? [] : null);
|
|
283
|
+
return {
|
|
284
|
+
...p,
|
|
285
|
+
demographic: p.demographic && { ...p.demographic, benefits: none(p.demographic.benefits, "benefits") },
|
|
286
|
+
clinical: p.clinical && {
|
|
287
|
+
...p.clinical,
|
|
288
|
+
medications: none(p.clinical.medications, "medications"),
|
|
289
|
+
diagnoses: none(p.clinical.diagnoses, "diagnoses"),
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/** An entry added from typed text can come back with name = id: label the one new entry per list with what was typed. */
|
|
294
|
+
#nameNewEntries(clinical, before) {
|
|
295
|
+
const typed = {
|
|
296
|
+
allergies: clinical.allergies?.add?.[0]?.name,
|
|
297
|
+
medications: clinical.medications?.add?.[0]?.name,
|
|
298
|
+
diagnoses: clinical.diagnoses?.add?.[0]?.name ?? clinical.diagnoses?.add?.[0]?.icd10Code,
|
|
299
|
+
};
|
|
300
|
+
const named = {};
|
|
301
|
+
for (const list of ["allergies", "medications", "diagnoses"]) {
|
|
302
|
+
const text = typed[list];
|
|
303
|
+
const added = (this.state?.clinical?.[list] ?? []).filter((e) => !before.has(e.id) && (!e.name || e.name === e.id));
|
|
304
|
+
if (text && added.length === 1)
|
|
305
|
+
named[added[0].id] = text;
|
|
306
|
+
}
|
|
307
|
+
if (Object.keys(named).length)
|
|
308
|
+
this.patch({ pickedNames: { ...named, ...this.snapshot.pickedNames } });
|
|
309
|
+
}
|
|
310
|
+
#settle(outcome) {
|
|
311
|
+
const changes = outcome.kind === "ok" ? toChanges(outcome.changes) : noChanges;
|
|
312
|
+
this.settle(outcome.kind === "ok" && outcome.patient ? toPatient(outcome.patient) : null, changes);
|
|
313
|
+
return { changes };
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=patient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patient.js","sourceRoot":"","sources":["../../src/photon/patient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAuB,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAA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AC;CACF"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type NetworkClient } from "../api/index.ts";
|
|
2
|
+
import { type LinkAuth, type PhotonAuth } from "./auth.ts";
|
|
3
|
+
import { type Session } from "./session.ts";
|
|
4
|
+
import { type EnvironmentUrls, type PhotonEnvironment } from "./environments.ts";
|
|
5
|
+
import { type FlowLink } from "./links.ts";
|
|
6
|
+
import { Order } from "./order.ts";
|
|
7
|
+
import { Patient } from "./patient.ts";
|
|
8
|
+
import { Prescription } from "./prescription.ts";
|
|
9
|
+
import type { Changes, OrderCandidate, OrderInput, PatientCandidate, PatientInput, PrescriptionCandidate, PrescriptionEdits, PrescriptionInput } from "./types.ts";
|
|
10
|
+
export { Order, Patient, Prescription };
|
|
11
|
+
/**
|
|
12
|
+
* Each call returns the live object. Without an id it always does — with its record when the server settled
|
|
13
|
+
* on one (found, created or updated), or still without one (`id: null`): then `candidates` says who it might
|
|
14
|
+
* be, or `changes` what's missing, and the object carries the same. `null` only for an id with no record.
|
|
15
|
+
*/
|
|
16
|
+
export interface PatientResult {
|
|
17
|
+
patient: Patient | null;
|
|
18
|
+
/** When the server isn't certain: who it might be (even one). Pick with `patient.pick(id)`. */
|
|
19
|
+
candidates: PatientCandidate[];
|
|
20
|
+
changes: Changes;
|
|
21
|
+
}
|
|
22
|
+
export interface PrescriptionResult {
|
|
23
|
+
prescription: Prescription | null;
|
|
24
|
+
/** The patient's in-progress prescriptions of this drug it could continue (`prescription.continueDraft(id)`). */
|
|
25
|
+
candidates: PrescriptionCandidate[];
|
|
26
|
+
changes: Changes;
|
|
27
|
+
}
|
|
28
|
+
export interface OrderResult {
|
|
29
|
+
order: Order | null;
|
|
30
|
+
/** The patient's draft orders it could be: open one with `ph.order({ id })`. */
|
|
31
|
+
candidates: OrderCandidate[];
|
|
32
|
+
changes: Changes;
|
|
33
|
+
}
|
|
34
|
+
/** Any live object, and its snapshot — for code that handles all three (an inspector, a logger). */
|
|
35
|
+
export type LiveObject = Patient | Prescription | Order;
|
|
36
|
+
export type PatientSnapshot = Patient["snapshot"];
|
|
37
|
+
export type PrescriptionSnapshot = Prescription["snapshot"];
|
|
38
|
+
export type OrderSnapshot = Order["snapshot"];
|
|
39
|
+
export type AnySnapshot = PatientSnapshot | PrescriptionSnapshot | OrderSnapshot;
|
|
40
|
+
export interface PhotonOptions {
|
|
41
|
+
/** Which Photon environment: every URL is inferred from it. Or pass `url`. */
|
|
42
|
+
environment?: PhotonEnvironment;
|
|
43
|
+
/** network-api's GraphQL endpoint, when not inferred from `environment`. */
|
|
44
|
+
url?: string;
|
|
45
|
+
auth: PhotonAuth;
|
|
46
|
+
/** How this caller is surfaced to network-api. Embeds: EMBEDDABLE_COMPONENT. */
|
|
47
|
+
source?: "WEB_APP" | "EMBEDDABLE_COMPONENT" | "DIRECT_API" | "LLM_AGENT" | "MCP_CONNECTOR";
|
|
48
|
+
/** Prefix for each request's client name ("photon-rx/SyncPatient"). */
|
|
49
|
+
clientName?: string;
|
|
50
|
+
sourceVersion?: string;
|
|
51
|
+
fetch?: typeof fetch;
|
|
52
|
+
/**
|
|
53
|
+
* Where the Photon Rx app is: `url()` and `frame()` links start with it. Unless said, the environment's
|
|
54
|
+
* (`rx.new` in production, `rx.<env>.health` otherwise); the app itself passes its own origin, so its links follow
|
|
55
|
+
* the domain it's served from. Without either (no `environment`), they're paths (`/order/…`).
|
|
56
|
+
*/
|
|
57
|
+
appUrl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The Photon organization (`org_…`) this instance is for, when the host knows it: `url()` and `frame()` links
|
|
60
|
+
* carry it, so the page they open signs straight in to it (no organization picker). An M2M client's is its
|
|
61
|
+
* `organizationId`.
|
|
62
|
+
*/
|
|
63
|
+
organization?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Link to a flow: a live object (its record), or what a flow is given. `.parse(href)` reads a link back. */
|
|
66
|
+
export interface LinkTo {
|
|
67
|
+
(target: LiveObject | FlowLink): string;
|
|
68
|
+
/** What an app link holds — the flow and what it's given — or null if it isn't one. */
|
|
69
|
+
parse(href: string): FlowLink | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One mutation's calls — the same three for each. `get` reads by id and changes nothing; `sync` sends whatever's
|
|
73
|
+
* known, an id or not, and the server finds, matches, creates or updates; `update` changes that one record.
|
|
74
|
+
* Calling it with an input is `sync`; with nothing, it's a new object before its record.
|
|
75
|
+
*/
|
|
76
|
+
export interface Calls<T, Input, Fields, Result> {
|
|
77
|
+
(): T;
|
|
78
|
+
(input: Input): Promise<Result>;
|
|
79
|
+
/** Id only: the object for that record, or null when there's none. Changes nothing. */
|
|
80
|
+
get(id: string): Promise<T | null>;
|
|
81
|
+
/** What's known — with an id or without: the server decides what it means. */
|
|
82
|
+
sync(input: Input): Promise<Result>;
|
|
83
|
+
/** That one record, by id: only the fields given change. */
|
|
84
|
+
update(id: string, fields: Fields): Promise<Result>;
|
|
85
|
+
/**
|
|
86
|
+
* The app's link to this flow, given Photon ids only: a record's (`"pat_…"` or `{ id }` → `/<flow>/<id>`), or a
|
|
87
|
+
* new one's (`{ templateId, patient: { id } }` → `/<flow>?patient=…&template=…`). Anything else — a patient's
|
|
88
|
+
* details, a drug's name, a sig — is refused: sync first, then link by id. Nothing is read or written.
|
|
89
|
+
*/
|
|
90
|
+
url(given?: Input | string): string;
|
|
91
|
+
/**
|
|
92
|
+
* The same, embeddable (`/<flow>/embed/…`): an iframe's `src`, signing the prescriber in with this instance's
|
|
93
|
+
* client id (`auth: { clientId }`). Throws without one, and for an M2M client.
|
|
94
|
+
*/
|
|
95
|
+
frame(given?: Input | string): string;
|
|
96
|
+
}
|
|
97
|
+
export interface Photon {
|
|
98
|
+
/** The environment's URLs, when created from one. */
|
|
99
|
+
readonly environment: EnvironmentUrls | null;
|
|
100
|
+
/**
|
|
101
|
+
* Patients. `sync({ demographic })` finds the patient, lists candidates, says what's missing, or creates one
|
|
102
|
+
* when nothing matches and it has enough. `ph.patient()`: a new patient to `sync` as the prescriber types.
|
|
103
|
+
*/
|
|
104
|
+
readonly patient: Calls<Patient, PatientInput, Omit<PatientInput, "id">, PatientResult>;
|
|
105
|
+
/**
|
|
106
|
+
* Prescriptions. `sync` without a patient is a drug lookup — the choices come back in `changes`; nothing is
|
|
107
|
+
* created. With a patient: created (or their in-progress one continued) once the drug is resolved. A signed
|
|
108
|
+
* prescription is final. `ph.prescription()`: a new line.
|
|
109
|
+
*/
|
|
110
|
+
readonly prescription: Calls<Prescription, PrescriptionInput, PrescriptionEdits, PrescriptionResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Orders. `sync({ patient, prescriptions })` saves the patient's draft order (or a new one) once the patient
|
|
113
|
+
* and a prescription have records. `ph.order()`: a new order to fill with `sync` (live objects, ids, or
|
|
114
|
+
* `{ templateId }` for a new line); its draft saves as it goes.
|
|
115
|
+
*/
|
|
116
|
+
readonly order: Calls<Order, OrderInput, Omit<OrderInput, "id" | "patient">, OrderResult>;
|
|
117
|
+
/**
|
|
118
|
+
* network-api's health check: resolves once it's reachable and accepts this instance's token. Throws
|
|
119
|
+
* `PhotonError` — `unauthorized` (a token it won't take), `network` (unreachable, or `getToken` threw),
|
|
120
|
+
* `upstream`. Changes nothing.
|
|
121
|
+
*/
|
|
122
|
+
ping(): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* The prescriber's sign-in, when core runs it (`auth: { clientId }`): a live object — `status`, `user`,
|
|
125
|
+
* `start()`, `signIn()`. Null when the host signs in (`auth: { getToken }`).
|
|
126
|
+
*/
|
|
127
|
+
readonly session: Session | null;
|
|
128
|
+
/**
|
|
129
|
+
* The Photon Rx app's link to a flow, to share — Photon ids only, in the clear: `/<flow>/<id>`, or
|
|
130
|
+
* `/<flow>?patient=…&template=…` (see links.ts) — on the app (`appUrl`, or the environment's). No client id: the
|
|
131
|
+
* app signs in with its own. A live object's: its record's id; before one, the ids it hangs off (a patient
|
|
132
|
+
* without a record is refused).
|
|
133
|
+
*/
|
|
134
|
+
readonly url: LinkTo;
|
|
135
|
+
/**
|
|
136
|
+
* The same, embeddable — `/<flow>/embed/…`, always zero chrome — for an iframe's `src`. The embed signs the
|
|
137
|
+
* prescriber in with the host's client id — the link's `auth.clientId`, or this instance's `{ clientId }` — and
|
|
138
|
+
* works only with one. Throws without one, and for an M2M client. Links carry no secret, ever.
|
|
139
|
+
*/
|
|
140
|
+
readonly frame: LinkTo;
|
|
141
|
+
}
|
|
142
|
+
export declare const clientOf: (ph: Photon) => NetworkClient;
|
|
143
|
+
export declare function photon(options: PhotonOptions): Photon;
|
|
144
|
+
/** A photon instance over an existing client (tests, and internal use). */
|
|
145
|
+
export declare function photonOver(client: NetworkClient, environment?: EnvironmentUrls | null, options?: {
|
|
146
|
+
appUrl?: string;
|
|
147
|
+
session?: Session | null;
|
|
148
|
+
linkAuth?: LinkAuth;
|
|
149
|
+
}): Photon;
|
|
150
|
+
//# sourceMappingURL=photon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"photon.d.ts","sourceRoot":"","sources":["../../src/photon/photon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAA2D,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACpH,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGpE,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,YAAY,EAEZ,qBAAqB,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