ezmedicationinput 0.1.28 → 0.1.29

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/dist/i18n.js CHANGED
@@ -116,16 +116,6 @@ const WHEN_TEXT_THAI = {
116
116
  [types_1.EventTiming["After Sleep"]]: "หลังจากนอน",
117
117
  [types_1.EventTiming.Immediate]: "ทันที"
118
118
  };
119
- const INSTRUCTION_TEXT_THAI = {
120
- "Take with or after food": "รับประทานพร้อมหรือหลังอาหาร",
121
- "With or after food": "พร้อมหรือหลังอาหาร",
122
- "Take before food": "รับประทานก่อนอาหาร",
123
- "Take on an empty stomach": "รับประทานขณะท้องว่าง",
124
- "Take with plenty of water": "รับประทานพร้อมน้ำดื่มจำนวนมาก",
125
- "Dissolve or mix with water before taking": "ละลายหรือผสมน้ำก่อนรับประทาน",
126
- "Avoid alcoholic drinks": "หลีกเลี่ยงเครื่องดื่มแอลกอฮอล์",
127
- "May cause drowsiness; do not drive if affected": "อาจทำให้ง่วงซึม; ห้ามขับขี่ยานพาหนะหรือทำงานกับเครื่องจักรหากมีอาการ",
128
- };
129
119
  const DAY_NAMES_THAI = {
130
120
  mon: "วันจันทร์",
131
121
  tue: "วันอังคาร",
@@ -635,11 +625,13 @@ function describeDayOfWeekThai(internal) {
635
625
  return `ใน${joinWithAndThai(days)}`;
636
626
  }
637
627
  function formatAsNeededThai(internal) {
628
+ var _a, _b;
638
629
  if (!internal.asNeeded) {
639
630
  return undefined;
640
631
  }
641
632
  if (internal.asNeededReason) {
642
- return `ใช้เมื่อจำเป็นสำหรับ ${internal.asNeededReason}`;
633
+ const translation = (_b = (_a = internal.asNeededReasonCoding) === null || _a === void 0 ? void 0 : _a.i18n) === null || _b === void 0 ? void 0 : _b.th;
634
+ return `ใช้เมื่อจำเป็นสำหรับ ${translation || internal.asNeededReason}`;
643
635
  }
644
636
  return "ใช้เมื่อจำเป็น";
645
637
  }
@@ -770,12 +762,14 @@ function formatAdditionalInstructionsThai(internal) {
770
762
  }
771
763
  const phrases = internal.additionalInstructions
772
764
  .map((instruction) => {
773
- var _a;
774
- const original = instruction.text || ((_a = instruction.coding) === null || _a === void 0 ? void 0 : _a.display);
765
+ var _a, _b, _c;
766
+ const translation = (_b = (_a = instruction.coding) === null || _a === void 0 ? void 0 : _a.i18n) === null || _b === void 0 ? void 0 : _b.th;
767
+ if (translation)
768
+ return translation;
769
+ const original = instruction.text || ((_c = instruction.coding) === null || _c === void 0 ? void 0 : _c.display);
775
770
  if (!original)
776
771
  return undefined;
777
- const normalized = original.trim();
778
- return INSTRUCTION_TEXT_THAI[normalized] || normalized;
772
+ return original.trim();
779
773
  })
780
774
  .filter((text) => Boolean(text))
781
775
  .map((text) => text.trim())
@@ -36,12 +36,16 @@ export interface ParsedSigInternal {
36
36
  timingCode?: string;
37
37
  asNeeded?: boolean;
38
38
  asNeededReason?: string;
39
- asNeededReasonCoding?: FhirCoding;
39
+ asNeededReasonCoding?: FhirCoding & {
40
+ i18n?: Record<string, string>;
41
+ };
40
42
  warnings: string[];
41
43
  siteText?: string;
42
44
  siteSource?: "abbreviation" | "text";
43
45
  siteTokenIndices: Set<number>;
44
- siteCoding?: FhirCoding;
46
+ siteCoding?: FhirCoding & {
47
+ i18n?: Record<string, string>;
48
+ };
45
49
  siteLookupRequest?: SiteCodeLookupRequest;
46
50
  siteLookups: SiteLookupDetail[];
47
51
  customSiteHints?: Set<string>;
@@ -49,6 +53,8 @@ export interface ParsedSigInternal {
49
53
  prnReasonLookups: PrnReasonLookupDetail[];
50
54
  additionalInstructions: Array<{
51
55
  text?: string;
52
- coding?: FhirCoding;
56
+ coding?: FhirCoding & {
57
+ i18n?: Record<string, string>;
58
+ };
53
59
  }>;
54
60
  }
package/dist/maps.js CHANGED
@@ -1288,14 +1288,16 @@ const DEFAULT_PRN_REASON_SOURCE = [
1288
1288
  names: ["pain", "ache", "aches", "pains"],
1289
1289
  definition: {
1290
1290
  coding: { system: SNOMED_SYSTEM, code: "22253000", display: "Pain" },
1291
- text: "Pain"
1291
+ text: "Pain",
1292
+ i18n: { th: "ปวด" }
1292
1293
  }
1293
1294
  },
1294
1295
  {
1295
1296
  names: ["nausea", "queasiness", "vomiting", "n/v", "nausea and vomiting"],
1296
1297
  definition: {
1297
1298
  coding: { system: SNOMED_SYSTEM, code: "422587007", display: "Nausea" },
1298
- text: "Nausea"
1299
+ text: "Nausea",
1300
+ i18n: { th: "คลื่นไส้" }
1299
1301
  }
1300
1302
  },
1301
1303
  {
@@ -1306,14 +1308,16 @@ const DEFAULT_PRN_REASON_SOURCE = [
1306
1308
  code: "418363000",
1307
1309
  display: "Itching of skin"
1308
1310
  },
1309
- text: "Itching"
1311
+ text: "Itching",
1312
+ i18n: { th: "คัน" }
1310
1313
  }
1311
1314
  },
1312
1315
  {
1313
1316
  names: ["anxiety", "nervousness"],
1314
1317
  definition: {
1315
1318
  coding: { system: SNOMED_SYSTEM, code: "48694002", display: "Anxiety" },
1316
- text: "Anxiety"
1319
+ text: "Anxiety",
1320
+ i18n: { th: "วิตกกังวล" }
1317
1321
  }
1318
1322
  },
1319
1323
  {
@@ -1324,28 +1328,32 @@ const DEFAULT_PRN_REASON_SOURCE = [
1324
1328
  code: "193462001",
1325
1329
  display: "Insomnia"
1326
1330
  },
1327
- text: "Sleep"
1331
+ text: "Sleep",
1332
+ i18n: { th: "นอนหลับ" }
1328
1333
  }
1329
1334
  },
