@bahmni/widgets 0.0.1-dev.4

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 (103) hide show
  1. package/LICENCE +9 -0
  2. package/README.md +5 -0
  3. package/dist/allergies/AllergiesTable.d.ts +7 -0
  4. package/dist/allergies/AllergiesTable.d.ts.map +1 -0
  5. package/dist/allergies/index.d.ts +2 -0
  6. package/dist/allergies/index.d.ts.map +1 -0
  7. package/dist/allergies/useAllergies.d.ts +14 -0
  8. package/dist/allergies/useAllergies.d.ts.map +1 -0
  9. package/dist/allergies/utils.d.ts +34 -0
  10. package/dist/allergies/utils.d.ts.map +1 -0
  11. package/dist/conditions/ConditionsTable.d.ts +8 -0
  12. package/dist/conditions/ConditionsTable.d.ts.map +1 -0
  13. package/dist/conditions/index.d.ts +2 -0
  14. package/dist/conditions/index.d.ts.map +1 -0
  15. package/dist/conditions/models.d.ts +22 -0
  16. package/dist/conditions/models.d.ts.map +1 -0
  17. package/dist/conditions/utils.d.ts +11 -0
  18. package/dist/conditions/utils.d.ts.map +1 -0
  19. package/dist/diagnoses/DiagnosesTable.d.ts +7 -0
  20. package/dist/diagnoses/DiagnosesTable.d.ts.map +1 -0
  21. package/dist/diagnoses/index.d.ts +2 -0
  22. package/dist/diagnoses/index.d.ts.map +1 -0
  23. package/dist/diagnoses/useDiagnoses.d.ts +14 -0
  24. package/dist/diagnoses/useDiagnoses.d.ts.map +1 -0
  25. package/dist/hooks/useActivePractitioner.d.ts +15 -0
  26. package/dist/hooks/useActivePractitioner.d.ts.map +1 -0
  27. package/dist/hooks/usePatientUUID.d.ts +6 -0
  28. package/dist/hooks/usePatientUUID.d.ts.map +1 -0
  29. package/dist/index.css +1 -0
  30. package/dist/index.d.ts +15 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +81399 -0
  33. package/dist/labinvestigation/LabInvestigation.d.ts +4 -0
  34. package/dist/labinvestigation/LabInvestigation.d.ts.map +1 -0
  35. package/dist/labinvestigation/LabInvestigationItem.d.ts +8 -0
  36. package/dist/labinvestigation/LabInvestigationItem.d.ts.map +1 -0
  37. package/dist/labinvestigation/index.d.ts +2 -0
  38. package/dist/labinvestigation/index.d.ts.map +1 -0
  39. package/dist/labinvestigation/useLabInvestigations.d.ts +11 -0
  40. package/dist/labinvestigation/useLabInvestigations.d.ts.map +1 -0
  41. package/dist/medications/MedicationsTable.d.ts +4 -0
  42. package/dist/medications/MedicationsTable.d.ts.map +1 -0
  43. package/dist/medications/index.d.ts +2 -0
  44. package/dist/medications/index.d.ts.map +1 -0
  45. package/dist/medications/useMedicationRequest.d.ts +14 -0
  46. package/dist/medications/useMedicationRequest.d.ts.map +1 -0
  47. package/dist/medications/utils.d.ts +67 -0
  48. package/dist/medications/utils.d.ts.map +1 -0
  49. package/dist/notification/NotificationContext.d.ts +9 -0
  50. package/dist/notification/NotificationContext.d.ts.map +1 -0
  51. package/dist/notification/NotificationProvider.d.ts +7 -0
  52. package/dist/notification/NotificationProvider.d.ts.map +1 -0
  53. package/dist/notification/NotificationServiceComponent.d.ts +8 -0
  54. package/dist/notification/NotificationServiceComponent.d.ts.map +1 -0
  55. package/dist/notification/index.d.ts +5 -0
  56. package/dist/notification/index.d.ts.map +1 -0
  57. package/dist/notification/useNotification.d.ts +9 -0
  58. package/dist/notification/useNotification.d.ts.map +1 -0
  59. package/dist/patientDetails/PatientDetails.d.ts +4 -0
  60. package/dist/patientDetails/PatientDetails.d.ts.map +1 -0
  61. package/dist/patientDetails/index.d.ts +2 -0
  62. package/dist/patientDetails/index.d.ts.map +1 -0
  63. package/dist/patientDetails/usePatient.d.ts +14 -0
  64. package/dist/patientDetails/usePatient.d.ts.map +1 -0
  65. package/dist/radiologyInvestigation/RadiologyInvestigationTable.d.ts +8 -0
  66. package/dist/radiologyInvestigation/RadiologyInvestigationTable.d.ts.map +1 -0
  67. package/dist/radiologyInvestigation/__mocks__/mocks.d.ts +17 -0
  68. package/dist/radiologyInvestigation/__mocks__/mocks.d.ts.map +1 -0
  69. package/dist/radiologyInvestigation/index.d.ts +2 -0
  70. package/dist/radiologyInvestigation/index.d.ts.map +1 -0
  71. package/dist/radiologyInvestigation/useRadiologyInvestigation.d.ts +14 -0
  72. package/dist/radiologyInvestigation/useRadiologyInvestigation.d.ts.map +1 -0
  73. package/dist/radiologyInvestigation/utils.d.ts +30 -0
  74. package/dist/radiologyInvestigation/utils.d.ts.map +1 -0
  75. package/dist/searchPatient/SearchPatient.d.ts +9 -0
  76. package/dist/searchPatient/SearchPatient.d.ts.map +1 -0
  77. package/dist/searchPatient/SearchStrategy.interface.d.ts +61 -0
  78. package/dist/searchPatient/SearchStrategy.interface.d.ts.map +1 -0
  79. package/dist/searchPatient/index.d.ts +2 -0
  80. package/dist/searchPatient/index.d.ts.map +1 -0
  81. package/dist/searchPatient/strategies/AppointmentSearchStrategy.d.ts +37 -0
  82. package/dist/searchPatient/strategies/AppointmentSearchStrategy.d.ts.map +1 -0
  83. package/dist/searchPatient/strategies/AttributeSearchStrategy.d.ts +40 -0
  84. package/dist/searchPatient/strategies/AttributeSearchStrategy.d.ts.map +1 -0
  85. package/dist/searchPatient/strategies/NameOrIdSearchStrategy.d.ts +25 -0
  86. package/dist/searchPatient/strategies/NameOrIdSearchStrategy.d.ts.map +1 -0
  87. package/dist/searchPatient/strategies/SearchStrategyRegistry.d.ts +37 -0
  88. package/dist/searchPatient/strategies/SearchStrategyRegistry.d.ts.map +1 -0
  89. package/dist/userPrivileges/UserPrivilegeContext.d.ts +11 -0
  90. package/dist/userPrivileges/UserPrivilegeContext.d.ts.map +1 -0
  91. package/dist/userPrivileges/UserPrivilegeProvider.d.ts +7 -0
  92. package/dist/userPrivileges/UserPrivilegeProvider.d.ts.map +1 -0
  93. package/dist/userPrivileges/useUserPrivilege.d.ts +3 -0
  94. package/dist/userPrivileges/useUserPrivilege.d.ts.map +1 -0
  95. package/dist/vitalFlowSheet/VitalFlowSheet.d.ts +9 -0
  96. package/dist/vitalFlowSheet/VitalFlowSheet.d.ts.map +1 -0
  97. package/dist/vitalFlowSheet/index.d.ts +3 -0
  98. package/dist/vitalFlowSheet/index.d.ts.map +1 -0
  99. package/dist/vitalFlowSheet/useVitalFlowSheet.d.ts +20 -0
  100. package/dist/vitalFlowSheet/useVitalFlowSheet.d.ts.map +1 -0
  101. package/dist/vitalFlowSheet/utils.d.ts +48 -0
  102. package/dist/vitalFlowSheet/utils.d.ts.map +1 -0
  103. package/package.json +50 -0
