saferx-pharma-sdk 1.4.0 → 1.4.2

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 (165) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +12 -0
  3. package/dist/cjs/Client.js +67 -0
  4. package/dist/cjs/api/resources/developers/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/developers/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/developers/exports.d.ts +2 -0
  7. package/dist/cjs/api/resources/developers/exports.js +21 -0
  8. package/dist/cjs/api/resources/drugSafety/client/Client.d.ts +39 -5
  9. package/dist/cjs/api/resources/drugSafety/client/Client.js +39 -5
  10. package/dist/cjs/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.ts +38 -4
  11. package/dist/cjs/api/resources/drugSafety/exports.d.ts +2 -0
  12. package/dist/cjs/api/resources/drugSafety/exports.js +21 -0
  13. package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.ts +2 -14
  14. package/dist/cjs/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.js +0 -11
  15. package/dist/cjs/api/types/Alert.d.ts +8 -2
  16. package/dist/cjs/api/types/Alert.js +5 -1
  17. package/dist/cjs/api/types/AllergyCrossReactivityReference.d.ts +16 -0
  18. package/dist/cjs/api/types/AllergyCrossReactivityReference.js +3 -0
  19. package/dist/cjs/api/types/AllergyData.d.ts +24 -0
  20. package/dist/cjs/api/types/AllergyData.js +11 -0
  21. package/dist/cjs/api/types/AllergyFamilyReference.d.ts +10 -0
  22. package/dist/cjs/api/types/AllergyFamilyReference.js +3 -0
  23. package/dist/cjs/api/types/AllergyInputEntry.d.ts +10 -0
  24. package/dist/cjs/api/types/AllergyInputEntry.js +3 -0
  25. package/dist/cjs/api/types/AllergyProductFamilyReference.d.ts +9 -0
  26. package/dist/cjs/api/types/AllergyProductFamilyReference.js +3 -0
  27. package/dist/cjs/api/types/AllergySummary.d.ts +14 -0
  28. package/dist/cjs/api/types/AllergySummary.js +3 -0
  29. package/dist/cjs/api/types/AllergyWarning.d.ts +30 -0
  30. package/dist/cjs/api/types/AllergyWarning.js +11 -0
  31. package/dist/cjs/api/types/ClinicalAlert.d.ts +8 -0
  32. package/dist/cjs/api/types/ClinicalContextApplied.d.ts +10 -0
  33. package/dist/cjs/api/types/ClinicalContextApplied.js +3 -0
  34. package/dist/cjs/api/types/ClinicalData.d.ts +7 -4
  35. package/dist/cjs/api/types/DailyLimit.d.ts +1 -1
  36. package/dist/cjs/api/types/DomainCode.d.ts +4 -2
  37. package/dist/cjs/api/types/DomainCode.js +4 -2
  38. package/dist/cjs/api/types/DosingData.d.ts +22 -12
  39. package/dist/cjs/api/types/DosingData.js +3 -3
  40. package/dist/cjs/api/types/DrugSafetyCheckResponse.d.ts +1 -0
  41. package/dist/cjs/api/types/ErrorResponse.d.ts +5 -0
  42. package/dist/cjs/api/types/IdentityMatch.d.ts +13 -0
  43. package/dist/cjs/api/types/IdentityMatch.js +3 -0
  44. package/dist/cjs/api/types/IntelligenceClinicalProfile.d.ts +24 -0
  45. package/dist/cjs/api/types/IntelligenceClinicalProfile.js +13 -0
  46. package/dist/cjs/api/types/IntelligenceContext.d.ts +17 -0
  47. package/dist/cjs/api/types/IntelligenceContext.js +3 -0
  48. package/dist/cjs/api/types/IntelligenceProcessorError.d.ts +4 -0
  49. package/dist/cjs/api/types/IntelligenceProcessorError.js +3 -0
  50. package/dist/cjs/api/types/IntelligenceResult.d.ts +16 -0
  51. package/dist/cjs/api/types/IntelligenceResult.js +3 -0
  52. package/dist/cjs/api/types/IntelligenceSynthesis.d.ts +6 -0
  53. package/dist/cjs/api/types/IntelligenceSynthesis.js +3 -0
  54. package/dist/cjs/api/types/Interaction.d.ts +0 -2
  55. package/dist/cjs/api/types/InteractionSummary.d.ts +4 -4
  56. package/dist/cjs/api/types/MedicationHistoryItem.d.ts +22 -0
  57. package/dist/cjs/api/types/MedicationHistoryItem.js +15 -0
  58. package/dist/cjs/api/types/Meta.d.ts +2 -0
  59. package/dist/cjs/api/types/Meta.js +1 -0
  60. package/dist/cjs/api/types/MetadataResponse.d.ts +14 -6
  61. package/dist/cjs/api/types/MetadataResponse.js +1 -0
  62. package/dist/cjs/api/types/PatientProfile.d.ts +31 -0
  63. package/dist/cjs/api/types/PatientProfile.js +17 -0
  64. package/dist/cjs/api/types/QuotaMeta.d.ts +11 -0
  65. package/dist/cjs/api/types/QuotaMeta.js +3 -0
  66. package/dist/cjs/api/types/RateLimitResponse.d.ts +11 -0
  67. package/dist/cjs/api/types/RateLimitResponse.js +1 -0
  68. package/dist/cjs/api/types/ResolvedDrug.d.ts +26 -0
  69. package/dist/cjs/api/types/SafetyData.d.ts +1 -0
  70. package/dist/cjs/api/types/index.d.ts +16 -0
  71. package/dist/cjs/api/types/index.js +16 -0
  72. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +1 -1
  73. package/dist/cjs/core/fetcher/Fetcher.js +1 -1
  74. package/dist/cjs/core/fetcher/index.d.ts +2 -0
  75. package/dist/cjs/core/fetcher/index.js +3 -1
  76. package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
  77. package/dist/cjs/core/fetcher/makePassthroughRequest.js +135 -0
  78. package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
  79. package/dist/cjs/core/fetcher/makeRequest.js +30 -9
  80. package/dist/cjs/core/runtime/runtime.js +8 -7
  81. package/dist/cjs/version.d.ts +1 -1
  82. package/dist/cjs/version.js +1 -1
  83. package/dist/esm/BaseClient.mjs +2 -2
  84. package/dist/esm/Client.d.mts +12 -0
  85. package/dist/esm/Client.mjs +34 -0
  86. package/dist/esm/api/resources/developers/client/Client.d.mts +1 -1
  87. package/dist/esm/api/resources/developers/client/Client.mjs +1 -1
  88. package/dist/esm/api/resources/developers/exports.d.mts +2 -0
  89. package/dist/esm/api/resources/developers/exports.mjs +3 -0
  90. package/dist/esm/api/resources/drugSafety/client/Client.d.mts +39 -5
  91. package/dist/esm/api/resources/drugSafety/client/Client.mjs +39 -5
  92. package/dist/esm/api/resources/drugSafety/client/requests/DrugSafetyCheckRequest.d.mts +38 -4
  93. package/dist/esm/api/resources/drugSafety/exports.d.mts +2 -0
  94. package/dist/esm/api/resources/drugSafety/exports.mjs +3 -0
  95. package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.d.mts +2 -14
  96. package/dist/esm/api/resources/drugSafety/types/GetDrugSafetyHealthResponse.mjs +0 -11
  97. package/dist/esm/api/types/Alert.d.mts +8 -2
  98. package/dist/esm/api/types/Alert.mjs +5 -1
  99. package/dist/esm/api/types/AllergyCrossReactivityReference.d.mts +16 -0
  100. package/dist/esm/api/types/AllergyCrossReactivityReference.mjs +2 -0
  101. package/dist/esm/api/types/AllergyData.d.mts +24 -0
  102. package/dist/esm/api/types/AllergyData.mjs +8 -0
  103. package/dist/esm/api/types/AllergyFamilyReference.d.mts +10 -0
  104. package/dist/esm/api/types/AllergyFamilyReference.mjs +2 -0
  105. package/dist/esm/api/types/AllergyInputEntry.d.mts +10 -0
  106. package/dist/esm/api/types/AllergyInputEntry.mjs +2 -0
  107. package/dist/esm/api/types/AllergyProductFamilyReference.d.mts +9 -0
  108. package/dist/esm/api/types/AllergyProductFamilyReference.mjs +2 -0
  109. package/dist/esm/api/types/AllergySummary.d.mts +14 -0
  110. package/dist/esm/api/types/AllergySummary.mjs +2 -0
  111. package/dist/esm/api/types/AllergyWarning.d.mts +30 -0
  112. package/dist/esm/api/types/AllergyWarning.mjs +8 -0
  113. package/dist/esm/api/types/ClinicalAlert.d.mts +8 -0
  114. package/dist/esm/api/types/ClinicalContextApplied.d.mts +10 -0
  115. package/dist/esm/api/types/ClinicalContextApplied.mjs +2 -0
  116. package/dist/esm/api/types/ClinicalData.d.mts +7 -4
  117. package/dist/esm/api/types/DailyLimit.d.mts +1 -1
  118. package/dist/esm/api/types/DomainCode.d.mts +4 -2
  119. package/dist/esm/api/types/DomainCode.mjs +4 -2
  120. package/dist/esm/api/types/DosingData.d.mts +22 -12
  121. package/dist/esm/api/types/DosingData.mjs +3 -3
  122. package/dist/esm/api/types/DrugSafetyCheckResponse.d.mts +1 -0
  123. package/dist/esm/api/types/ErrorResponse.d.mts +5 -0
  124. package/dist/esm/api/types/IdentityMatch.d.mts +13 -0
  125. package/dist/esm/api/types/IdentityMatch.mjs +2 -0
  126. package/dist/esm/api/types/IntelligenceClinicalProfile.d.mts +24 -0
  127. package/dist/esm/api/types/IntelligenceClinicalProfile.mjs +10 -0
  128. package/dist/esm/api/types/IntelligenceContext.d.mts +17 -0
  129. package/dist/esm/api/types/IntelligenceContext.mjs +2 -0
  130. package/dist/esm/api/types/IntelligenceProcessorError.d.mts +4 -0
  131. package/dist/esm/api/types/IntelligenceProcessorError.mjs +2 -0
  132. package/dist/esm/api/types/IntelligenceResult.d.mts +16 -0
  133. package/dist/esm/api/types/IntelligenceResult.mjs +2 -0
  134. package/dist/esm/api/types/IntelligenceSynthesis.d.mts +6 -0
  135. package/dist/esm/api/types/IntelligenceSynthesis.mjs +2 -0
  136. package/dist/esm/api/types/Interaction.d.mts +0 -2
  137. package/dist/esm/api/types/InteractionSummary.d.mts +4 -4
  138. package/dist/esm/api/types/MedicationHistoryItem.d.mts +22 -0
  139. package/dist/esm/api/types/MedicationHistoryItem.mjs +12 -0
  140. package/dist/esm/api/types/Meta.d.mts +2 -0
  141. package/dist/esm/api/types/Meta.mjs +1 -0
  142. package/dist/esm/api/types/MetadataResponse.d.mts +14 -6
  143. package/dist/esm/api/types/MetadataResponse.mjs +1 -0
  144. package/dist/esm/api/types/PatientProfile.d.mts +31 -0
  145. package/dist/esm/api/types/PatientProfile.mjs +16 -1
  146. package/dist/esm/api/types/QuotaMeta.d.mts +11 -0
  147. package/dist/esm/api/types/QuotaMeta.mjs +2 -0
  148. package/dist/esm/api/types/RateLimitResponse.d.mts +11 -0
  149. package/dist/esm/api/types/RateLimitResponse.mjs +1 -0
  150. package/dist/esm/api/types/ResolvedDrug.d.mts +26 -0
  151. package/dist/esm/api/types/SafetyData.d.mts +1 -0
  152. package/dist/esm/api/types/index.d.mts +16 -0
  153. package/dist/esm/api/types/index.mjs +16 -0
  154. package/dist/esm/core/fetcher/BinaryResponse.d.mts +1 -1
  155. package/dist/esm/core/fetcher/Fetcher.mjs +1 -1
  156. package/dist/esm/core/fetcher/index.d.mts +2 -0
  157. package/dist/esm/core/fetcher/index.mjs +1 -0
  158. package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
  159. package/dist/esm/core/fetcher/makePassthroughRequest.mjs +132 -0
  160. package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
  161. package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
  162. package/dist/esm/core/runtime/runtime.mjs +8 -7
  163. package/dist/esm/version.d.mts +1 -1
  164. package/dist/esm/version.mjs +1 -1
  165. package/package.json +31 -9