1330
1335
  {
1331
1336
  names: ["cough", "coughing"],
1332
1337
  definition: {
1333
1338
  coding: { system: SNOMED_SYSTEM, code: "49727002", display: "Cough" },
1334
- text: "Cough"
1339
+ text: "Cough",
1340
+ i18n: { th: "ไอ" }
1335
1341
  }
1336
1342
  },
1337
1343
  {
1338
1344
  names: ["fever", "temperature", "pyrexia"],
1339
1345
  definition: {
1340
1346
  coding: { system: SNOMED_SYSTEM, code: "386661006", display: "Fever" },
1341
- text: "Fever"
1347
+ text: "Fever",
1348
+ i18n: { th: "ไข้" }
1342
1349
  }
1343
1350
  },
1344
1351
  {
1345
1352
  names: ["spasm", "spasms", "muscle spasm"],
1346
1353
  definition: {
1347
1354
  coding: { system: SNOMED_SYSTEM, code: "45352006", display: "Spasm" },
1348
- text: "Spasm"
1355
+ text: "Spasm",
1356
+ i18n: { th: "ตะคริวหรือเกร็ง" }
1349
1357
  }
1350
1358
  },
1351
1359
  {
@@ -1356,7 +1364,8 @@ const DEFAULT_PRN_REASON_SOURCE = [
1356
1364
  code: "14760008",
1357
1365
  display: "Constipation"
1358
1366
  },
1359
- text: "Constipation"
1367
+ text: "Constipation",
1368
+ i18n: { th: "ท้องผูก" }
1360
1369
  }
1361
1370
  },
