ezmedicationinput 0.1.43 → 0.1.44

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 (46) hide show
  1. package/README.md +4 -1
  2. package/dist/advice-rules.json +772 -0
  3. package/dist/advice-terminology.json +104 -0
  4. package/dist/advice.d.ts +16 -0
  5. package/dist/advice.js +1375 -0
  6. package/dist/event-trigger.d.ts +14 -0
  7. package/dist/event-trigger.js +501 -0
  8. package/dist/fhir-translations.d.ts +5 -0
  9. package/dist/fhir-translations.js +117 -0
  10. package/dist/fhir.d.ts +6 -4
  11. package/dist/fhir.js +566 -134
  12. package/dist/format.d.ts +4 -2
  13. package/dist/format.js +515 -218
  14. package/dist/i18n.d.ts +2 -2
  15. package/dist/i18n.js +641 -199
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js +219 -168
  18. package/dist/internal-types.d.ts +5 -5
  19. package/dist/ir.d.ts +4 -0
  20. package/dist/ir.js +178 -0
  21. package/dist/lexer/lex.d.ts +2 -0
  22. package/dist/lexer/lex.js +401 -0
  23. package/dist/lexer/meaning.d.ts +71 -0
  24. package/dist/lexer/meaning.js +619 -0
  25. package/dist/lexer/surface.d.ts +2 -0
  26. package/dist/lexer/surface.js +62 -0
  27. package/dist/lexer/token-types.d.ts +36 -0
  28. package/dist/lexer/token-types.js +19 -0
  29. package/dist/maps.d.ts +6 -12
  30. package/dist/maps.js +793 -247
  31. package/dist/parser-state.d.ts +101 -0
  32. package/dist/parser-state.js +441 -0
  33. package/dist/parser.d.ts +7 -7
  34. package/dist/parser.js +3598 -1974
  35. package/dist/prn.d.ts +4 -0
  36. package/dist/prn.js +59 -0
  37. package/dist/schedule.js +230 -32
  38. package/dist/site-phrases.d.ts +35 -0
  39. package/dist/site-phrases.js +344 -0
  40. package/dist/timing-summary.d.ts +13 -3
  41. package/dist/timing-summary.js +7 -7
  42. package/dist/types.d.ts +237 -32
  43. package/dist/types.js +49 -1
  44. package/dist/utils/text.d.ts +3 -0
  45. package/dist/utils/text.js +48 -0
  46. package/package.json +1 -1
package/dist/maps.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ADDITIONAL_INSTRUCTION_DEFINITIONS = exports.DEFAULT_ADDITIONAL_INSTRUCTION_ENTRIES = exports.DEFAULT_PRN_REASON_DEFINITIONS = exports.DEFAULT_PRN_REASON_ENTRIES = exports.DEFAULT_UNIT_BY_ROUTE = exports.DEFAULT_UNIT_BY_NORMALIZED_FORM = exports.KNOWN_TMT_DOSAGE_FORM_TO_SNOMED_ROUTE = exports.KNOWN_DOSAGE_FORMS_TO_DOSE = exports.WORD_FREQUENCIES = exports.DAY_OF_WEEK_TOKENS = exports.DISCOURAGED_TOKENS = exports.MEAL_KEYWORDS = exports.EVENT_TIMING_TOKENS = exports.TIMING_ABBREVIATIONS = exports.DEFAULT_UNIT_SYNONYMS = exports.HOUSEHOLD_VOLUME_UNITS = exports.DEFAULT_BODY_SITE_SNOMED = exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = exports.DEFAULT_ROUTE_SYNONYMS = exports.ROUTE_BY_SNOMED = exports.ROUTE_TEXT = exports.ROUTE_SNOMED = void 0;
3
+ exports.DEFAULT_PRN_REASON_DEFINITIONS = exports.DEFAULT_PRN_REASON_ENTRIES = exports.DEFAULT_UNIT_BY_ROUTE = exports.DEFAULT_UNIT_BY_NORMALIZED_FORM = exports.KNOWN_TMT_DOSAGE_FORM_TO_SNOMED_ROUTE = exports.KNOWN_DOSAGE_FORMS_TO_DOSE = exports.WORD_FREQUENCIES = exports.DAY_OF_WEEK_TOKENS = exports.DISCOURAGED_TOKENS = exports.MEAL_KEYWORDS = exports.EVENT_TIMING_TOKENS = exports.TIMING_ABBREVIATIONS = exports.PRODUCT_FORM_HINTS = exports.DEFAULT_UNIT_SYNONYMS = exports.HOUSEHOLD_VOLUME_UNITS = exports.DEFAULT_BODY_SITE_HINTS = exports.DEFAULT_BODY_SITE_SNOMED = exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = exports.DEFAULT_ROUTE_SYNONYMS = exports.ROUTE_BY_SNOMED = exports.ROUTE_TEXT = exports.ROUTE_SNOMED = void 0;
4
4
  exports.normalizeBodySiteKey = normalizeBodySiteKey;
5
5
  exports.normalizePrnReasonKey = normalizePrnReasonKey;
6
6
  exports.normalizeAdditionalInstructionKey = normalizeAdditionalInstructionKey;
7
7
  exports.findPrnReasonDefinitionByCoding = findPrnReasonDefinitionByCoding;
8
- exports.findAdditionalInstructionDefinitionByCoding = findAdditionalInstructionDefinitionByCoding;
9
8
  const types_1 = require("./types");
10
9
  const object_1 = require("./utils/object");
10
+ const text_1 = require("./utils/text");
11
11
  const SNOMED_SYSTEM = "http://snomed.info/sct";