@@ -0,0 +1,30 @@
1
+ export interface AllergyWarning {
2
+ sfrx_id?: string | undefined;
3
+ drug_name?: string | undefined;
4
+ generic_en?: string | undefined;
5
+ dosage_form_en?: string | undefined;
6
+ warning_type?: AllergyWarning.WarningType | undefined;
7
+ allergen_family?: string | undefined;
8
+ allergen_family_name_en?: string | undefined;
9
+ patient_allergy?: string | undefined;
10
+ patient_allergy_raw_input?: string | undefined;
11
+ severity?: number | undefined;
12
+ severity_label?: string | undefined;
13
+ severity_label_ar?: string | undefined;
14
+ frequency_category?: (number | null) | undefined;
15
+ frequency_label?: (string | null) | undefined;
16
+ frequency_min_pct?: (number | null) | undefined;
17
+ frequency_max_pct?: (number | null) | undefined;
18
+ mechanism_en?: (string | null) | undefined;
19
+ mechanism_ar?: (string | null) | undefined;
20
+ clinical_note_en?: (string | null) | undefined;
21
+ clinical_note_ar?: (string | null) | undefined;
22
+ evidence_level?: (string | null) | undefined;
23
+ }
24
+ export declare namespace AllergyWarning {
25
+ const WarningType: {
26
+ readonly Direct: "direct";
27
+ readonly CrossReactivity: "cross_reactivity";
28
+ };
29
+ type WarningType = (typeof WarningType)[keyof typeof WarningType];
30
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AllergyWarning = void 0;
5
+ var AllergyWarning;
6
+ (function (AllergyWarning) {
7
+ AllergyWarning.WarningType = {
8
+ Direct: "direct",
9
+ CrossReactivity: "cross_reactivity",
10
+ };
11
+ })(AllergyWarning || (exports.AllergyWarning = AllergyWarning = {}));
@@ -26,6 +26,14 @@ export interface ClinicalAlert {
26
26
  contraindicated?: boolean | undefined;
27
27
  /** Whether dose adjustment is needed */
28
28
  requires_dose_adjustment?: boolean | undefined;
29
+ /** Matched dose-adjustment instruction from the population band, when available. */
30
+ dose_adjustment?: (string | null) | undefined;
31
+ /** Matched dosing recommendation in English, when available. */
32
+ dose_recommendation?: (string | null) | undefined;
33
+ /** Matched dosing recommendation in Arabic, when available. */
34
+ dose_recommendation_ar?: (string | null) | undefined;
35
+ /** Matched renal/hepatic/pediatric context, including the selected band or grade when available. */
36
+ matched_context?: Record<string, unknown> | undefined;
29
37
  /** Whether additional monitoring is needed */
30
38
  monitoring_required?: boolean | undefined;
31
39
  /** Clinical rationale (English) */
@@ -0,0 +1,10 @@
1
+ export interface ClinicalContextApplied {
2
+ /** Condition keys applied to clinical filtering. */
3
+ conditions?: string[] | undefined;
4
+ /** Population keys applied to clinical filtering after adding inferred populations. */
5
+ populations?: string[] | undefined;
6
+ /** Population keys explicitly supplied by the caller. */
7
+ requested_populations?: string[] | undefined;
8
+ /** Population keys inferred from patient values such as `crcl`, `child_pugh`, or `age`. */
9
+ inferred_populations?: string[] | undefined;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,17 @@
1
1
  import type * as SafeRx from "../index.js";
2
2
  /**
3
3
  * Clinical safety considerations combining per-drug population/condition
4
- * data with cross-drug clinical alerts. Enhanced when `patient_profile`
5
- * is provided in the request.
4
+ * data with cross-drug clinical alerts. Without `patient_profile`, the
5
+ * API returns product-wide clinical signals; with `patient_profile`, alert
6
+ * lists are narrowed to the supplied populations and conditions.
6
7
  */
7
8
  export interface ClinicalData {
8
9
  /** Per-drug clinical data keyed by sfrx_id */
9
10
  drug_specific?: Record<string, SafeRx.DrugClinicalData> | undefined;
10
- /** Cross-drug condition-related alerts (requires `patient_profile.conditions`) */
11
+ /** Condition-related alerts. Narrowed to `patient_profile.conditions` when supplied; otherwise product-wide condition signals may be returned. */
11
12
  condition_alerts?: SafeRx.ClinicalAlert[] | undefined;
12
- /** Cross-drug population-related alerts (requires `patient_profile.populations`) */
13
+ /** Population-related alerts. Narrowed to `patient_profile.populations` when supplied; otherwise product-wide population signals may be returned. */
13
14
  population_alerts?: SafeRx.ClinicalAlert[] | undefined;
15
+ /** Patient context actually applied to clinical-dose matching, including inferred populations from age, renal, or hepatic values. */
16
+ context_applied?: SafeRx.ClinicalContextApplied | undefined;
14
17
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OpenFDA Maximum Daily Dose data
2
+ * Regulatory maximum daily dose data
3
3
  */
4
4
  export interface DailyLimit {
5
5
  /** Maximum daily dose in milligrams */
@@ -4,8 +4,9 @@
4
4
  * - `ddi` — Drug-drug interactions (requires 2+ drugs)
5
5
  * - `pllr` — Pregnancy & lactation risk ratings
6
6
  * - `food` — Meal timing & food-drug conflicts
7
- * - `clinical` — Population & condition safety (enhanced with `patient_profile`)
8
- * - `dose` — Maximum daily dose (V3: dual-source, 19K+ products, tier-based safety)
7
+ * - `clinical` — Population & condition safety. Without patient context, returns product-wide clinical signals; with `patient_profile`, alerts are narrowed to supplied populations and conditions.
8
+ * - `dose` — Dose limits and daily-dose references from the unified dosing data path
9
+ * - `allergy` — Patient allergy matching plus direct and cross-reactivity warnings
9
10
  */
10
11
  export declare const DomainCode: {
11
12
  readonly Ae: "ae";
@@ -14,5 +15,6 @@ export declare const DomainCode: {
14
15
  readonly Food: "food";
15
16
  readonly Clinical: "clinical";
16
17
  readonly Dose: "dose";
18
+ readonly Allergy: "allergy";
17
19
  };
18
20
  export type DomainCode = (typeof DomainCode)[keyof typeof DomainCode];
@@ -8,8 +8,9 @@ exports.DomainCode = void 0;
8
8
  * - `ddi` — Drug-drug interactions (requires 2+ drugs)
9
9
  * - `pllr` — Pregnancy & lactation risk ratings
10
10
  * - `food` — Meal timing & food-drug conflicts
11
- * - `clinical` — Population & condition safety (enhanced with `patient_profile`)
12
- * - `dose` — Maximum daily dose (V3: dual-source, 19K+ products, tier-based safety)
11
+ * - `clinical` — Population & condition safety. Without patient context, returns product-wide clinical signals; with `patient_profile`, alerts are narrowed to supplied populations and conditions.
12
+ * - `dose` — Dose limits and daily-dose references from the unified dosing data path
13
+ * - `allergy` — Patient allergy matching plus direct and cross-reactivity warnings
13
14
  */
14
15
  exports.DomainCode = {
15
16
  Ae: "ae",
@@ -18,4 +19,5 @@ exports.DomainCode = {
18
19
  Food: "food",
19
20
  Clinical: "clinical",
20
21
  Dose: "dose",
22
+ Allergy: "allergy",
21
23
  };
@@ -1,14 +1,14 @@
1
1
  import type * as SafeRx from "../index.js";
2
2
  /**
3
- * Maximum daily dose data from Dose V3 — dual-source system combining
4
- * WHO Defined Daily Dose (DDD) and OpenFDA Maximum Daily Dose (MDD).
5
- * Covers 19,341 products (67.7% of database) with tier-based safety calculations.
3
+ * Dose limits and daily-dose reference data from the unified dosing path.
4
+ * Includes standard dose summaries, dose limits, daily-limit data when
5
+ * available, and caveats for products where calculation needs pharmacist review.
6
6
  */
7
7
  export interface DosingData {
8
8
  /**
9
9
  * Data quality tier.
10
- * - `1` — Full reference data (WHO DDD + OpenFDA MDD available)
11
- * - `2` — Regulatory label data only
10
+ * - `1` - Full reference and regulatory daily-limit data available
11
+ * - `2` - Regulatory daily-limit data only
12
12
  */
13
13
  tier?: number | undefined;
14
14
  /** Maximum safe units (tablets, capsules) per day */
@@ -25,24 +25,34 @@ export interface DosingData {
25
25
  caveat?: (string | null) | undefined;
26
26
  /** WHO DDD reference dose data */
27
27
  reference_dose?: (SafeRx.ReferenceDose | null) | undefined;
28
- /** OpenFDA maximum daily dose data */
28
+ /** Regulatory maximum daily dose data */
29
29
  daily_limit?: (SafeRx.DailyLimit | null) | undefined;
30
+ /** Standard-dose summary when available, including route, frequency, and verification flags. */
31
+ standard_dose?: (Record<string, unknown> | null) | undefined;
32
+ /** Dose-limit records used by the unified dosing path. */
33
+ dose_limits?: Record<string, unknown>[] | undefined;
34
+ /** Clinician/patient display summary for dose limits and caveats, when available. */
35
+ display_summary?: (Record<string, unknown> | null) | undefined;
36
+ /** Calculation uncertainty or review requirement, when available. */
37
+ dose_uncertainty?: (Record<string, unknown> | null) | undefined;
38
+ /** Display-safe monitoring instructions linked to the dose record, when available. */
39
+ monitoring_display?: (Record<string, unknown> | null) | undefined;
30
40
  /** Per-ingredient dose data for combination drugs */
31
41
  components?: ((SafeRx.DoseComponent | null)[] | null) | undefined;
32
42
  /**
33
43
  * Data source for this dose calculation.
34
- * - `reference_standard` — WHO DDD only
35
- * - `regulatory_label` — OpenFDA MDD only
36
- * - `dual_source` — Both WHO DDD and OpenFDA MDD available
44
+ * - `reference_standard` — reference dose data only
45
+ * - `regulatory_label` — regulatory daily-limit data only
46
+ * - `dual_source` — reference and regulatory daily-limit data available
37
47
  */
38
48
  source?: DosingData.Source | undefined;
39
49
  }
40
50
  export declare namespace DosingData {
41
51
  /**
42
52
  * Data source for this dose calculation.
43
- * - `reference_standard` — WHO DDD only
44
- * - `regulatory_label` — OpenFDA MDD only
45
- * - `dual_source` — Both WHO DDD and OpenFDA MDD available
53
+ * - `reference_standard` — reference dose data only
54
+ * - `regulatory_label` — regulatory daily-limit data only
55
+ * - `dual_source` — reference and regulatory daily-limit data available
46
56
  */
47
57
  const Source: {
48
58
  readonly ReferenceStandard: "reference_standard";
@@ -6,9 +6,9 @@ var DosingData;
6
6
  (function (DosingData) {
7
7
  /**
8
8
  * Data source for this dose calculation.
9
- * - `reference_standard` — WHO DDD only
10
- * - `regulatory_label` — OpenFDA MDD only
11
- * - `dual_source` — Both WHO DDD and OpenFDA MDD available
9
+ * - `reference_standard` — reference dose data only
10
+ * - `regulatory_label` — regulatory daily-limit data only
11
+ * - `dual_source` — reference and regulatory daily-limit data available
12
12
  */
13
13
  DosingData.Source = {
14
14
  ReferenceStandard: "reference_standard",
@@ -18,6 +18,7 @@ export interface DrugSafetyCheckResponse {
18
18
  */
19
19
  alerts: SafeRx.Alert[];
20
20
  meta: SafeRx.Meta;
21
+ intelligence?: SafeRx.IntelligenceResult | undefined;
21
22
  }
22
23
  export declare namespace DrugSafetyCheckResponse {
23
24
  /** Always `"success"` for 200 responses */
@@ -1,3 +1,4 @@
1
+ import type * as SafeRx from "../index.js";
1
2
  export interface ErrorResponse {
2
3
  /** Error indicator or error message */
3
4
  error?: ErrorResponse.Error_ | undefined;
@@ -15,6 +16,10 @@ export interface ErrorResponse {
15
16
  hint?: string | undefined;
16
17
  /** Support email for assistance */
17
18
  support?: string | undefined;
19
+ /** Invalid safety domain codes supplied in `include`. */
20
+ invalid_domains?: string[] | undefined;
21
+ /** Valid safety domain codes. */
22
+ valid_domains?: SafeRx.DomainCode[] | undefined;
18
23
  }
19
24
  export declare namespace ErrorResponse {
20
25
  /**
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Non-sensitive drug identity resolution metadata for auditability.
3
+ */
4
+ export interface IdentityMatch {
5
+ /** Resolver path that produced the match. */
6
+ method?: string | undefined;
7
+ /** Match confidence score. */
8
+ confidence?: number | undefined;
9
+ /** Public drug field used for the match. */
10
+ matched_field?: string | undefined;
11
+ /** Public-safe value that matched the input. */
12
+ matched_value?: string | undefined;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Patient profile fields used by intelligence processors.
3
+ */
4
+ export interface IntelligenceClinicalProfile {
5
+ age?: number | undefined;
6
+ /** Creatinine clearance in mL/min. */
7
+ crcl?: number | undefined;
8
+ hepatic_status?: IntelligenceClinicalProfile.HepaticStatus | undefined;
9
+ pregnancy?: boolean | undefined;
10
+ lactation?: boolean | undefined;
11
+ conditions?: string[] | undefined;
12
+ populations?: string[] | undefined;
13
+ allergies?: string[] | undefined;
14
+ diet_habits?: string[] | undefined;
15
+ }
16
+ export declare namespace IntelligenceClinicalProfile {
17
+ const HepaticStatus: {
18
+ readonly Normal: "normal";
19
+ readonly Mild: "mild";
20
+ readonly Moderate: "moderate";
21
+ readonly Severe: "severe";
22
+ };
23
+ type HepaticStatus = (typeof HepaticStatus)[keyof typeof HepaticStatus];
24
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.IntelligenceClinicalProfile = void 0;
5
+ var IntelligenceClinicalProfile;
6
+ (function (IntelligenceClinicalProfile) {
7
+ IntelligenceClinicalProfile.HepaticStatus = {
8
+ Normal: "normal",
9
+ Mild: "mild",
10
+ Moderate: "moderate",
11
+ Severe: "severe",
12
+ };
13
+ })(IntelligenceClinicalProfile || (exports.IntelligenceClinicalProfile = IntelligenceClinicalProfile = {}));
@@ -0,0 +1,17 @@
1
+ import type * as SafeRx from "../index.js";
2
+ /**
3
+ * Optional Medication Intelligence Platform context. When present and the
4
+ * intelligence layer is enabled, SafeRx adds a top-level `intelligence`
5
+ * block without changing the standard safety response.
6
+ */
7
+ export interface IntelligenceContext {
8
+ /** Optional caller-side patient or profile identifier. */
9
+ user_id?: string | undefined;
10
+ clinical_profile?: SafeRx.IntelligenceClinicalProfile | undefined;
11
+ /**
12
+ * Longitudinal medication list used for active-medication cumulative
13
+ * dose tracking. Items with `status: historical` are retained as
14
+ * context but excluded from active overdose aggregation.
15
+ */
16
+ medication_history?: SafeRx.MedicationHistoryItem[] | undefined;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface IntelligenceProcessorError {
2
+ processor?: string | undefined;
3
+ error?: string | undefined;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import type * as SafeRx from "../index.js";
2
+ /**
3
+ * Optional Medication Intelligence Platform post-processing output.
4
+ */
5
+ export interface IntelligenceResult {
6
+ status?: string | undefined;
7
+ /** Active-medication cumulative dose warnings. */
8
+ cumulative_warnings?: Record<string, unknown>[] | undefined;
9
+ synthesis?: SafeRx.IntelligenceSynthesis | undefined;
10
+ /** Allergy/profile-filtered alternative candidates keyed by source `sfrx_id`. */
11
+ safer_alternatives?: Record<string, unknown> | undefined;
12
+ /** Best-effort processor errors; standard safety output remains valid. */
13
+ processor_errors?: SafeRx.IntelligenceProcessorError[] | undefined;
14
+ /** Top-level degradation reason when the whole intelligence layer fails. */
15
+ error?: string | undefined;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface IntelligenceSynthesis {
2
+ cross_domain_findings?: Record<string, unknown>[] | undefined;
3
+ summary?: string | undefined;
4
+ /** Condition-specific adverse effects elevated for the supplied context. */
5
+ predictive_ae?: Record<string, unknown>[] | undefined;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -46,8 +46,6 @@ export interface Interaction {
46
46
  recommendation?: string | undefined;
47
47
  /** Clinical recommendation in Arabic */
48
48
  recommendation_ar?: string | undefined;
49
- /** Data source */
50
- source?: string | undefined;
51
49
  }
52
50
  export declare namespace Interaction {
53
51
  /** Human-readable severity label */
@@ -2,12 +2,12 @@
2
2
  * Interaction count by severity level for quick triage
3
3
  */
4
4
  export interface InteractionSummary {
5
- /** Number of contraindicated (severity 5) interactions */
5
+ /** Number of contraindicated (severity 4) interactions */
6
6
  contraindicated?: number | undefined;
7
- /** Number of major (severity 4) interactions */
7
+ /** Number of major (severity 3) interactions */
8
8
  major?: number | undefined;
9
- /** Number of moderate (severity 3) interactions */
9
+ /** Number of moderate (severity 2) interactions */
10
10
  moderate?: number | undefined;
11
- /** Number of minor (severity 2) interactions */
11
+ /** Number of minor (severity 1) interactions */
12
12
  minor?: number | undefined;
13
13
  }
@@ -0,0 +1,22 @@
1
+ export interface MedicationHistoryItem {
2
+ /** SafeRx product identifier. */
3
+ sfrx_id: string;
4
+ /** Caller-provided start date, preferably ISO 8601. */
5
+ start_date?: string | undefined;
6
+ /**
7
+ * Active medications participate in cumulative dose checks.
8
+ * Historical medications are retained as context only.
9
+ */
10
+ status?: MedicationHistoryItem.Status | undefined;
11
+ }
12
+ export declare namespace MedicationHistoryItem {
13
+ /**
14
+ * Active medications participate in cumulative dose checks.
15
+ * Historical medications are retained as context only.
16
+ */
17
+ const Status: {
18
+ readonly Active: "active";
19
+ readonly Historical: "historical";
20
+ };
21
+ type Status = (typeof Status)[keyof typeof Status];
22
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MedicationHistoryItem = void 0;
5
+ var MedicationHistoryItem;
6
+ (function (MedicationHistoryItem) {
7
+ /**
8
+ * Active medications participate in cumulative dose checks.
9
+ * Historical medications are retained as context only.
10
+ */
11
+ MedicationHistoryItem.Status = {
12
+ Active: "active",
13
+ Historical: "historical",
14
+ };
15
+ })(MedicationHistoryItem || (exports.MedicationHistoryItem = MedicationHistoryItem = {}));
@@ -15,11 +15,13 @@ export interface Meta {
15
15
  unresolved_count?: number | undefined;
16
16
  /** Caller's current tier */
17
17
  tier?: Meta.Tier | undefined;
18
+ quota?: SafeRx.QuotaMeta | undefined;
18
19
  }
19
20
  export declare namespace Meta {
20
21
  /** Caller's current tier */
21
22
  const Tier: {
22
23
  readonly Free: "free";
24
+ readonly Startup: "startup";
23
25
  readonly Pro: "pro";
24
26
  readonly Enterprise: "enterprise";
25
27
  };
@@ -7,6 +7,7 @@ var Meta;
7
7
  /** Caller's current tier */
8
8
  Meta.Tier = {
9
9
  Free: "free",
10
+ Startup: "startup",
10
11
  Pro: "pro",
11
12
  Enterprise: "enterprise",
12
13
  };
@@ -42,6 +42,8 @@ export declare namespace MetadataResponse {
42
42
  ae_risk_levels?: string[] | undefined;
43
43
  /** DDI severity scale: integer key → label */
44
44
  ddi_severity?: Record<string, string> | undefined;
45
+ /** Allergy warning severity scale: integer key → label */
46
+ allergy_severity?: Record<string, string> | undefined;
45
47
  }
46
48
  /**
47
49
  * Current database versions
@@ -52,7 +54,8 @@ export declare namespace MetadataResponse {
52
54
  clinical?: string | undefined;
53
55
  pllr?: string | undefined;
54
56
  food?: string | undefined;
55
- dose?: string | undefined;
57
+ clinical_dose?: string | undefined;
58
+ allergy?: string | undefined;
56
59
  }
57
60
  /**
58
61
  * Database coverage statistics
@@ -69,15 +72,20 @@ export declare namespace MetadataResponse {
69
72
  /** Number of supported populations */
70
73
  clinical_populations?: number | undefined;
71
74
  /** Products with dose data */
72
- dose_products?: number | undefined;
73
- /** Percentage of products with dose coverage */
74
- dose_coverage_percent?: number | undefined;
75
- /** Products with max units/day calculation */
76
- dose_with_calculation?: number | undefined;
75
+ clinical_dose_products?: number | undefined;
76
+ /** Dose data schema version */
77
+ clinical_dose_schema_version?: string | undefined;
78
+ /** Products with allergy reference data */
79
+ allergy_products?: number | undefined;
80
+ /** Allergy family count */
81
+ allergy_families?: number | undefined;
82
+ /** Allergy family cross-reaction pair count */
83
+ allergy_cross_reaction_pairs?: number | undefined;
77
84
  }
78
85
  /** Caller's current tier */
79
86
  const Tier: {
80
87
  readonly Free: "free";
88
+ readonly Startup: "startup";
81
89
  readonly Pro: "pro";
82
90
  readonly Enterprise: "enterprise";
83
91
  };
@@ -10,6 +10,7 @@ var MetadataResponse;
10
10
  /** Caller's current tier */
11
11
  MetadataResponse.Tier = {
12
12
  Free: "free",
13
+ Startup: "startup",
13
14
  Pro: "pro",
14
15
  Enterprise: "enterprise",
15
16
  };
@@ -9,4 +9,35 @@ export interface PatientProfile {
9
9
  populations?: SafeRx.Population[] | undefined;
10
10
  /** Patient comorbidities (e.g., diabetes, hypertension) */
11
11
  conditions?: SafeRx.Condition[] | undefined;
12
+ /** Known patient allergies for the `allergy` domain. */
13
+ allergies?: string[] | undefined;
14
+ /** Patient age in years. Used to infer pediatric or geriatric clinical-dose context. */
15
+ age?: number | undefined;
16
+ /** Patient weight in kilograms. Used for pediatric weight-based dose context when available. */
17
+ weight_kg?: number | undefined;
18
+ /** Creatinine clearance in mL/min. Supplying this infers the `renal` population and returns matched renal dose-adjustment context when available. */
19
+ crcl?: number | undefined;
20
+ /** eGFR value accepted as a fallback renal-function input when `crcl` is not supplied. */
21
+ egfr?: number | undefined;
22
+ /** Child-Pugh class. Supplying this infers the `hepatic` population and returns matched hepatic dose-adjustment context when available. */
23
+ child_pugh?: PatientProfile.ChildPugh | undefined;
24
+ /** Hepatic impairment severity. `mild`, `moderate`, and `severe` map to hepatic clinical-dose context when `child_pugh` is not supplied. */
25
+ hepatic_status?: PatientProfile.HepaticStatus | undefined;
26
+ }
27
+ export declare namespace PatientProfile {
28
+ /** Child-Pugh class. Supplying this infers the `hepatic` population and returns matched hepatic dose-adjustment context when available. */
29
+ const ChildPugh: {
30
+ readonly A: "A";
31
+ readonly B: "B";
32
+ readonly C: "C";
33
+ };
34
+ type ChildPugh = (typeof ChildPugh)[keyof typeof ChildPugh];
35
+ /** Hepatic impairment severity. `mild`, `moderate`, and `severe` map to hepatic clinical-dose context when `child_pugh` is not supplied. */
36
+ const HepaticStatus: {
37
+ readonly Normal: "normal";
38
+ readonly Mild: "mild";
39
+ readonly Moderate: "moderate";
40
+ readonly Severe: "severe";
41
+ };
42
+ type HepaticStatus = (typeof HepaticStatus)[keyof typeof HepaticStatus];
12
43
  }
@@ -1,3 +1,20 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PatientProfile = void 0;
5
+ var PatientProfile;
6
+ (function (PatientProfile) {
7
+ /** Child-Pugh class. Supplying this infers the `hepatic` population and returns matched hepatic dose-adjustment context when available. */
8
+ PatientProfile.ChildPugh = {
9
+ A: "A",
10
+ B: "B",
11
+ C: "C",
12
+ };
13
+ /** Hepatic impairment severity. `mild`, `moderate`, and `severe` map to hepatic clinical-dose context when `child_pugh` is not supplied. */
14
+ PatientProfile.HepaticStatus = {
15
+ Normal: "normal",
16
+ Mild: "mild",
17
+ Moderate: "moderate",
18
+ Severe: "severe",
19
+ };
20
+ })(PatientProfile || (exports.PatientProfile = PatientProfile = {}));
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Monthly quota accounting for the request.
3
+ */
4
+ export interface QuotaMeta {
5
+ monthly_limit?: number | undefined;
6
+ monthly_used?: number | undefined;
7
+ monthly_remaining?: number | undefined;
8
+ reset_at?: string | undefined;
9
+ /** Units consumed by this response. Unresolved-only checks return 0. */
10
+ billable_units?: number | undefined;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,6 +11,16 @@ export interface RateLimitResponse {
11
11
  daily_limit?: number | undefined;
12
12
  /** Requests made today (present on daily limit errors) */
13
13
  requests_today?: number | undefined;
14
+ /** Machine-readable limit reason */
15
+ reason?: string | undefined;
16
+ /** Your monthly commercial quota (present on monthly quota errors) */
17
+ monthly_limit?: number | undefined;
18
+ /** Requests consumed in the current monthly quota period */
19
+ requests_this_month?: number | undefined;
20
+ /** Remaining monthly quota units */
21
+ monthly_remaining?: number | undefined;
22
+ /** Monthly quota reset timestamp */
23
+ reset_at?: string | undefined;
14
24
  tier?: RateLimitResponse.Tier | undefined;
15
25
  /** Upgrade guidance */
16
26
  hint?: string | undefined;
@@ -19,6 +29,7 @@ export interface RateLimitResponse {
19
29
  export declare namespace RateLimitResponse {
20
30
  const Tier: {
21
31
  readonly Free: "free";
32
+ readonly Startup: "startup";
22
33
  readonly Pro: "pro";
23
34
  readonly Enterprise: "enterprise";
24
35
  };
@@ -6,6 +6,7 @@ var RateLimitResponse;
6
6
  (function (RateLimitResponse) {
7
7
  RateLimitResponse.Tier = {
8
8
  Free: "free",
9
+ Startup: "startup",
9
10
  Pro: "pro",
10
11
  Enterprise: "enterprise",
11
12
  };