package/LICENCE ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This Source Code Form is subject to the terms of the Mozilla Public License,
3
+ * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
+ * obtain one at http://mozilla.org/MPL/2.0/. Bahmni is also distributed under
5
+ * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
+ *
7
+ * Copyright 2025. Thoughtworks, Inc. Thoughtworks is a registered trademark
8
+ * and the Thoughtworks graphic logo is a trademark of Thoughtworks Inc.
9
+ */
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @bahmni/widgets
2
+
3
+ ## Description
4
+
5
+ Reusable React display controls and components extracted for sharing across Bahmni modules. This package includes common clinical widgets and notification provider to avoid code duplication across different Bahmni applications.
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Component to display patient allergies using SortableDataTable
4
+ */
5
+ declare const AllergiesTable: React.FC;
6
+ export default AllergiesTable;
7
+ //# sourceMappingURL=AllergiesTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllergiesTable.d.ts","sourceRoot":"","sources":["../../src/allergies/AllergiesTable.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAwBvC;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA0G3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as AllergiesTable } from './AllergiesTable';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/allergies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { FormattedAllergy } from '@bahmni/services';
2
+ interface UseAllergiesResult {
3
+ allergies: FormattedAllergy[];
4
+ loading: boolean;
5
+ error: Error | null;
6
+ refetch: () => void;
7
+ }
8
+ /**
9
+ * Custom hook to fetch and manage patient allergies
10
+ * @returns Object containing allergies, loading state, error state, and refetch function
11
+ */
12
+ export declare const useAllergies: () => UseAllergiesResult;
13
+ export {};
14
+ //# sourceMappingURL=useAllergies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAllergies.d.ts","sourceRoot":"","sources":["../../src/allergies/useAllergies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,kBAAkB,CAAC;AAK1B,UAAU,kBAAkB;IAC1B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,kBA6C/B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { AllergenType, FormattedAllergy } from '@bahmni/services';
2
+ /**
3
+ * Priority order for allergy severity levels (case insensitive)
4
+ * Index 0 = highest priority, higher index = lower priority
5
+ * Used for sorting allergies by medical severity: severe → moderate → mild
6
+ */
7
+ export declare const SEVERITY_PRIORITY_ORDER: string[];
8
+ /**
9
+ * Maps allergy types to their corresponding i18n translation keys
10
+ * @param type - The type of allergen
11
+ * @returns The i18n translation key for the allergen type
12
+ */
13
+ export declare const getCategoryDisplayName: (type: AllergenType | string | undefined | null) => string;
14
+ /**
15
+ * Maps allergy severity to i18n translation key
16
+ * @param severity - The severity level of the allergy
17
+ * @returns The i18n translation key for the severity
18
+ */
19
+ export declare const getSeverityDisplayName: (severity: string) => string;
20
+ /**
21
+ * Maps allergy severity to numeric priority for sorting
22
+ * Uses generic getPriorityByOrder function with SEVERITY_PRIORITY_ORDER
23
+ * @param severity - The severity level of the allergy
24
+ * @returns Numeric priority (lower = higher priority)
25
+ */
26
+ export declare const getSeverityPriority: (severity: string) => number;
27
+ /**
28
+ * Sorts allergies by severity priority: severe → moderate → mild
29
+ * Maintains stable sorting (preserves original order for same severity)
30
+ * @param allergies - Array of formatted allergies to sort
31
+ * @returns New sorted array (does not mutate original)
32
+ */
33
+ export declare const sortAllergiesBySeverity: (allergies: FormattedAllergy[]) => FormattedAllergy[];
34
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/allergies/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,UAAiC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,KAC7C,MAUF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,KAAG,MAWzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,KAAG,MAEtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,gBAAgB,EAAE,KAC5B,gBAAgB,EAIlB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export declare const conditionsQueryKeys: (patientUUID: string) => readonly ["conditions", string];
3
+ /**
4
+ * Component to display patient conditions using SortableDataTable
5
+ */
6
+ declare const ConditionsTable: React.FC;
7
+ export default ConditionsTable;
8
+ //# sourceMappingURL=ConditionsTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConditionsTable.d.ts","sourceRoot":"","sources":["../../src/conditions/ConditionsTable.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAQ5D,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,oCACjB,CAAC;AAUvC;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EA8F5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as ConditionsTable, conditionsQueryKeys, } from './ConditionsTable';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Enum representing the possible clinical statuses of a condition
3
+ */
4
+ export declare enum ConditionStatus {
5
+ Active = "active",
6
+ Inactive = "inactive"
7
+ }
8
+ /**
9
+ * Interface representing a formatted condition for easier consumption by components
10
+ */
11
+ export interface ConditionViewModel {
12
+ readonly id: string;
13
+ readonly display: string;
14
+ readonly status: ConditionStatus;
15
+ readonly onsetDate?: string;
16
+ readonly recordedDate?: string;
17
+ readonly recorder?: string;
18
+ readonly code: string;
19
+ readonly codeDisplay: string;
20
+ readonly note?: string[];
21
+ }
22
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/conditions/models.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B"}
@@ -0,0 +1,11 @@
1
+ import { Condition } from 'fhir/r4';
2
+ import { ConditionViewModel } from './models';
3
+ /**
4
+ * Transforms an array of FHIR Condition resources into conditions table view models.
5
+ * @param conditions - Array of FHIR Condition resources to transform
6
+ * @returns Array of ConditionViewModel view models ready for table rendering
7
+ * @throws {Error} When a condition is missing required fields (id, code, recordedDate)
8
+ * @throws {Error} When a condition lacks coding information in the code field
9
+ */
10
+ export declare function createConditionViewModels(conditions: Condition[]): ConditionViewModel[];
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/conditions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAmB,MAAM,UAAU,CAAC;AAgC/D;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,EAAE,GACtB,kBAAkB,EAAE,CAyBtB"}
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Component to display patient diagnoses using SortableDataTable
4
+ */
5
+ declare const DiagnosesTable: React.FC;
6
+ export default DiagnosesTable;
7
+ //# sourceMappingURL=DiagnosesTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagnosesTable.d.ts","sourceRoot":"","sources":["../../src/diagnoses/DiagnosesTable.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA0E3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as DiagnosesTable } from './DiagnosesTable';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnoses/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Diagnosis } from '@bahmni/services';
2
+ interface UseDiagnosesResult {
3
+ diagnoses: Diagnosis[];
4
+ loading: boolean;
5
+ error: Error | null;
6
+ refetch: () => void;
7
+ }
8
+ /**
9
+ * Custom hook to fetch and manage diagnoses for the current patient
10
+ * @returns Object containing diagnoses, loading state, error state, and refetch function
11
+ */
12
+ export declare const useDiagnoses: () => UseDiagnosesResult;
13
+ export default useDiagnoses;
14
+ //# sourceMappingURL=useDiagnoses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDiagnoses.d.ts","sourceRoot":"","sources":["../../src/diagnoses/useDiagnoses.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EACV,MAAM,kBAAkB,CAAC;AAI1B,UAAU,kBAAkB;IAC1B,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,kBAoC/B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Provider, User } from '@bahmni/services';
2
+ interface useActivePractitionerResult {
3
+ practitioner: Provider | null;
4
+ user: User | null;
5
+ loading: boolean;
6
+ error: Error | null;
7
+ refetch: () => void;
8
+ }
9
+ /**
10
+ * Custom hook to fetch and manage the active practitioner's details
11
+ * @returns Object containing practitioner, loading state, error state, and refetch function
12
+ */
13
+ export declare const useActivePractitioner: () => useActivePractitionerResult;
14
+ export {};
15
+ //# sourceMappingURL=useActivePractitioner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActivePractitioner.d.ts","sourceRoot":"","sources":["../../src/hooks/useActivePractitioner.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,IAAI,EAGL,MAAM,kBAAkB,CAAC;AAG1B,UAAU,2BAA2B;IACnC,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BA4CxC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Hook to retrieve the patient UUID from the URL
3
+ * @returns {string|null} The patient UUID or null if not found
4
+ */
5
+ export declare const usePatientUUID: () => string | null;
6
+ //# sourceMappingURL=usePatientUUID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePatientUUID.d.ts","sourceRoot":"","sources":["../../src/hooks/usePatientUUID.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,IAM1C,CAAC"}