12
12
  const ROUTE_TEXT_OVERRIDES = {
13
13
  [types_1.RouteCode["Oral route"]]: "by mouth",
@@ -179,86 +179,99 @@ exports.DEFAULT_ROUTE_SYNONYMS = (() => {
179
179
  * same logic to ensure consistent lookups.
180
180
  */
181
181
  function normalizeBodySiteKey(value) {
182
- return value
183
- .trim()
184
- .toLowerCase()
185
- .replace(/[^\p{L}\p{N}]+/gu, " ")
186
- .replace(/\s+/g, " ")
187
- .trim();
182
+ return (0, text_1.normalizeLoosePhraseKey)(value);
188
183
  }
189
184
  exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = [
190
185
  {
191
186
  names: ["eye", "eyes"],
192
- definition: { coding: { code: "81745001", display: "Eye" } }
187
+ definition: {
188
+ coding: { code: "81745001", display: "Eye" },
189
+ routeHint: types_1.RouteCode["Ophthalmic route"]
190
+ }
193
191
  },
194
192
  {
195
193
  names: ["left eye"],
196
194
  definition: {
197
- coding: { code: "1290031003", display: "Structure of left eye proper" }
195
+ coding: { code: "1290031003", display: "Structure of left eye proper" },
196
+ routeHint: types_1.RouteCode["Ophthalmic route"]
198
197
  }
199
198
  },
200
199
  {
201
200
  names: ["right eye"],
202
201
  definition: {
203
- coding: { code: "1290032005", display: "Structure of right eye proper" }
202
+ coding: { code: "1290032005", display: "Structure of right eye proper" },
203
+ routeHint: types_1.RouteCode["Ophthalmic route"]
204
204
  }
205
205
  },
206
206
  {
207
207
  names: ["both eyes", "bilateral eyes"],
208
- definition: { coding: { code: "40638003", display: "Structure of both eyes" } }
208
+ definition: {
209
+ coding: { code: "40638003", display: "Structure of both eyes" },
210
+ routeHint: types_1.RouteCode["Ophthalmic route"]
211
+ }
209
212
  },
210
213
  {
211
214
  names: ["ear", "ears"],
212
- definition: { coding: { code: "117590005", display: "Ear-related structure" } }
215
+ definition: {
216
+ coding: { code: "117590005", display: "Ear-related structure" },
217
+ routeHint: types_1.RouteCode["Otic route"]
218
+ }
213
219
  },
214
220
  {
215
221
  names: ["left ear"],
216
- definition: { coding: { code: "89644007", display: "Left ear" } }
222
+ definition: { coding: { code: "89644007", display: "Left ear" }, routeHint: types_1.RouteCode["Otic route"] }
217
223
  },
218
224
  {
219
225
  names: ["right ear"],
220
- definition: { coding: { code: "25577004", display: "Right ear" } }
226
+ definition: { coding: { code: "25577004", display: "Right ear" }, routeHint: types_1.RouteCode["Otic route"] }
221
227
  },
222
228
  {
223
229
  names: ["both ears", "bilateral ears"],
224
- definition: { coding: { code: "34338003", display: "Both ears" } }
230
+ definition: { coding: { code: "34338003", display: "Both ears" }, routeHint: types_1.RouteCode["Otic route"] }
225
231
  },
226
232
  {
227
233
  names: ["nostril", "nostrils"],
228
- definition: { coding: { code: "1797002", display: "Naris" } }
234
+ definition: { coding: { code: "1797002", display: "Naris" }, routeHint: types_1.RouteCode["Nasal route"] }
229
235
  },
230
236
  {
231
237
  names: ["left nostril", "left naris"],
232
238
  definition: {
233
- coding: { code: "723608007", display: "Structure of left anterior naris" }
239
+ coding: { code: "723608007", display: "Structure of left anterior naris" },
240
+ routeHint: types_1.RouteCode["Nasal route"]
234
241
  }
235
242
  },
236
243
  {
237
244
  names: ["right nostril", "right naris"],
238
245
  definition: {
239
- coding: { code: "723609004", display: "Structure of right anterior naris" }
246
+ coding: { code: "723609004", display: "Structure of right anterior naris" },
247
+ routeHint: types_1.RouteCode["Nasal route"]
240
248
  }
241
249
  },
242
250
  {
243
251
  names: ["nares", "anterior nares"],
244
- definition: { coding: { code: "244506005", display: "Anterior nares" } }
252
+ definition: { coding: { code: "244506005", display: "Anterior nares" }, routeHint: types_1.RouteCode["Nasal route"] }
245
253
  },
246
254
  {
247
255
  names: ["nose"],
248
- definition: { coding: { code: "181195007", display: "Entire nose" } }
256
+ definition: { coding: { code: "181195007", display: "Entire nose" }, routeHint: types_1.RouteCode["Nasal route"] }
249
257
  },
250
258
  {
251
259
  names: ["mouth"],
252
- definition: { coding: { code: "123851003", display: "Mouth region" } }
260
+ definition: { coding: { code: "123851003", display: "Mouth region" }, routeHint: types_1.RouteCode["Oral route"] }
253
261
  },
254
262
  {
255
263
  names: ["tongue", "tongues"],
256
- definition: { coding: { code: "21974007", display: "Tongue" } }
264
+ definition: { coding: { code: "21974007", display: "Tongue" }, routeHint: types_1.RouteCode["Sublingual route"] }
265
+ },
266
+ {
267
+ names: ["lip", "lips"],
268
+ definition: { coding: { code: "48477009", display: "Lip structure" }, routeHint: types_1.RouteCode["Topical route"] }
257
269
  },
258
270
  {
259
271
  names: ["cheek", "cheeks"],
260
272
  definition: {
261
- coding: { code: "60819002", display: "Buccal region of face" }
273
+ coding: { code: "60819002", display: "Buccal region of face" },
274
+ routeHint: types_1.RouteCode["Buccal route"]
262
275
  }
263
276
  },
264
277
  {
@@ -267,120 +280,271 @@ exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = [
267
280
  coding: {
268
281
  code: "362116001",
269
282
  display: "Entire gum and supporting structure of tooth"
270
- }
283
+ },
284
+ routeHint: types_1.RouteCode["Topical route"]
271
285
  }
272
286
  },
273
287
  {
274
288
  names: ["tooth"],
275
- definition: { coding: { code: "38199008", display: "Tooth" } }
289
+ definition: { coding: { code: "38199008", display: "Tooth" }, routeHint: types_1.RouteCode["Topical route"] }
276
290
  },
277
291
  {
278
292
  names: ["teeth"],
279
- definition: { coding: { code: "1162715001", display: "All teeth" } }
293
+ definition: { coding: { code: "1162715001", display: "All teeth" }, routeHint: types_1.RouteCode["Topical route"] }
280
294
  },
281
295
  {
282
296
  names: ["arm", "upper arm"],
283
- definition: { coding: { code: "302538001", display: "Entire upper arm" } }
297
+ definition: { coding: { code: "302538001", display: "Entire upper arm" }, routeHint: types_1.RouteCode["Topical route"] }
284
298
  },
285
299
  {
286
300
  names: ["left arm", "left upper arm"],
287
301
  definition: {
288
- coding: { code: "368208006", display: "Left upper arm structure" }
302
+ coding: { code: "368208006", display: "Left upper arm structure" },
303
+ routeHint: types_1.RouteCode["Topical route"]
289
304
  }
290
305
  },
291
306
  {
292
307
  names: ["right arm", "right upper arm"],
293
- definition: { coding: { code: "368209003", display: "Right upper arm" } }
308
+ definition: { coding: { code: "368209003", display: "Right upper arm" }, routeHint: types_1.RouteCode["Topical route"] }
294
309
  },
295
310
  {
296
311
  names: ["both arms", "bilateral arms"],
297
- definition: { coding: { code: "69273007", display: "Both arms" } }
312
+ definition: { coding: { code: "69273007", display: "Both arms" }, routeHint: types_1.RouteCode["Topical route"] }
313
+ },
314
+ {
315
+ names: ["shoulder", "shoulders"],
316
+ definition: { coding: { code: "16982005", display: "Shoulder region structure" }, routeHint: types_1.RouteCode["Topical route"] }
317
+ },
318
+ {
319
+ names: ["left shoulder"],
320
+ definition: { coding: { code: "91775009", display: "Left shoulder" }, routeHint: types_1.RouteCode["Topical route"] }
321
+ },
322
+ {
323
+ names: ["right shoulder"],
324
+ definition: { coding: { code: "91774008", display: "Right shoulder" }, routeHint: types_1.RouteCode["Topical route"] }
298
325
  },
299
326
  {
300
327
  names: ["forearm"],
301
- definition: { coding: { code: "14975008", display: "Forearm" } }
328
+ definition: { coding: { code: "14975008", display: "Forearm" }, routeHint: types_1.RouteCode["Topical route"] }
302
329
  },
303
330
  {
304
331
  names: ["left forearm"],
305
- definition: { coding: { code: "66480008", display: "Left forearm" } }
332
+ definition: { coding: { code: "66480008", display: "Left forearm" }, routeHint: types_1.RouteCode["Topical route"] }
306
333
  },
307
334
  {
308
335
  names: ["right forearm"],
309
- definition: { coding: { code: "64262003", display: "Right forearm" } }
336
+ definition: { coding: { code: "64262003", display: "Right forearm" }, routeHint: types_1.RouteCode["Topical route"] }
337
+ },
338
+ {
339
+ names: ["elbow"],
340
+ definition: { coding: { code: "127949000", display: "Elbow region structure" }, routeHint: types_1.RouteCode["Topical route"] }
341
+ },
342
+ {
343
+ names: ["left elbow"],
344
+ definition: { coding: { code: "368148009", display: "Left elbow" }, routeHint: types_1.RouteCode["Topical route"] }
345
+ },
346
+ {
347
+ names: ["right elbow"],
348
+ definition: { coding: { code: "368149001", display: "Right elbow" }, routeHint: types_1.RouteCode["Topical route"] }
310
349
  },
311
350
  {
312
351
  names: ["leg", "lower leg"],
313
352
  definition: {
314
- coding: { code: "362793004", display: "Entire lower leg, from knee to ankle" }
353
+ coding: { code: "362793004", display: "Entire lower leg, from knee to ankle" },
354
+ routeHint: types_1.RouteCode["Topical route"]
315
355
  }
316
356
  },
317
357
  {
318
358
  names: ["left leg", "left lower leg"],
319
- definition: { coding: { code: "213384005", display: "Entire left lower leg" } }
359
+ definition: { coding: { code: "213384005", display: "Entire left lower leg" }, routeHint: types_1.RouteCode["Topical route"] }
320
360
  },
321
361
  {
322
362
  names: ["right leg", "right lower leg"],
323
- definition: { coding: { code: "213289002", display: "Entire right lower leg" } }
363
+ definition: { coding: { code: "213289002", display: "Entire right lower leg" }, routeHint: types_1.RouteCode["Topical route"] }
324
364
  },
325
365
  {
326
366
  names: ["both legs", "bilateral legs"],
327
- definition: { coding: { code: "40927001", display: "Both legs" } }
367
+ definition: { coding: { code: "40927001", display: "Both legs" }, routeHint: types_1.RouteCode["Topical route"] }
328
368
  },
329
369
  {
330
370
  names: ["thigh"],
331
- definition: { coding: { code: "68367000", display: "Thigh" } }
371
+ definition: { coding: { code: "68367000", display: "Thigh" }, routeHint: types_1.RouteCode["Topical route"] }
332
372
  },
333
373
  {
334
374
  names: ["left thigh"],
335
- definition: { coding: { code: "61396006", display: "Left thigh" } }
375
+ definition: { coding: { code: "61396006", display: "Left thigh" }, routeHint: types_1.RouteCode["Topical route"] }
336
376
  },
337
377
  {
338
378
  names: ["right thigh"],
339
- definition: { coding: { code: "11207009", display: "Right thigh" } }
379
+ definition: { coding: { code: "11207009", display: "Right thigh" }, routeHint: types_1.RouteCode["Topical route"] }
380
+ },
381
+ {
382
+ names: ["knee"],
383
+ definition: { coding: { code: "72696002", display: "Knee region structure" }, routeHint: types_1.RouteCode["Topical route"] }
384
+ },
385
+ {
386
+ names: ["left knee"],
387
+ definition: { coding: { code: "82169009", display: "Left knee" }, routeHint: types_1.RouteCode["Topical route"] }
388
+ },
389
+ {
390
+ names: ["right knee"],
391
+ definition: { coding: { code: "6757004", display: "Right knee" }, routeHint: types_1.RouteCode["Topical route"] }
392
+ },
393
+ {
394
+ names: ["both knees", "bilateral knees"],
395
+ definition: { coding: { code: "36701003", display: "Both knees" }, routeHint: types_1.RouteCode["Topical route"] }
396
+ },
397
+ {
398
+ names: ["wrist"],
399
+ definition: { coding: { code: "8205005", display: "Wrist region structure" }, routeHint: types_1.RouteCode["Topical route"] }
400
+ },
401
+ {
402
+ names: ["left wrist"],
403
+ definition: { coding: { code: "5951000", display: "Structure of left wrist" }, routeHint: types_1.RouteCode["Topical route"] }
404
+ },
405
+ {
406
+ names: ["right wrist"],
407
+ definition: { coding: { code: "9736006", display: "Structure of right wrist" }, routeHint: types_1.RouteCode["Topical route"] }
408
+ },
409
+ {
410
+ names: ["ankle"],
411
+ definition: { coding: { code: "344001", display: "Ankle region structure" }, routeHint: types_1.RouteCode["Topical route"] }
412
+ },
413
+ {
414
+ names: ["left ankle"],
415
+ definition: { coding: { code: "51636004", display: "Structure of left ankle" }, routeHint: types_1.RouteCode["Topical route"] }
416
+ },
417
+ {
418
+ names: ["right ankle"],
419
+ definition: { coding: { code: "6685009", display: "Structure of right ankle" }, routeHint: types_1.RouteCode["Topical route"] }
420
+ },
421
+ {
422
+ names: ["both ankles", "bilateral ankles"],
423
+ definition: { coding: { code: "69948000", display: "Both ankles" }, routeHint: types_1.RouteCode["Topical route"] }
424
+ },
425
+ {
426
+ names: ["hip"],
427
+ definition: { coding: { code: "29836001", display: "Hip region structure" }, routeHint: types_1.RouteCode["Topical route"] }
428
+ },
429
+ {
430
+ names: ["left hip"],
431
+ definition: { coding: { code: "287679003", display: "Left hip" }, routeHint: types_1.RouteCode["Topical route"] }
432
+ },
433
+ {
434
+ names: ["right hip"],
435
+ definition: { coding: { code: "287579007", display: "Right hip" }, routeHint: types_1.RouteCode["Topical route"] }
340
436
  },
341
437
  {
342
438
  names: ["hand", "hands"],
343
- definition: { coding: { code: "85562004", display: "Hand" } }
439
+ definition: { coding: { code: "85562004", display: "Hand" }, routeHint: types_1.RouteCode["Topical route"] }
344
440
  },
345
441
  {
346
442
  names: ["left hand"],
347
- definition: { coding: { code: "85151006", display: "Left hand" } }
443
+ definition: { coding: { code: "85151006", display: "Left hand" }, routeHint: types_1.RouteCode["Topical route"] }
348
444
  },
349
445
  {
350
446
  names: ["right hand"],
351
- definition: { coding: { code: "78791008", display: "Right hand" } }
447
+ definition: { coding: { code: "78791008", display: "Right hand" }, routeHint: types_1.RouteCode["Topical route"] }
352
448
  },
353
449
  {
354
450
  names: ["foot", "feet"],
355
- definition: { coding: { code: "56459004", display: "Foot" } }
451
+ definition: { coding: { code: "56459004", display: "Foot" }, routeHint: types_1.RouteCode["Topical route"] }
356
452
  },
357
453
  {
358
454
  names: ["left foot"],
359
- definition: { coding: { code: "22335008", display: "Left foot" } }
455
+ definition: { coding: { code: "22335008", display: "Left foot" }, routeHint: types_1.RouteCode["Topical route"] }
360
456
  },
361
457
  {
362
458
  names: ["right foot"],
363
- definition: { coding: { code: "7769000", display: "Right foot" } }
459
+ definition: { coding: { code: "7769000", display: "Right foot" }, routeHint: types_1.RouteCode["Topical route"] }
364
460
  },
365
461
  {
366
462
  names: ["abdomen", "abdominal", "belly"],
367
- definition: { coding: { code: "302553009", display: "Entire abdomen" } }
463
+ definition: { coding: { code: "302553009", display: "Entire abdomen" }, routeHint: types_1.RouteCode["Subcutaneous route"] }
464
+ },
465
+ {
466
+ names: ["head"],
467
+ definition: { coding: { code: "69536005", display: "Head structure" }, routeHint: types_1.RouteCode["Topical route"] }
468
+ },
469
+ {
470
+ names: ["affected area", "affected areas", "affected site", "บริเวณที่เป็น"],
471
+ definition: { text: "affected area", routeHint: types_1.RouteCode["Topical route"] }
472
+ },
473
+ {
474
+ names: ["left head", "left side of head"],
475
+ definition: { coding: { code: "64237003", display: "Structure of left half of head" }, routeHint: types_1.RouteCode["Topical route"] }
476
+ },
477
+ {
478
+ names: ["right head", "right side of head"],
479
+ definition: { coding: { code: "29624005", display: "Structure of right half of head" }, routeHint: types_1.RouteCode["Topical route"] }
368
480
  },
369
481
  {
370
482
  names: ["back"],
371
- definition: { coding: { code: "77568009", display: "Back" } }
483
+ definition: { coding: { code: "77568009", display: "Back" }, routeHint: types_1.RouteCode["Topical route"] }
484
+ },
485
+ {
486
+ names: ["chest"],
487
+ definition: { coding: { code: "51185008", display: "Thoracic structure" }, routeHint: types_1.RouteCode["Topical route"] }
488
+ },
489
+ {
490
+ names: ["chest wall"],
491
+ definition: { coding: { code: "78904004", display: "Chest wall structure" }, routeHint: types_1.RouteCode["Topical route"] }
492
+ },
493
+ {
494
+ names: ["breast"],
495
+ definition: { coding: { code: "76752008", display: "Breast structure" }, routeHint: types_1.RouteCode["Topical route"] }
496
+ },
497
+ {
498
+ names: ["left breast"],
499
+ definition: { coding: { code: "80248007", display: "Left breast" }, routeHint: types_1.RouteCode["Topical route"] }
500
+ },
501
+ {
502
+ names: ["right breast"],
503
+ definition: { coding: { code: "73056007", display: "Right breast" }, routeHint: types_1.RouteCode["Topical route"] }
504
+ },
505
+ {
506
+ names: ["both breasts", "bilateral breasts"],
507
+ definition: { coding: { code: "63762007", display: "Both breasts" }, routeHint: types_1.RouteCode["Topical route"] }
508
+ },
509
+ {
510
+ names: ["axilla", "axillae", "armpit", "armpits"],
511
+ definition: { coding: { code: "34797008", display: "Axilla structure" }, routeHint: types_1.RouteCode["Topical route"] }
512
+ },
513
+ {
514
+ names: ["groin"],
515
+ definition: { coding: { code: "26893007", display: "Inguinal region structure" }, routeHint: types_1.RouteCode["Topical route"] }
372
516
  },
373
517
  {
374
518
  names: ["scalp"],
375
- definition: { coding: { code: "41695006", display: "Scalp" } }
519
+ definition: { coding: { code: "41695006", display: "Scalp" }, routeHint: types_1.RouteCode["Topical route"] }
376
520
  },
377
521
  {
378
522
  names: ["face"],
379
- definition: { coding: { code: "89545001", display: "Face" } }
523
+ definition: { coding: { code: "89545001", display: "Face" }, routeHint: types_1.RouteCode["Topical route"] }
524
+ },
525
+ {
526
+ names: ["eyelid", "eyelids"],
527
+ definition: { coding: { code: "80243003", display: "Eyelid" }, routeHint: types_1.RouteCode["Ophthalmic route"] }
380
528
  },
381
529
  {
382
530
  names: ["forehead"],
383
- definition: { coding: { code: "52795006", display: "Forehead" } }
531
+ definition: { coding: { code: "52795006", display: "Forehead" }, routeHint: types_1.RouteCode["Topical route"] }
532
+ },
533
+ {
534
+ names: ["temple", "temple region", "temporal region"],
535
+ definition: { coding: { code: "450721000", display: "Temple region structure" }, routeHint: types_1.RouteCode["Topical route"] }
536
+ },
537
+ {
538
+ names: ["temples", "both temples", "bilateral temples"],
539
+ definition: { coding: { code: "362620003", display: "Entire temporal region" }, routeHint: types_1.RouteCode["Topical route"] }
540
+ },
541
+ {
542
+ names: ["left temple", "left temple region", "left temporal region"],
543
+ definition: { coding: { code: "1373280005", display: "Left temple region" }, routeHint: types_1.RouteCode["Topical route"] }
544
+ },
545
+ {
546
+ names: ["right temple", "right temple region", "right temporal region"],
547
+ definition: { coding: { code: "1373281009", display: "Right temple region" }, routeHint: types_1.RouteCode["Topical route"] }
384
548
  },
385
549
  {
386
550
  names: ["chin"],
@@ -388,24 +552,25 @@ exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = [
388
552
  coding: {
389
553
  code: "897081006",
390
554
  display: "Skin and/or subcutaneous tissue of chin"
391
- }
555
+ },
556
+ routeHint: types_1.RouteCode["Topical route"]
392
557
  }
393
558
  },
394
559
  {
395
560
  names: ["neck"],
396
- definition: { coding: { code: "45048000", display: "Neck" } }
561
+ definition: { coding: { code: "45048000", display: "Neck" }, routeHint: types_1.RouteCode["Topical route"] }
397
562
  },
398
563
  {
399
564
  names: ["buttock", "buttocks", "gluteal", "glute"],
400
- definition: { coding: { code: "46862004", display: "Buttock" } }
565
+ definition: { coding: { code: "46862004", display: "Buttock" }, routeHint: types_1.RouteCode["Intramuscular route"] }
401
566
  },
402
567
  {
403
568
  names: ["left buttock", "left gluteal"],
404
- definition: { coding: { code: "723979003", display: "Structure of left buttock" } }
569
+ definition: { coding: { code: "723979003", display: "Structure of left buttock" }, routeHint: types_1.RouteCode["Intramuscular route"] }
405
570
  },
406
571
  {
407
572
  names: ["right buttock", "right gluteal"],
408
- definition: { coding: { code: "723980000", display: "Structure of right buttock" } }
573
+ definition: { coding: { code: "723980000", display: "Structure of right buttock" }, routeHint: types_1.RouteCode["Intramuscular route"] }
409
574
  },
410
575
  {
411
576
  names: ["muscle", "muscles"],
@@ -413,41 +578,43 @@ exports.DEFAULT_BODY_SITE_SNOMED_SOURCE = [
413
578
  coding: {
414
579
  code: "362876008",
415
580
  display: "All skeletal and smooth muscles of the body"
416
- }
581
+ },
582
+ routeHint: types_1.RouteCode["Intramuscular route"]
417
583
  }
418
584
  },
419
585
  {
420
586
  names: ["vein", "veins"],
421
- definition: { coding: { code: "181367001", display: "Entire vein" } }
587
+ definition: { coding: { code: "181367001", display: "Entire vein" }, routeHint: types_1.RouteCode["Intravenous route"] }
422
588
  },
423
589
  {
424
590
  names: ["vagina", "vaginal"],
425
- definition: { coding: { code: "76784001", display: "Vagina" } }
591
+ definition: { coding: { code: "76784001", display: "Vagina" }, routeHint: types_1.RouteCode["Per vagina"] }
426
592
  },
427
593
  {
428
594
  names: ["penis", "penile"],
429
- definition: { coding: { code: "18911002", display: "Penis structure" } }
595
+ definition: { coding: { code: "18911002", display: "Penis structure" }, routeHint: types_1.RouteCode["Topical route"] }
430
596
  },
431
597
  {
432
598
  names: ["rectum", "rectal"],
433
- definition: { coding: { code: "34402009", display: "Rectum" } }
599
+ definition: { coding: { code: "34402009", display: "Rectum" }, routeHint: types_1.RouteCode["Per rectum"] }
434
600
  },
435
601
  {
436
602
  names: ["anus"],
437
- definition: { coding: { code: "181262009", display: "Entire anus" } }
603
+ definition: { coding: { code: "181262009", display: "Entire anus" }, routeHint: types_1.RouteCode["Per rectum"] }
438
604
  },
439
605
  {
440
606
  names: ["perineum"],
441
- definition: { coding: { code: "243990009", display: "Entire perineum" } }
607
+ definition: { coding: { code: "243990009", display: "Entire perineum" }, routeHint: types_1.RouteCode["Topical route"] }
442
608
  },
443
609
  {
444
610
  names: ["skin"],
445
- definition: { coding: { code: "181469002", display: "Entire skin" } }
611
+ definition: { coding: { code: "181469002", display: "Entire skin" }, routeHint: types_1.RouteCode["Topical route"] }
446
612
  },
447
613
  {
448
614
  names: ["hair"],
449
615
  definition: {
450
- coding: { code: "386045008", display: "Hair structure (body structure)" }
616
+ coding: { code: "386045008", display: "Hair structure (body structure)" },
617
+ routeHint: types_1.RouteCode["Topical route"]
451
618
  }
452
619
  }
453
620
  ];