1362
1371
  {
@@ -1367,7 +1376,8 @@ const DEFAULT_PRN_REASON_SOURCE = [
1367
1376
  code: "257553007",
1368
1377
  display: "Irritation"
1369
1378
  },
1370
- text: "Irritation"
1379
+ text: "Irritation",
1380
+ i18n: { th: "ระคายเคือง" }
1371
1381
  }
1372
1382
  },
1373
1383
  {
@@ -1378,7 +1388,8 @@ const DEFAULT_PRN_REASON_SOURCE = [
1378
1388
  code: "267036007",
1379
1389
  display: "Dyspnea"
1380
1390
  },
1381
- text: "Shortness of breath"
1391
+ text: "Shortness of breath",
1392
+ i18n: { th: "เหนื่อยหรือหายใจลำบาก" }
1382
1393
  }
1383
1394
  }
1384
1395
  ];
@@ -1419,7 +1430,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1419
1430
  code: "311504000",
1420
1431
  display: "With or after food"
1421
1432
  },
1422
- text: "Take with or after food"
1433
+ text: "Take with or after food",
1434
+ i18n: { th: "รับประทานพร้อมหรือหลังอาหาร" }
1423
1435
  }
1424
1436
  },
1425
1437
  {
@@ -1430,7 +1442,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1430
1442
  code: "311501008",
1431
1443
  display: "Half to one hour before food"
1432
1444
  },
1433
- text: "Take before food"
1445
+ text: "Take before food",
1446
+ i18n: { th: "รับประทานก่อนอาหาร" }
1434
1447
  }
1435
1448
  },
1436
1449
  {
@@ -1441,7 +1454,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1441
1454
  code: "717154004",
1442
1455
  display: "Take on an empty stomach (qualifier value)"
1443
1456
  },
1444
- text: "Take on an empty stomach"
1457
+ text: "Take on an empty stomach",
1458
+ i18n: { th: "รับประทานขณะท้องว่าง" }
1445
1459
  }
1446
1460
  },
1447
1461
  {
@@ -1452,7 +1466,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1452
1466
  code: "419303009",
1453
1467
  display: "With plenty of water"
1454
1468
  },
1455
- text: "Take with plenty of water"
1469
+ text: "Take with plenty of water",
1470
+ i18n: { th: "รับประทานพร้อมน้ำดื่มจำนวนมาก" }
1456
1471
  }
1457
1472
  },
1458
1473
  {
@@ -1463,7 +1478,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1463
1478
  code: "417995008",
1464
1479
  display: "Dissolve or mix with water before taking"
1465
1480
  },
1466
- text: "Dissolve or mix with water before taking"
1481
+ text: "Dissolve or mix with water before taking",
1482
+ i18n: { th: "ละลายหรือผสมน้ำก่อนรับประทาน" }
1467
1483
  }
1468
1484
  },
1469
1485
  {
@@ -1474,7 +1490,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1474
1490
  code: "419822006",
1475
1491
  display: "Warning. Avoid alcoholic drink (qualifier value)"
1476
1492
  },
1477
- text: "Avoid alcoholic drinks"
1493
+ text: "Avoid alcoholic drinks",
1494
+ i18n: { th: "หลีกเลี่ยงเครื่องดื่มแอลกอฮอล์" }
1478
1495
  }
1479
1496
  },
1480
1497
  {
@@ -1485,7 +1502,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1485
1502
  code: "418954008",
1486
1503
  display: "Warning. May cause drowsiness. If affected do not drive or operate machinery (qualifier value)"
1487
1504
  },
1488
- text: "May cause drowsiness; do not drive if affected"
1505
+ text: "May cause drowsiness; do not drive if affected",
1506
+ i18n: { th: "อาจทำให้ง่วงซึม; ห้ามขับขี่ยานพาหนะหรือทำงานกับเครื่องจักรหากมีอาการ" }
1489
1507
  }
1490
1508
  },
1491
1509
  {
@@ -1506,7 +1524,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1506
1524
  code: "418914006",
1507
1525
  display: "Warning. May cause drowsiness. If affected do not drive or operate machinery. Avoid alcoholic drink (qualifier value)"
1508
1526
  },
1509
- text: "May cause drowsiness; avoid driving or alcohol"
1527
+ text: "May cause drowsiness; avoid driving or alcohol",
1528
+ i18n: { th: "อาจทำให้ง่วงซึม; หลีกเลี่ยงการขับขี่ยานพาหนะหรือดื่มแอลกอฮอล์" }
1510
1529
  }
1511
1530
  },
1512
1531
  {
@@ -1523,7 +1542,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1523
1542
  code: "418071006",
1524
1543
  display: "Warning. Causes drowsiness which may continue the next day. If affected do not drive or operate machinery. Avoid alcoholic drink (qualifier value)"
1525
1544
  },
1526
- text: "May cause next-day drowsiness; avoid driving or alcohol"
1545
+ text: "May cause next-day drowsiness; avoid driving or alcohol",
1546
+ i18n: { th: "อาจทำให้ง่วงซึมในวันถัดมา; หลีกเลี่ยงการขับขี่ยานพาหนะหรือดื่มแอลกอฮอล์" }
1527
1547
  }
1528
1548
  },
1529
1549
  {
@@ -1534,7 +1554,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1534
1554
  code: "418521000",
1535
1555
  display: "Avoid exposure of skin to direct sunlight or sun lamps (qualifier value)"
1536
1556
  },
1537
- text: "Avoid sunlight or sun lamps"
1557
+ text: "Avoid sunlight or sun lamps",
1558
+ i18n: { th: "หลีกเลี่ยงแสงแดดหรือหลอดไฟแสงยูวี" }
1538
1559
  }
1539
1560
  },
1540
1561
  {
@@ -1545,7 +1566,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1545
1566
  code: "418693002",
1546
1567
  display: "Swallowed whole, not chewed (qualifier value)"
1547
1568
  },
1548
- text: "Swallow whole; do not crush or chew"
1569
+ text: "Swallow whole; do not crush or chew",
1570
+ i18n: { th: "กลืนทั้งเม็ด; ห้ามเคี้ยวหรือบด" }
1549
1571
  }
1550
1572
  },
1551
1573
  {
@@ -1556,7 +1578,8 @@ const DEFAULT_ADDITIONAL_INSTRUCTION_SOURCE = [
1556
1578
  code: "418991002",
1557
1579
  display: "Sucked or chewed (qualifier value)"
1558
1580
  },
1559
- text: "Suck or chew before swallowing"
1581
+ text: "Suck or chew before swallowing",
1582
+ i18n: { th: "เคี้ยวหรืออมให้ละลายก่อนกลืน" }
1560
1583
  }
1561
1584
  }
1562
1585
  ];
package/dist/parser.js CHANGED
@@ -3168,7 +3168,8 @@ function collectAdditionalInstructions(internal, tokens) {
3168
3168
  ? {
3169
3169
  code: definition.coding.code,
3170
3170
  display: definition.coding.display,
3171
- system: (_f = definition.coding.system) !== null && _f !== void 0 ? _f : SNOMED_SYSTEM
3171
+ system: (_f = definition.coding.system) !== null && _f !== void 0 ? _f : SNOMED_SYSTEM,
3172
+ i18n: definition.i18n
3172
3173
  }
3173
3174
  : undefined
3174
3175
  });
@@ -3398,7 +3399,8 @@ function applyPrnReasonDefinition(internal, definition) {
3398
3399
  ? {
3399
3400
  code: coding.code,
3400
3401
  display: coding.display,
3401
- system: (_a = coding.system) !== null && _a !== void 0 ? _a : SNOMED_SYSTEM
3402
+ system: (_a = coding.system) !== null && _a !== void 0 ? _a : SNOMED_SYSTEM,
3403
+ i18n: definition.i18n
3402
3404
  }
3403
3405
  : undefined;
3404
3406
  if (definition.text && !internal.asNeededReason) {
package/dist/types.d.ts CHANGED
@@ -316,6 +316,8 @@ export interface CodeableConceptDefinition {
316
316
  coding?: FhirCoding;
317
317
  text?: string;
318
318
  aliases?: string[];
319
+ /** Optional translations for different locales (e.g., { "th": "ปวด" }) */
320
+ i18n?: Record<string, string>;
319
321
  }
320
322
  export interface PrnReasonDefinition extends CodeableConceptDefinition {
321
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezmedicationinput",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Parse concise medication sigs into FHIR R5 Dosage JSON",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",