@@ -462,6 +629,29 @@ exports.DEFAULT_BODY_SITE_SNOMED = (0, object_1.objectFromEntries)(exports.DEFAU
462
629
  }
463
630
  return entries;
464
631
  }, []));
632
+ exports.DEFAULT_BODY_SITE_HINTS = (() => {
633
+ const hints = new Set();
634
+ const addPhrase = (phrase) => {
635
+ const normalized = normalizeBodySiteKey(phrase !== null && phrase !== void 0 ? phrase : "");
636
+ if (!normalized) {
637
+ return;
638
+ }
639
+ for (const part of normalized.split(" ")) {
640
+ if (part) {
641
+ hints.add(part);
642
+ }
643
+ }
644
+ };
645
+ for (const [key, definition] of (0, object_1.objectEntries)(exports.DEFAULT_BODY_SITE_SNOMED)) {
646
+ addPhrase(key);
647
+ if (definition.aliases) {
648
+ for (const alias of definition.aliases) {
649
+ addPhrase(alias);
650
+ }
651
+ }
652
+ }
653
+ return hints;
654
+ })();
465
655
  const UNIT_PREFIXES = [
466
656
  { canonical: "", abbreviations: [""], names: [{ singular: "", plural: "" }] },
467
657
  {
@@ -569,6 +759,19 @@ const STATIC_UNIT_SYNONYMS = {
569
759
  sprays: "spray",
570
760
  drop: "drop",
571
761
  drops: "drop",
762
+ pump: "pump",
763
+ pumps: "pump",
764
+ squeeze: "squeeze",
765
+ squeezes: "squeeze",
766
+ applicatorful: "applicatorful",
767
+ applicatorfuls: "applicatorful",
768
+ capful: "capful",
769
+ capfuls: "capful",
770
+ scoop: "scoop",
771
+ scoops: "scoop",
772
+ application: "application",
773
+ applications: "application",
774
+ ribbon: "ribbon",
572
775
  patch: "patch",
573
776
  patches: "patch",
574
777
  supp: "suppository",
@@ -592,6 +795,27 @@ exports.DEFAULT_UNIT_SYNONYMS = (() => {
592
795
  addMetricUnitSynonyms(map);
593
796
  return map;
594
797
  })();
798
+ exports.PRODUCT_FORM_HINTS = {
799
+ cream: { routeHint: types_1.RouteCode["Topical route"] },
800
+ ointment: { routeHint: types_1.RouteCode["Topical route"] },
801
+ gel: { routeHint: types_1.RouteCode["Topical route"] },
802
+ lotion: { routeHint: types_1.RouteCode["Topical route"] },
803
+ serum: { routeHint: types_1.RouteCode["Topical route"] },
804
+ toner: { routeHint: types_1.RouteCode["Topical route"] },
805
+ moisturizer: { routeHint: types_1.RouteCode["Topical route"] },
806
+ shampoo: { routeHint: types_1.RouteCode["Topical route"] },
807
+ sunscreen: { routeHint: types_1.RouteCode["Topical route"] },
808
+ deodorant: { routeHint: types_1.RouteCode["Topical route"] },
809
+ cleanser: { routeHint: types_1.RouteCode["Topical route"] },
810
+ "face wash": { routeHint: types_1.RouteCode["Topical route"] },
811
+ "body wash": { routeHint: types_1.RouteCode["Topical route"] },
812
+ "body lotion": { routeHint: types_1.RouteCode["Topical route"] },
813
+ "lip balm": { routeHint: types_1.RouteCode["Topical route"] },
814
+ "spot treatment": { routeHint: types_1.RouteCode["Topical route"] },
815
+ "makeup remover": { routeHint: types_1.RouteCode["Topical route"] },
816
+ balm: { routeHint: types_1.RouteCode["Topical route"] },
817
+ foam: { routeHint: types_1.RouteCode["Topical route"] }
818
+ };
595
819
  exports.TIMING_ABBREVIATIONS = {
596
820
  qd: {
597
821
  code: "QD",
@@ -661,7 +885,9 @@ exports.TIMING_ABBREVIATIONS = {
661
885
  mo: { code: "MO", period: 1, periodUnit: types_1.FhirPeriodUnit.Month },
662
886
  monthly: { code: "MO", period: 1, periodUnit: types_1.FhirPeriodUnit.Month },
663
887
  am: { code: "AM", when: [types_1.EventTiming.Morning] },
664
- pm: { code: "PM", when: [types_1.EventTiming.Evening] }
888
+ pm: { code: "PM", when: [types_1.EventTiming.Evening] },
889
+ qam: { code: "QAM", when: [types_1.EventTiming.Morning] },
890
+ qpm: { code: "QPM", when: [types_1.EventTiming.Evening] }
665
891
  };
666
892
  exports.EVENT_TIMING_TOKENS = {
667
893
  ac: types_1.EventTiming["Before Meal"],
@@ -708,8 +934,11 @@ exports.EVENT_TIMING_TOKENS = {
708
934
  afternoon: types_1.EventTiming.Afternoon,
709
935
  aft: types_1.EventTiming.Afternoon,
710
936
  pm: types_1.EventTiming.Evening,
937
+ qam: types_1.EventTiming.Morning,
938
+ qpm: types_1.EventTiming.Evening,
711
939
  evening: types_1.EventTiming.Evening,
712
940
  night: types_1.EventTiming.Night,
941
+ nightly: types_1.EventTiming.Night,
713
942
  hs: types_1.EventTiming["Before Sleep"],
714
943
  bedtime: types_1.EventTiming["Before Sleep"],
715
944
  bed: types_1.EventTiming["Before Sleep"],
@@ -793,7 +1022,6 @@ exports.DAY_OF_WEEK_TOKENS = {
793
1022
  exports.WORD_FREQUENCIES = {
794
1023
  daily: { frequency: 1, periodUnit: types_1.FhirPeriodUnit.Day },
795
1024
  "once daily": { frequency: 1, periodUnit: types_1.FhirPeriodUnit.Day },
796
- once: { frequency: 1, periodUnit: types_1.FhirPeriodUnit.Day },
797
1025
  twice: { frequency: 2, periodUnit: types_1.FhirPeriodUnit.Day },
798
1026
  "twice daily": { frequency: 2, periodUnit: types_1.FhirPeriodUnit.Day },
799
1027
  "three times": { frequency: 3, periodUnit: types_1.FhirPeriodUnit.Day },
@@ -1309,20 +1537,10 @@ exports.DEFAULT_UNIT_BY_ROUTE = (() => {
1309
1537
  return resolved;
1310
1538
  })();
1311
1539
  function normalizePrnReasonKey(value) {
1312
- return value
1313
- .trim()
1314
- .toLowerCase()
1315
- .replace(/[^\p{L}\p{N}]+/gu, " ")
1316
- .replace(/\s+/g, " ")
1317
- .trim();
1540
+ return (0, text_1.normalizeLoosePhraseKey)(value);
1318
1541
  }
1319
1542
  function normalizeAdditionalInstructionKey(value) {
1320
- return value
1321
- .trim()
1322
- .toLowerCase()
1323
- .replace(/[^\p{L}\p{N}]+/gu, " ")
1324
- .replace(/\s+/g, " ")
1325
- .trim();
1543
+ return (0, text_1.normalizeLoosePhraseKey)(value);
1326
1544
  }
1327
1545
  const DEFAULT_PRN_REASON_SOURCE = [
1328
1546
  {
@@ -1330,59 +1548,261 @@ const DEFAULT_PRN_REASON_SOURCE = [
1330
1548
  definition: {
1331
1549
  coding: { system: SNOMED_SYSTEM, code: "22253000", display: "Pain" },
1332
1550
  text: "Pain",
1551
+ aliases: ["เจ็บ", "ปวด"],
1333
1552
  i18n: { th: "ปวด" }
1334
1553
  }
1335
1554
  },
1336
1555
  {
1337
- names: ["nausea", "queasiness", "vomiting", "n/v", "nausea and vomiting"],
1556
+ names: ["headache", "head pain"],
1557
+ definition: {
1558
+ coding: { system: SNOMED_SYSTEM, code: "25064002", display: "Headache" },
1559
+ text: "Headache",
1560
+ aliases: ["ปวดหัว", "ปวดศีรษะ"],
1561
+ i18n: { th: "ปวดศีรษะ" }
1562
+ }
1563
+ },
1564
+ {
1565
+ names: ["migraine", "migraine headache"],
1566
+ definition: {
1567
+ coding: { system: SNOMED_SYSTEM, code: "37796009", display: "Migraine" },
1568
+ text: "Migraine",
1569
+ aliases: ["ไมเกรน", "ปวดหัวไมเกรน"],
1570
+ i18n: { th: "ไมเกรน" }
1571
+ }
1572
+ },
1573
+ {
1574
+ names: ["back pain", "backache", "pain in back"],
1575
+ definition: {
1576
+ coding: { system: SNOMED_SYSTEM, code: "161891005", display: "Backache" },
1577
+ text: "Back pain",
1578
+ aliases: ["ปวดหลัง"],
1579
+ i18n: { th: "ปวดหลัง" }
1580
+ }
1581
+ },
1582
+ {
1583
+ names: ["low back pain", "lower back pain", "lumbar pain"],
1584
+ definition: {
1585
+ coding: { system: SNOMED_SYSTEM, code: "279039007", display: "Low back pain" },
1586
+ text: "Low back pain",
1587
+ aliases: ["ปวดหลังส่วนล่าง", "ปวดเอว"],
1588
+ i18n: { th: "ปวดหลังส่วนล่าง" }
1589
+ }
1590
+ },
1591
+ {
1592
+ names: ["joint pain", "arthralgia", "painful joint"],
1593
+ definition: {
1594
+ coding: { system: SNOMED_SYSTEM, code: "57676002", display: "Pain of joint" },
1595
+ text: "Joint pain",
1596
+ aliases: ["ปวดข้อ"],
1597
+ i18n: { th: "ปวดข้อ" }
1598
+ }
1599
+ },
1600
+ {
1601
+ names: ["muscle pain", "myalgia"],
1602
+ definition: {
1603
+ coding: { system: SNOMED_SYSTEM, code: "68962001", display: "Muscle pain" },
1604
+ text: "Muscle pain",
1605
+ aliases: ["ปวดกล้ามเนื้อ", "เมื่อยกล้ามเนื้อ"],
1606
+ i18n: { th: "ปวดกล้ามเนื้อ" }
1607
+ }
1608
+ },
1609
+ {
1610
+ names: ["ear pain", "earache", "otalgia"],
1611
+ definition: {
1612
+ coding: { system: SNOMED_SYSTEM, code: "301354004", display: "Pain of ear" },
1613
+ text: "Ear pain",
1614
+ aliases: ["ปวดหู"],
1615
+ i18n: { th: "ปวดหู" }
1616
+ }
1617
+ },
1618
+ {
1619
+ names: ["sore throat", "throat pain"],
1620
+ definition: {
1621
+ coding: { system: SNOMED_SYSTEM, code: "267102003", display: "Sore throat" },
1622
+ text: "Sore throat",
1623
+ aliases: ["เจ็บคอ", "คอเจ็บ"],
1624
+ i18n: { th: "เจ็บคอ" }
1625
+ }
1626
+ },
1627
+ {
1628
+ names: ["chest pain"],
1629
+ definition: {
1630
+ coding: { system: SNOMED_SYSTEM, code: "29857009", display: "Chest pain" },
1631
+ text: "Chest pain",
1632
+ aliases: ["เจ็บหน้าอก"],
1633
+ i18n: { th: "เจ็บหน้าอก" }
1634
+ }
1635
+ },
1636
+ {
1637
+ names: ["pelvic pain", "pelvic and perineal pain"],
1638
+ definition: {
1639
+ coding: {
1640
+ system: SNOMED_SYSTEM,
1641
+ code: "274671002",
1642
+ display: "Pelvic and perineal pain"
1643
+ },
1644
+ text: "Pelvic pain",
1645
+ aliases: ["ปวดเชิงกราน", "ปวดท้องน้อย"],
1646
+ i18n: { th: "ปวดเชิงกราน" }
1647
+ }
1648
+ },
1649
+ {
1650
+ names: ["dysmenorrhea", "menstrual cramps", "period cramps", "period pain"],
1651
+ definition: {
1652
+ coding: { system: SNOMED_SYSTEM, code: "266599000", display: "Dysmenorrhea" },
1653
+ text: "Menstrual cramps",
1654
+ aliases: ["ปวดประจำเดือน", "ปวดเมนส์"],
1655
+ i18n: { th: "ปวดประจำเดือน" }
1656
+ }
1657
+ },
1658
+ {
1659
+ names: ["cramp", "cramps", "cramping"],
1660
+ definition: {
1661
+ coding: { system: SNOMED_SYSTEM, code: "55300003", display: "Cramp" },
1662
+ text: "Cramp",
1663
+ aliases: ["ตะคริว"],
1664
+ i18n: { th: "ตะคริว" }
1665
+ }
1666
+ },
1667
+ {
1668
+ names: ["spasm", "spasms", "muscle spasm"],
1669
+ definition: {
1670
+ coding: { system: SNOMED_SYSTEM, code: "45352006", display: "Spasm" },
1671
+ text: "Spasm",
1672
+ aliases: ["เกร็ง", "กล้ามเนื้อเกร็ง"],
1673
+ i18n: { th: "ตะคริวหรือเกร็ง" }
1674
+ }
1675
+ },
1676
+ {
1677
+ names: ["nausea", "queasiness", "queasy"],
1338
1678
  definition: {
1339
1679
  coding: { system: SNOMED_SYSTEM, code: "422587007", display: "Nausea" },
1340
1680
  text: "Nausea",
1681
+ aliases: ["คลื่นไส้"],
1341
1682
  i18n: { th: "คลื่นไส้" }
1342
1683
  }
1343
1684
  },
1344
1685
  {
1345
- names: ["itch", "itching", "itchy"],
1686
+ names: ["vomiting", "emesis", "throw up", "throwing up"],
1687
+ definition: {
1688
+ coding: { system: SNOMED_SYSTEM, code: "422400008", display: "Vomiting" },
1689
+ text: "Vomiting",
1690
+ aliases: ["อาเจียน"],
1691
+ i18n: { th: "อาเจียน" }
1692
+ }
1693
+ },
1694
+ {
1695
+ names: ["n/v", "nausea and vomiting", "vomiting and nausea"],
1346
1696
  definition: {
1347
1697
  coding: {
1348
1698
  system: SNOMED_SYSTEM,
1349
- code: "418363000",
1350
- display: "Itching of skin"
1699
+ code: "16932000",
1700
+ display: "Nausea and vomiting"
1351
1701
  },
1352
- text: "Itching",
1353
- i18n: { th: "คัน" }
1702
+ text: "Nausea and vomiting",
1703
+ aliases: ["คลื่นไส้อาเจียน", "คลื่นไส้และอาเจียน"],
1704
+ i18n: { th: "คลื่นไส้และอาเจียน" }
1354
1705
  }
1355
1706
  },
1356
1707
  {
1357
- names: ["anxiety", "nervousness"],
1708
+ names: ["diarrhea", "diarrhoea", "loose stool", "loose stools"],
1358
1709
  definition: {
1359
- coding: { system: SNOMED_SYSTEM, code: "48694002", display: "Anxiety" },
1360
- text: "Anxiety",
1361
- i18n: { th: "วิตกกังวล" }
1710
+ coding: { system: SNOMED_SYSTEM, code: "62315008", display: "Diarrhea" },
1711
+ text: "Diarrhea",
1712
+ aliases: ["ท้องเสีย", "ถ่ายเหลว"],
1713
+ i18n: { th: "ท้องเสีย" }
1362
1714
  }
1363
1715
  },
1364
1716
  {
1365
- names: ["sleep", "sleeping", "insomnia", "sleep issues"],
1717
+ names: ["constipation"],
1366
1718
  definition: {
1367
1719
  coding: {
1368
1720
  system: SNOMED_SYSTEM,
1369
- code: "193462001",
1370
- display: "Insomnia"
1721
+ code: "14760008",
1722
+ display: "Constipation"
1371
1723
  },
1372
- text: "Sleep",
1373
- i18n: { th: "นอนหลับ" }
1724
+ text: "Constipation",
1725
+ aliases: ["ท้องผูก", "ถ่ายไม่ออก"],
1726
+ i18n: { th: "ท้องผูก" }
1727
+ }
1728
+ },
1729
+ {
1730
+ names: ["heartburn"],
1731
+ definition: {
1732
+ coding: { system: SNOMED_SYSTEM, code: "16331000", display: "Heartburn" },
1733
+ text: "Heartburn",
1734
+ aliases: ["แสบร้อนกลางอก"],
1735
+ i18n: { th: "แสบร้อนกลางอก" }
1736
+ }
1737
+ },
1738
+ {
1739
+ names: ["abdominal pain", "stomach pain", "stomachache"],
1740
+ definition: {
1741
+ coding: { system: SNOMED_SYSTEM, code: "21522001", display: "Abdominal pain" },
1742
+ text: "Abdominal pain",
1743
+ aliases: ["ปวดท้อง"],
1744
+ i18n: { th: "ปวดท้อง" }
1374
1745
  }
1375
1746
  },
1376
1747
  {
1377
- names: ["sleepiness", "sleepy", "drowsiness", "drowsy"],
1748
+ names: ["abdominal bloating", "bloating", "bloated"],
1378
1749
  definition: {
1379
1750
  coding: {
1380
1751
  system: SNOMED_SYSTEM,
1381
- code: "79519003",
1382
- display: "Drowsiness"
1752
+ code: "116289008",
1753
+ display: "Abdominal bloating"
1383
1754
  },
1384
- text: "Sleepiness",
1385
- i18n: { th: "ง่วงนอน" }
1755
+ text: "Bloating",
1756
+ aliases: ["ท้องอืด"],
1757
+ i18n: { th: "ท้องอืด" }
1758
+ }
1759
+ },
1760
+ {
1761
+ names: ["flatulence", "gas", "gassy"],
1762
+ definition: {
1763
+ coding: { system: SNOMED_SYSTEM, code: "249504006", display: "Flatulence" },
1764
+ text: "Gas",
1765
+ aliases: ["มีแก๊สในท้อง", "ลมในท้อง"],
1766
+ i18n: { th: "มีแก๊สในท้อง" }
1767
+ }
1768
+ },
1769
+ {
1770
+ names: ["eye itch", "itchy eye", "itchy eyes", "eye itching", "itching eye", "itching eyes", "itching of eye", "itching of eyes"],
1771
+ definition: {
1772
+ coding: {
1773
+ system: SNOMED_SYSTEM,
1774
+ code: "74776002",
1775
+ display: "Itching of eye"
1776
+ },
1777
+ text: "Eye itching",
1778
+ aliases: ["คันตา", "ตาคัน"],
1779
+ i18n: { th: "คันตา" }
1780
+ }
1781
+ },
1782
+ {
1783
+ names: ["lesion itch", "itchy lesion", "itching lesion", "lesion itching", "itching of lesion", "itching of skin lesion", "skin lesion itch"],
1784
+ definition: {
1785
+ coding: {
1786
+ system: SNOMED_SYSTEM,
1787
+ code: "445329008",
1788
+ display: "Itching of lesion of skin"
1789
+ },
1790
+ text: "Lesion itching",
1791
+ aliases: ["คันรอยโรค", "คันที่รอยโรค"],
1792
+ i18n: { th: "คันที่รอยโรค" }
1793
+ }
1794
+ },
1795
+ {
1796
+ names: ["itch", "itching", "itchy", "wound itch", "itchy wound", "wound itching", "itching wound", "itching of wound"],
1797
+ definition: {
1798
+ coding: {
1799
+ system: SNOMED_SYSTEM,
1800
+ code: "418363000",
1801
+ display: "Itching of skin"
1802
+ },
1803
+ text: "Itching",
1804
+ aliases: ["คัน", "คันแผล", "แผลคัน"],
1805
+ i18n: { th: "คัน" }
1386
1806
  }
1387
1807
  },
1388
1808
  {
@@ -1390,6 +1810,7 @@ const DEFAULT_PRN_REASON_SOURCE = [
1390
1810
  definition: {
1391
1811
  coding: { system: SNOMED_SYSTEM, code: "49727002", display: "Cough" },
1392
1812
  text: "Cough",
1813
+ aliases: ["ไอ"],
1393
1814
  i18n: { th: "ไอ" }
1394
1815
  }
1395
1816
  },
@@ -1398,43 +1819,38 @@ const DEFAULT_PRN_REASON_SOURCE = [
1398
1819
  definition: {
1399
1820
  coding: { system: SNOMED_SYSTEM, code: "386661006", display: "Fever" },
1400
1821
  text: "Fever",
1822
+ aliases: ["ไข้", "ตัวร้อน"],
1401
1823
  i18n: { th: "ไข้" }
1402
1824
  }
1403
1825
  },
1404
1826
  {
1405
- names: ["spasm", "spasms", "muscle spasm"],
1406
- definition: {
1407
- coding: { system: SNOMED_SYSTEM, code: "45352006", display: "Spasm" },
1408
- text: "Spasm",
1409
- i18n: { th: "ตะคริวหรือเกร็ง" }
1410
- }
1411
- },
1412
- {
1413
- names: ["constipation"],
1827
+ names: ["nasal congestion", "congestion", "stuffy nose", "blocked nose"],
1414
1828
  definition: {
1415
1829
  coding: {
1416
1830
  system: SNOMED_SYSTEM,
1417
- code: "14760008",
1418
- display: "Constipation"
1831
+ code: "68235000",
1832
+ display: "Nasal congestion"
1419
1833
  },
1420
- text: "Constipation",
1421
- i18n: { th: "ท้องผูก" }
1834
+ text: "Nasal congestion",
1835
+ aliases: ["คัดจมูก"],
1836
+ i18n: { th: "คัดจมูก" }
1422
1837
  }
1423
1838
  },
1424
1839
  {
1425
- names: ["irritation", "irritated"],
1840
+ names: ["nasal discharge", "rhinorrhea", "rhinorrhoea", "runny nose", "discharge from nose"],
1426
1841
  definition: {
1427
1842
  coding: {
1428
1843
  system: SNOMED_SYSTEM,
1429
- code: "257553007",
1430
- display: "Irritation"
1844
+ code: "64531003",
1845
+ display: "Nasal discharge"
1431
1846
  },
1432
- text: "Irritation",
1433
- i18n: { th: "ระคายเคือง" }
1847
+ text: "Runny nose",
1848
+ aliases: ["น้ำมูกไหล"],
1849
+ i18n: { th: "น้ำมูกไหล" }
1434
1850
  }
1435
1851
  },
1436
1852
  {
1437
- names: ["dyspnea", "shortness of breath", "sob", "breathlessness"],
1853
+ names: ["dyspnea", "dyspnoea", "shortness of breath", "sob", "breathlessness", "breathless"],
1438
1854
  definition: {
1439
1855
  coding: {
1440
1856
  system: SNOMED_SYSTEM,
@@ -1442,225 +1858,362 @@ const DEFAULT_PRN_REASON_SOURCE = [
1442
1858
  display: "Dyspnea"
1443
1859
  },
1444
1860
  text: "Shortness of breath",
1861
+ aliases: ["เหนื่อย", "หายใจลำบาก", "หอบ"],
1445
1862
  i18n: { th: "เหนื่อยหรือหายใจลำบาก" }
1446
1863
  }
1447
- }
1448
- ];
1449
- exports.DEFAULT_PRN_REASON_ENTRIES = DEFAULT_PRN_REASON_SOURCE.map((source) => {
1450
- var _a, _b, _c;
1451
- const canonicalTerm = (_c = (_a = source.definition.text) !== null && _a !== void 0 ? _a : (_b = source.definition.coding) === null || _b === void 0 ? void 0 : _b.display) !== null && _c !== void 0 ? _c : source.names[0];
1452
- return {
1453
- canonical: normalizePrnReasonKey(canonicalTerm !== null && canonicalTerm !== void 0 ? canonicalTerm : ""),
1454
- definition: source.definition,
1455
- terms: [...source.names]
1456
- };
1457
- });
1458
- exports.DEFAULT_PRN_REASON_DEFINITIONS = (0, object_1.objectFromEntries)(DEFAULT_PRN_REASON_SOURCE.reduce((entries, source) => {
1459
- for (const name of source.names) {
1460
- const key = normalizePrnReasonKey(name);
1461
- if (!key) {
1462
- continue;
1864
+ },
1865
+ {
1866
+ names: ["wheezing", "wheeze", "wheezy"],
1867
+ definition: {
1868
+ coding: { system: SNOMED_SYSTEM, code: "56018004", display: "Wheezing" },
1869
+ text: "Wheeze",
1870
+ aliases: ["หายใจมีเสียงหวีด"],
1871
+ i18n: { th: "หายใจมีเสียงหวีด" }
1463
1872
  }
1464
- entries.push([key, source.definition]);
1465
- }
1466
- if (source.definition.aliases) {
1467
- for (const alias of source.definition.aliases) {
1468
- const key = normalizePrnReasonKey(alias);
1469
- if (!key) {
1470
- continue;
1471
- }
1472
- entries.push([key, source.definition]);
1873
+ },
1874
+ {
1875
+ names: ["sneezing", "sneeze", "sneezes"],
1876
+ definition: {
1877
+ coding: { system: SNOMED_SYSTEM, code: "76067001", display: "Sneezing" },
1878
+ text: "Sneezing",
1879
+ aliases: ["จาม"],
1880
+ i18n: { th: "จาม" }
1473
1881
  }
1474
- }
1475
- return entries;
1476
- }, []));
1477
- const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1882
+ },
1478
1883
  {
1479
- names: ["with food", "with meals", "with meal", "after food", "after meals"],
1884
+ names: ["allergic rhinitis", "allergy symptoms", "hay fever", "hayfever"],
1480
1885
  definition: {
1481
1886
  coding: {
1482
1887
  system: SNOMED_SYSTEM,
1483
- code: "311504000",
1484
- display: "With or after food"
1888
+ code: "61582004",
1889
+ display: "Allergic rhinitis"
1485
1890
  },
1486
- text: "Take with or after food",
1487
- i18n: { th: "รับประทานพร้อมหรือหลังอาหาร" }
1891
+ text: "Allergic rhinitis",
1892
+ aliases: ["ภูมิแพ้จมูก", "ภูมิแพ้"],
1893
+ i18n: { th: "ภูมิแพ้จมูก" }
1488
1894
  }
1489
1895
  },
1490
1896
  {
1491
- names: ["before food", "before meals", "before meal", "1 hour before food"],
1897
+ names: ["rash", "skin rash", "skin eruption", "eruption of skin"],
1492
1898
  definition: {
1493
1899
  coding: {
1494
1900
  system: SNOMED_SYSTEM,
1495
- code: "311501008",
1496
- display: "Half to one hour before food"
1901
+ code: "271807003",
1902
+ display: "Eruption of skin"
1497
1903
  },
1498
- text: "Take before food",
1499
- i18n: { th: "รับประทานก่อนอาหาร" }
1904
+ text: "Rash",
1905
+ aliases: ["ผื่น"],
1906
+ i18n: { th: "ผื่น" }
1500
1907
  }
1501
1908
  },
1502
1909
  {
1503
- names: ["empty stomach", "on empty stomach"],
1910
+ names: ["burning sensation", "burning", "burning pain"],
1504
1911
  definition: {
1505
1912
  coding: {
1506
1913
  system: SNOMED_SYSTEM,
1507
- code: "717154004",
1508
- display: "Take on an empty stomach (qualifier value)"
1914
+ code: "90673000",
1915
+ display: "Burning sensation"
1509
1916
  },
1510
- text: "Take on an empty stomach",
1511
- i18n: { th: "รับประทานขณะท้องว่าง" }
1917
+ text: "Burning sensation",
1918
+ aliases: ["แสบร้อน", "แสบ"],
1919
+ i18n: { th: "แสบร้อน" }
1512
1920
  }
1513
1921
  },
1514
1922
  {
1515
- names: ["with water", "with plenty of water", "drink water", "with lots of water"],
1923
+ names: ["irritation", "irritated"],
1516
1924
  definition: {
1517
1925
  coding: {
1518
1926
  system: SNOMED_SYSTEM,
1519
- code: "419303009",
1520
- display: "With plenty of water"
1927
+ code: "257553007",
1928
+ display: "Irritation"
1521
1929
  },
1522
- text: "Take with plenty of water",
1523
- i18n: { th: "รับประทานพร้อมน้ำดื่มจำนวนมาก" }
1930
+ text: "Irritation",
1931
+ aliases: ["ระคายเคือง"],
1932
+ i18n: { th: "ระคายเคือง" }
1933
+ }
1934
+ },
1935
+ {
1936
+ names: ["dry eye", "dry eyes"],
1937
+ definition: {
1938
+ coding: { system: SNOMED_SYSTEM, code: "162290004", display: "Dry eyes" },
1939
+ text: "Dry eyes",
1940
+ aliases: ["ตาแห้ง"],
1941
+ i18n: { th: "ตาแห้ง" }
1524
1942
  }
1525
1943
  },
1526
1944
  {
1527
- names: ["dissolve in water", "mix with water", "mix in water"],
1945
+ names: ["red eye", "red eyes"],
1946
+ definition: {
1947
+ coding: { system: SNOMED_SYSTEM, code: "703630003", display: "Red eye" },
1948
+ text: "Red eye",
1949
+ aliases: ["ตาแดง"],
1950
+ i18n: { th: "ตาแดง" }
1951
+ }
1952
+ },
1953
+ {
1954
+ names: ["eye pain", "pain in eye", "ocular pain"],
1955
+ definition: {
1956
+ coding: { system: SNOMED_SYSTEM, code: "41652007", display: "Pain in eye" },
1957
+ text: "Eye pain",
1958
+ aliases: ["ปวดตา", "เจ็บตา"],
1959
+ i18n: { th: "ปวดตา" }
1960
+ }
1961
+ },
1962
+ {
1963
+ names: ["dry skin", "xeroderma"],
1964
+ definition: {
1965
+ coding: { system: SNOMED_SYSTEM, code: "52475004", display: "Xeroderma" },
1966
+ text: "Dry skin",
1967
+ aliases: ["ผิวแห้ง"],
1968
+ i18n: { th: "ผิวแห้ง" }
1969
+ }
1970
+ },
1971
+ {
1972
+ names: ["dysuria", "burning urination", "burning when urinating"],
1973
+ definition: {
1974
+ coding: { system: SNOMED_SYSTEM, code: "49650001", display: "Dysuria" },
1975
+ text: "Dysuria",
1976
+ aliases: ["แสบขัด", "ปัสสาวะแสบขัด", "แสบเวลาปัสสาวะ"],
1977
+ i18n: { th: "แสบขัดเวลาปัสสาวะ" }
1978
+ }
1979
+ },
1980
+ {
1981
+ names: ["frequency of urination", "urinary frequency", "frequent urination"],
1528
1982
  definition: {
1529
1983
  coding: {
1530
1984
  system: SNOMED_SYSTEM,
1531
- code: "417995008",
1532
- display: "Dissolve or mix with water before taking"
1985
+ code: "364198000",
1986
+ display: "Frequency of urination"
1533
1987
  },
1534
- text: "Dissolve or mix with water before taking",
1535
- i18n: { th: "ละลายหรือผสมน้ำก่อนรับประทาน" }
1988
+ text: "Urinary frequency",
1989
+ aliases: ["ปัสสาวะบ่อย"],
1990
+ i18n: { th: "ปัสสาวะบ่อย" }
1536
1991
  }
1537
1992
  },
1538
1993
  {
1539
- names: ["avoid alcohol", "no alcohol", "no alc", "avoid alcoholic drink"],
1994
+ names: ["urgent desire to urinate", "urinary urgency", "urgency to urinate", "urgency to pass urine", "urgency of micturition"],
1540
1995
  definition: {
1541
1996
  coding: {
1542
1997
  system: SNOMED_SYSTEM,
1543
- code: "419822006",
1544
- display: "Warning. Avoid alcoholic drink (qualifier value)"
1998
+ code: "75088002",
1999
+ display: "Urgent desire to urinate"
1545
2000
  },
1546
- text: "Avoid alcoholic drinks",
1547
- i18n: { th: "หลีกเลี่ยงเครื่องดื่มแอลกอฮอล์" }
2001
+ text: "Urinary urgency",
2002
+ aliases: ["ปวดปัสสาวะรีบ", "ปวดปัสสาวะกะทันหัน"],
2003
+ i18n: { th: "ปวดปัสสาวะรีบ" }
1548
2004
  }
1549
2005
  },
1550
2006
  {
1551
- names: ["may cause drowsiness", "do not drive", "avoid driving", "no driving", "no drive"],
2007
+ names: ["vaginal discharge", "discharge from vagina"],
1552
2008
  definition: {
1553
2009
  coding: {
1554
2010
  system: SNOMED_SYSTEM,
1555
- code: "418954008",
1556
- display: "Warning. May cause drowsiness. If affected do not drive or operate machinery (qualifier value)"
2011
+ code: "271939006",
2012
+ display: "Vaginal discharge"
1557
2013
  },
1558
- text: "May cause drowsiness; do not drive if affected",
1559
- i18n: { th: "อาจทำให้ง่วงซึม; ห้ามขับขี่ยานพาหนะหรือทำงานกับเครื่องจักรหากมีอาการ" }
2014
+ text: "Vaginal discharge",
2015
+ aliases: ["ตกขาว"],
2016
+ i18n: { th: "ตกขาว" }
1560
2017
  }
1561
2018
  },
1562
2019
  {
1563
- names: [
1564
- "drowsiness avoid alcohol",
1565
- "may cause drowsiness avoid alcohol",
1566
- "do not drive avoid alcohol",
1567
- "drowsy avoid alc",
1568
- "drowsy avoid drive",
1569
- "drowsy avoid driving",
1570
- "drowsy no drive",
1571
- "drowsy no driving",
1572
- "drowsy no alc"
1573
- ],
2020
+ names: ["vaginal irritation", "irritation of vagina"],
1574
2021
  definition: {
1575
2022
  coding: {
1576
2023
  system: SNOMED_SYSTEM,
1577
- code: "418914006",
1578
- display: "Warning. May cause drowsiness. If affected do not drive or operate machinery. Avoid alcoholic drink (qualifier value)"
2024
+ code: "161816004",
2025
+ display: "Vaginal irritation"
1579
2026
  },
1580
- text: "May cause drowsiness; avoid driving or alcohol",
1581
- i18n: { th: "อาจทำให้ง่วงซึม; หลีกเลี่ยงการขับขี่ยานพาหนะหรือดื่มแอลกอฮอล์" }
2027
+ text: "Vaginal irritation",
2028
+ aliases: ["ระคายเคืองช่องคลอด"],
2029
+ i18n: { th: "ระคายเคืองช่องคลอด" }
1582
2030
  }
1583
2031
  },
1584
2032
  {
1585
- names: [
1586
- "drowsiness next day",
1587
- "drowsiness next day avoid alcohol",
1588
- "may cause drowsiness next day",
1589
- "may next day drowsy",
1590
- "may drowsy next day"
1591
- ],
2033
+ names: ["pruritus of vagina", "itching of vagina", "vaginal itching", "vaginal itch"],
2034
+ definition: {
2035
+ coding: {
2036
+ system: SNOMED_SYSTEM,
2037
+ code: "34363003",
2038
+ display: "Pruritus of vagina"
2039
+ },
2040
+ text: "Vaginal itching",
2041
+ aliases: ["คันช่องคลอด"],
2042
+ i18n: { th: "คันช่องคลอด" }
2043
+ }
2044
+ },
2045
+ {
2046
+ names: ["anxiety", "nervousness", "feeling anxious"],
2047
+ definition: {
2048
+ coding: { system: SNOMED_SYSTEM, code: "48694002", display: "Anxiety" },
2049
+ text: "Anxiety",
2050
+ aliases: ["วิตกกังวล", "กังวล"],
2051
+ i18n: { th: "วิตกกังวล" }
2052
+ }
2053
+ },
2054
+ {
2055
+ names: ["panic attack", "panic", "panic episode"],
2056
+ definition: {
2057
+ coding: { system: SNOMED_SYSTEM, code: "225624000", display: "Panic attack" },
2058
+ text: "Panic attack",
2059
+ aliases: ["อาการแพนิค", "แพนิค", "ตื่นตระหนก"],
2060
+ i18n: { th: "อาการแพนิค" }
2061
+ }
2062
+ },
2063
+ {
2064
+ names: ["agitation", "agitated", "feeling agitated", "unable to keep still"],
1592
2065
  definition: {
1593
2066
  coding: {
1594
2067
  system: SNOMED_SYSTEM,
1595
- code: "418071006",
1596
- display: "Warning. Causes drowsiness which may continue the next day. If affected do not drive or operate machinery. Avoid alcoholic drink (qualifier value)"
2068
+ code: "24199005",
2069
+ display: "Feeling agitated"
1597
2070
  },
1598
- text: "May cause next-day drowsiness; avoid driving or alcohol",
1599
- i18n: { th: "อาจทำให้ง่วงซึมในวันถัดมา; หลีกเลี่ยงการขับขี่ยานพาหนะหรือดื่มแอลกอฮอล์" }
2071
+ text: "Agitation",
2072
+ aliases: ["กระสับกระส่าย", "อยู่ไม่นิ่ง"],
2073
+ i18n: { th: "กระสับกระส่าย" }
1600
2074
  }
1601
2075
  },
1602
2076
  {
1603
- names: ["avoid sun", "avoid sunlight", "avoid sun lamps"],
2077
+ names: ["sleep", "sleeping", "insomnia", "sleep issues", "unable to sleep"],
1604
2078
  definition: {
1605
2079
  coding: {
1606
2080
  system: SNOMED_SYSTEM,
1607
- code: "418521000",
1608
- display: "Avoid exposure of skin to direct sunlight or sun lamps (qualifier value)"
2081
+ code: "193462001",
2082
+ display: "Insomnia"
1609
2083
  },
1610
- text: "Avoid sunlight or sun lamps",
1611
- i18n: { th: "หลีกเลี่ยงแสงแดดหรือหลอดไฟแสงยูวี" }
2084
+ text: "Sleep",
2085
+ aliases: ["นอนหลับ", "นอนไม่หลับ"],
2086
+ i18n: { th: "นอนหลับ" }
2087
+ }
2088
+ },
2089
+ {
2090
+ names: ["sleepiness", "sleepy", "drowsiness", "drowsy", "somnolence"],
2091
+ definition: {
2092
+ coding: {
2093
+ system: SNOMED_SYSTEM,
2094
+ code: "79519003",
2095
+ display: "Drowsiness"
2096
+ },
2097
+ text: "Sleepiness",
2098
+ aliases: ["ง่วงนอน", "ง่วง"],
2099
+ i18n: { th: "ง่วงนอน" }
2100
+ }
2101
+ },
2102
+ {
2103
+ names: ["dizziness", "giddiness"],
2104
+ definition: {
2105
+ coding: { system: SNOMED_SYSTEM, code: "404640003", display: "Dizziness" },
2106
+ text: "Dizziness",
2107
+ aliases: ["เวียนหัว", "เวียนศีรษะ"],
2108
+ i18n: { th: "เวียนศีรษะ" }
2109
+ }
2110
+ },
2111
+ {
2112
+ names: ["vertigo"],
2113
+ definition: {
2114
+ coding: { system: SNOMED_SYSTEM, code: "399153001", display: "Vertigo" },
2115
+ text: "Vertigo",
2116
+ aliases: ["บ้านหมุน"],
2117
+ i18n: { th: "บ้านหมุน" }
1612
2118
  }
1613
2119
  },
1614
2120
  {
1615
- names: ["swallow whole", "do not chew", "do not crush", "do not crush or chew", "no chewing"],
2121
+ names: ["hallucinations", "hallucination"],
2122
+ definition: {
2123
+ coding: { system: SNOMED_SYSTEM, code: "7011001", display: "Hallucinations" },
2124
+ text: "Hallucinations",
2125
+ aliases: ["ประสาทหลอน", "หูแว่ว", "เห็นภาพหลอน"],
2126
+ i18n: { th: "ประสาทหลอน" }
2127
+ }
2128
+ },
2129
+ {
2130
+ names: ["mania", "manic"],
2131
+ definition: {
2132
+ coding: { system: SNOMED_SYSTEM, code: "231494001", display: "Mania" },
2133
+ text: "Mania",
2134
+ aliases: ["แมเนีย", "อารมณ์คึกผิดปกติ"],
2135
+ i18n: { th: "แมเนีย" }
2136
+ }
2137
+ },
2138
+ {
2139
+ names: ["depressed mood", "feeling depressed", "depressed"],
1616
2140
  definition: {
1617
2141
  coding: {
1618
2142
  system: SNOMED_SYSTEM,
1619
- code: "418693002",
1620
- display: "Swallowed whole, not chewed (qualifier value)"
2143
+ code: "366979004",
2144
+ display: "Depressed mood"
1621
2145
  },
1622
- text: "Swallow whole; do not crush or chew",
1623
- i18n: { th: "กลืนทั้งเม็ด; ห้ามเคี้ยวหรือบด" }
2146
+ text: "Depressed mood",
2147
+ aliases: ["อารมณ์ซึมเศร้า", "ซึมเศร้า"],
2148
+ i18n: { th: "อารมณ์ซึมเศร้า" }
1624
2149
  }
1625
2150
  },
1626
2151
  {
1627
- names: ["chew", "chewed", "sucked or chewed", "please chew", "must chew"],
2152
+ names: ["poor concentration", "difficulty concentrating", "unable to concentrate", "cannot concentrate", "can't focus"],
1628
2153
  definition: {
1629
2154
  coding: {
1630
2155
  system: SNOMED_SYSTEM,
1631
- code: "418991002",
1632
- display: "Sucked or chewed (qualifier value)"
2156
+ code: "26329005",
2157
+ display: "Poor concentration"
1633
2158
  },
1634
- text: "Suck or chew before swallowing",
1635
- i18n: { th: "เคี้ยวหรืออมให้ละลายก่อนกลืน" }
2159
+ text: "Poor concentration",
2160
+ aliases: ["สมาธิไม่ดี", "ขาดสมาธิ", "ไม่มีสมาธิ"],
2161
+ i18n: { th: "สมาธิไม่ดี" }
2162
+ }
2163
+ },
2164
+ {
2165
+ names: ["palpitations", "palpitation"],
2166
+ definition: {
2167
+ coding: { system: SNOMED_SYSTEM, code: "80313002", display: "Palpitations" },
2168
+ text: "Palpitations",
2169
+ aliases: ["ใจสั่น"],
2170
+ i18n: { th: "ใจสั่น" }
1636
2171
  }
1637
2172
  }
1638
2173
  ];
1639
- exports.DEFAULT_ADDITIONAL_INSTRUCTION_ENTRIES = DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE.map((source) => {
2174
+ exports.DEFAULT_PRN_REASON_ENTRIES = DEFAULT_PRN_REASON_SOURCE.map((source) => {
1640
2175
  var _a, _b, _c;
1641
2176
  const canonicalTerm = (_c = (_a = source.definition.text) !== null && _a !== void 0 ? _a : (_b = source.definition.coding) === null || _b === void 0 ? void 0 : _b.display) !== null && _c !== void 0 ? _c : source.names[0];
2177
+ const terms = [];
2178
+ const seen = new Set();
2179
+ const pushTerm = (value) => {
2180
+ if (!value) {
2181
+ return;
2182
+ }
2183
+ const key = normalizePrnReasonKey(value);
2184
+ if (!key || seen.has(key)) {
2185
+ return;
2186
+ }
2187
+ seen.add(key);
2188
+ terms.push(value);
2189
+ };
2190
+ for (const name of source.names) {
2191
+ pushTerm(name);
2192
+ }
2193
+ if (source.definition.aliases) {
2194
+ for (const alias of source.definition.aliases) {
2195
+ pushTerm(alias);
2196
+ }
2197
+ }
2198
+ if (source.definition.i18n) {
2199
+ for (const locale in source.definition.i18n) {
2200
+ const translation = source.definition.i18n[locale];
2201
+ pushTerm(translation);
2202
+ }
2203
+ }
1642
2204
  return {
1643
- canonical: normalizeAdditionalInstructionKey(canonicalTerm !== null && canonicalTerm !== void 0 ? canonicalTerm : ""),
2205
+ canonical: normalizePrnReasonKey(canonicalTerm !== null && canonicalTerm !== void 0 ? canonicalTerm : ""),
1644
2206
  definition: source.definition,
1645
- terms: [...source.names]
2207
+ terms
1646
2208
  };
1647
2209
  });
1648
- exports.DEFAULT_ADDITIONAL_INSTRUCTION_DEFINITIONS = (0, object_1.objectFromEntries)(DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE.reduce((entries, source) => {
1649
- for (const name of source.names) {
1650
- const key = normalizeAdditionalInstructionKey(name);
2210
+ exports.DEFAULT_PRN_REASON_DEFINITIONS = (0, object_1.objectFromEntries)(exports.DEFAULT_PRN_REASON_ENTRIES.reduce((entries, entry) => {
2211
+ for (const term of entry.terms) {
2212
+ const key = normalizePrnReasonKey(term);
1651
2213
  if (!key) {
1652
2214
  continue;
1653
2215
  }
1654
- entries.push([key, source.definition]);
1655
- }
1656
- if (source.definition.aliases) {
1657
- for (const alias of source.definition.aliases) {
1658
- const key = normalizeAdditionalInstructionKey(alias);
1659
- if (!key) {
1660
- continue;
1661
- }
1662
- entries.push([key, source.definition]);
1663
- }
2216
+ entries.push([key, entry.definition]);
1664
2217
  }
1665
2218
  return entries;
1666
2219
  }, []));
@@ -1671,10 +2224,3 @@ function findPrnReasonDefinitionByCoding(system, code) {
1671
2224
  var _a;
1672
2225
  return (_a = DEFAULT_PRN_REASON_SOURCE.find((source) => { var _a, _b; return ((_a = source.definition.coding) === null || _a === void 0 ? void 0 : _a.system) === system && ((_b = source.definition.coding) === null || _b === void 0 ? void 0 : _b.code) === code; })) === null || _a === void 0 ? void 0 : _a.definition;
1673
2226
  }
1674
- /**
1675
- * Finds a default additional instruction definition by its SNOMED coding.
1676
- */
1677
- function findAdditionalInstructionDefinitionByCoding(system, code) {
1678
- var _a;
1679
- return (_a = DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE.find((source) => { var _a, _b; return ((_a = source.definition.coding) === null || _a === void 0 ? void 0 : _a.system) === system && ((_b = source.definition.coding) === null || _b === void 0 ? void 0 : _b.code) === code; })) === null || _a === void 0 ? void 0 : _a.definition;
1680
- }