@claudebernard/patient-profile-element 0.4.2 → 0.5.0

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.
@@ -373,8 +373,9 @@
373
373
  "kind": "field",
374
374
  "name": "apiUrl",
375
375
  "type": {
376
- "text": "string | undefined"
376
+ "text": "string"
377
377
  },
378
+ "default": "\"https://api-dev.claudebernard.fr\"",
378
379
  "attribute": "api-url"
379
380
  },
380
381
  {
@@ -409,22 +410,6 @@
409
410
  },
410
411
  "default": "\"ans\""
411
412
  },
412
- {
413
- "kind": "field",
414
- "name": "patientWeight",
415
- "type": {
416
- "text": "number"
417
- },
418
- "default": "0"
419
- },
420
- {
421
- "kind": "field",
422
- "name": "patientHeight",
423
- "type": {
424
- "text": "number"
425
- },
426
- "default": "0"
427
- },
428
413
  {
429
414
  "kind": "field",
430
415
  "name": "creatinineByMg",
@@ -553,14 +538,6 @@
553
538
  },
554
539
  "default": "\"\""
555
540
  },
556
- {
557
- "kind": "field",
558
- "name": "childPughErrorMessage",
559
- "type": {
560
- "text": "string"
561
- },
562
- "default": "\"\""
563
- },
564
541
  {
565
542
  "kind": "field",
566
543
  "name": "pathologyOptions",
@@ -689,14 +666,6 @@
689
666
  },
690
667
  "privacy": "private"
691
668
  },
692
- {
693
- "kind": "field",
694
- "name": "childPughInput",
695
- "type": {
696
- "text": "HTMLElement & { value: string }"
697
- },
698
- "privacy": "private"
699
- },
700
669
  {
701
670
  "kind": "field",
702
671
  "name": "ageUnitSelect",
@@ -813,47 +782,31 @@
813
782
  },
814
783
  {
815
784
  "kind": "method",
816
- "name": "recalculateRenalValues",
785
+ "name": "handleRenalConversion",
817
786
  "privacy": "private",
818
787
  "return": {
819
788
  "type": {
820
- "text": "void"
789
+ "text": "Promise<void>"
821
790
  }
822
- }
823
- },
824
- {
825
- "kind": "method",
826
- "name": "setFormWithCreatinineUmol",
827
- "privacy": "private",
828
- "return": {
829
- "type": {
830
- "text": "void"
831
- }
832
- }
833
- },
834
- {
835
- "kind": "method",
836
- "name": "setFormWithCreatinineMgL",
837
- "privacy": "private",
838
- "return": {
839
- "type": {
840
- "text": "void"
841
- }
842
- }
843
- },
844
- {
845
- "kind": "method",
846
- "name": "setFormWithClairance",
847
- "privacy": "private",
848
- "return": {
849
- "type": {
850
- "text": "void"
791
+ },
792
+ "parameters": [
793
+ {
794
+ "name": "type",
795
+ "type": {
796
+ "text": "number"
797
+ }
798
+ },
799
+ {
800
+ "name": "value",
801
+ "type": {
802
+ "text": "number"
803
+ }
851
804
  }
852
- }
805
+ ]
853
806
  },
854
807
  {
855
808
  "kind": "method",
856
- "name": "setFormWithDFG",
809
+ "name": "recalculateRenalValues",
857
810
  "privacy": "private",
858
811
  "return": {
859
812
  "type": {
@@ -951,26 +904,6 @@
951
904
  }
952
905
  ]
953
906
  },
954
- {
955
- "kind": "method",
956
- "name": "handleHepaticStade",
957
- "privacy": "private",
958
- "return": {
959
- "type": {
960
- "text": "void"
961
- }
962
- }
963
- },
964
- {
965
- "kind": "method",
966
- "name": "handleHepaticScore",
967
- "privacy": "private",
968
- "return": {
969
- "type": {
970
- "text": "void"
971
- }
972
- }
973
- },
974
907
  {
975
908
  "kind": "method",
976
909
  "name": "validateForm",
@@ -1001,8 +934,9 @@
1001
934
  {
1002
935
  "name": "api-url",
1003
936
  "type": {
1004
- "text": "string | undefined"
937
+ "text": "string"
1005
938
  },
939
+ "default": "\"https://api-dev.claudebernard.fr\"",
1006
940
  "fieldName": "apiUrl"
1007
941
  },
1008
942
  {
@@ -1283,6 +1217,52 @@
1283
1217
  }
1284
1218
  ]
1285
1219
  },
1220
+ {
1221
+ "kind": "javascript-module",
1222
+ "path": "src/shared/services/api-prescription.service.ts",
1223
+ "declarations": [
1224
+ {
1225
+ "kind": "function",
1226
+ "name": "convertRenalInsufficiency",
1227
+ "parameters": [
1228
+ {
1229
+ "name": "type",
1230
+ "type": {
1231
+ "text": "number"
1232
+ }
1233
+ },
1234
+ {
1235
+ "name": "value",
1236
+ "type": {
1237
+ "text": "number"
1238
+ }
1239
+ },
1240
+ {
1241
+ "name": "patient",
1242
+ "type": {
1243
+ "text": "any"
1244
+ }
1245
+ },
1246
+ {
1247
+ "name": "apiUrl",
1248
+ "type": {
1249
+ "text": "string"
1250
+ }
1251
+ }
1252
+ ]
1253
+ }
1254
+ ],
1255
+ "exports": [
1256
+ {
1257
+ "kind": "js",
1258
+ "name": "convertRenalInsufficiency",
1259
+ "declaration": {
1260
+ "name": "convertRenalInsufficiency",
1261
+ "module": "src/shared/services/api-prescription.service.ts"
1262
+ }
1263
+ }
1264
+ ]
1265
+ },
1286
1266
  {
1287
1267
  "kind": "javascript-module",
1288
1268
  "path": "src/shared/services/api-search.service.ts",
@@ -8,22 +8,6 @@ function calculateBMI(weight, height) {
8
8
  const heightInMeters = height / 100;
9
9
  return Math.round(weight / (heightInMeters * heightInMeters) * 10) / 10;
10
10
  }
11
- function calculateCreatinineClearance(age, weight, scrMgdl, isFemale) {
12
- const sexFactor = isFemale ? 0.85 : 1;
13
- return (140 - age) * weight * sexFactor / (72 * scrMgdl);
14
- }
15
- function convertCreatinineUmolToMgdL(creatinineUmolL) {
16
- return creatinineUmolL / 88.4;
17
- }
18
- function convertCreatinineMgdLToUmol(creatinineMgdL) {
19
- return creatinineMgdL * 88.4;
20
- }
21
- function convertCreatinineMgdLToMgL(creatinineMgdL) {
22
- return creatinineMgdL * 10;
23
- }
24
- function convertCreatinineMgLToMgdL(creatinineMgL) {
25
- return creatinineMgL / 10;
26
- }
27
11
  const isStrTagged = (val) => typeof val !== "string" && "strTag" in val;
28
12
  const joinStringsAndValues = (strings, values, valueOrder) => {
29
13
  let concat = strings[0];
@@ -824,17 +808,6 @@ function umolLToMgl(umolL) {
824
808
  function round2(n3) {
825
809
  return Math.round(n3 * 100) / 100;
826
810
  }
827
- function getPatientHepaticInsufficiencyScore(bundle) {
828
- const obs = bundle?.entry?.find(
829
- (entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
830
- (coding) => coding.code === "98152-2"
831
- )
832
- )?.resource;
833
- if (obs?.valueQuantity?.value) {
834
- return obs?.valueQuantity?.value;
835
- }
836
- return null;
837
- }
838
811
  function getPatientHepaticInsufficiencyStade(bundle) {
839
812
  const obs = bundle?.entry?.find(
840
813
  (entry) => entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
@@ -898,77 +871,12 @@ function setPatientHepaticInsufficiencyStatus(bundle, stade, score) {
898
871
  bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
899
872
  } else {
900
873
  obs.valueCodeableConcept = stadeConcept;
901
- if (!score) {
874
+ {
902
875
  delete obs.valueQuantity;
903
- } else {
904
- const stadeOfScore = childPughScore(score).replace("Stade ", "");
905
- if (stadeOfScore === stade) {
906
- obs.valueQuantity = {
907
- value: score,
908
- unit: "score",
909
- system: "http://unitsofmeasure.org",
910
- code: "{score}"
911
- };
912
- } else {
913
- delete obs.valueQuantity;
914
- }
915
876
  }
916
877
  }
917
878
  return;
918
879
  }
919
- if (typeof score === "number" && !isNaN(score)) {
920
- const newObsValueQuantity = {
921
- value: score,
922
- unit: "score",
923
- system: "http://unitsofmeasure.org",
924
- code: "{score}"
925
- };
926
- const stadeLabel = childPughScore(score);
927
- const stadeLetter = stadeLabel.replace("Stade ", "");
928
- const snomedCode = childPughStadeToSnomedMap[stadeLetter];
929
- const stadeConcept = snomedCode ? {
930
- coding: [
931
- {
932
- system: "http://snomed.info/sct",
933
- code: snomedCode,
934
- display: `Child-Pugh score class ${stadeLetter}`
935
- }
936
- ],
937
- text: `Stade ${stadeLetter}`
938
- } : void 0;
939
- if (!obs) {
940
- const obsId = generateUUID();
941
- obs = {
942
- resourceType: "Observation",
943
- id: obsId,
944
- status: "final",
945
- code: {
946
- coding: [
947
- {
948
- system: "http://loinc.org",
949
- code: "98152-2",
950
- display: "Child-Pugh score"
951
- }
952
- ],
953
- text: "Score de Child-Pugh"
954
- },
955
- subject: {
956
- reference: getPatientFullUrl(bundle)
957
- },
958
- valueQuantity: newObsValueQuantity,
959
- ...stadeConcept ? { valueCodeableConcept: stadeConcept } : {}
960
- };
961
- bundle.entry = bundle.entry || [];
962
- bundle.entry.push({ fullUrl: `Observation/${obsId}`, resource: obs });
963
- } else {
964
- obs.valueQuantity = newObsValueQuantity;
965
- if (stadeConcept) {
966
- obs.valueCodeableConcept = stadeConcept;
967
- } else {
968
- delete obs.valueCodeableConcept;
969
- }
970
- }
971
- }
972
880
  }
973
881
  function deletePatientHepaticInsufficiencyStatus(bundle) {
974
882
  bundle.entry = bundle.entry?.filter((entry) => !(entry.resource?.resourceType === "Observation" && entry.resource.code?.coding?.some(
@@ -1127,16 +1035,6 @@ function childPughScore(score) {
1127
1035
  }
1128
1036
  return msg("Stade C");
1129
1037
  }
1130
- function calculateGFRFromCreatinine(age, isFemale, creatinine) {
1131
- const sexFactor = isFemale ? 0.742 : 1;
1132
- const gfr = 186 * (creatinine * 0.0113) ** -1.154 * age ** -0.203 * sexFactor;
1133
- return round2(gfr);
1134
- }
1135
- function calculateCreatinineFromGFR(age, isFemale, gfr) {
1136
- const sexFactor = isFemale ? 0.742 : 1;
1137
- const creatinine = 1 / 0.0113 * (gfr / (sexFactor * 186 * age ** -0.203)) ** (-1 / 1.154);
1138
- return round2(creatinine);
1139
- }
1140
1038
  const t$2 = globalThis, e$4 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = /* @__PURE__ */ Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
1141
1039
  let n$3 = class n {
1142
1040
  constructor(t2, e2, o2) {
@@ -1681,7 +1579,7 @@ function e(e2, r2) {
1681
1579
  } });
1682
1580
  };
1683
1581
  }
1684
- const patientProfileCSS = '@charset "UTF-8";\n.claudebernard-patient-profile {\n font-family: var(--custom-font-family, "Ubuntu"), sans-serif;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n padding: 1rem;\n border-radius: 0.5rem;\n background-color: var(--bcbd-white-color, #FFFFFF);\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__no-profile {\n display: flex;\n flex-direction: column;\n gap: 0.3rem;\n}\n.claudebernard-patient-profile__no-profile__first {\n font-weight: bold;\n}\n.claudebernard-patient-profile__no-profile__second {\n color: var(--bcbd-gray-500-color, #64748B);\n font-size: 0.8rem;\n}\n.claudebernard-patient-profile__separator {\n border-right: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n}\n.claudebernard-patient-profile__first-info-container {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n gap: 0.5rem;\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__first-info-container {\n flex-direction: column;\n gap: 1rem;\n align-items: center;\n }\n}\n.claudebernard-patient-profile__id-info-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__name-info {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__id-info {\n width: fit-content;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n border-radius: 1rem;\n display: flex;\n flex-direction: row;\n padding: 0 0.8rem;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__id-info-info {\n padding: 0.2rem 0;\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-container {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__physical-info-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__physical-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n padding: 1rem 0;\n}\n.claudebernard-patient-profile__physical-info-result {\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-label {\n color: var(--bcbd-gray-600-color, #475569);\n}\n.claudebernard-patient-profile__action-buttons-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n flex-wrap: wrap;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__action-buttons-container {\n gap: 0.5rem;\n }\n}\n.claudebernard-patient-profile__second-info-container {\n margin-top: 1rem;\n display: none;\n}\n.claudebernard-patient-profile__second-info-container.active {\n display: flex;\n flex-direction: column;\n}\n.claudebernard-patient-profile__second-info {\n margin-top: 1rem;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip {\n display: inline-block;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip > span {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__second-info-label {\n padding-right: 0.5rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__second-info-label {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__second-info-result.sep-dots > * + *::before {\n content: "•";\n margin: 0 0.5rem;\n}';
1582
+ const patientProfileCSS = '@charset "UTF-8";\n:host {\n container-type: inline-size;\n}\n\n.claudebernard-patient-profile {\n font-family: var(--custom-font-family, "Ubuntu"), sans-serif;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n padding: 1rem;\n border-radius: 0.5rem;\n background-color: var(--bcbd-white-color, #FFFFFF);\n container-type: inline-size;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__no-profile {\n display: flex;\n flex-direction: column;\n gap: 0.3rem;\n}\n.claudebernard-patient-profile__no-profile__first {\n font-weight: bold;\n}\n.claudebernard-patient-profile__no-profile__second {\n color: var(--bcbd-gray-500-color, #64748B);\n font-size: 0.8rem;\n}\n.claudebernard-patient-profile__separator {\n border-right: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n}\n.claudebernard-patient-profile__first-info-container {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n gap: 0.5rem;\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__first-info-container {\n flex-wrap: wrap;\n gap: 1rem;\n align-items: center;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__first-info-container {\n justify-content: center;\n }\n}\n.claudebernard-patient-profile__id-info-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.5rem;\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__id-info-container {\n flex: 1;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__id-info-container {\n flex: 0 0 auto;\n align-items: center;\n }\n}\n.claudebernard-patient-profile__name-info {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__id-info {\n width: fit-content;\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n border-radius: 1rem;\n display: flex;\n flex-direction: row;\n padding: 0 0.8rem;\n gap: 0.5rem;\n}\n.claudebernard-patient-profile__id-info-info {\n padding: 0.2rem 0;\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-container {\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__physical-info-container {\n gap: 0.5rem;\n }\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__physical-info-container {\n order: 3;\n width: 100%;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__physical-info-container {\n order: 2;\n }\n}\n.claudebernard-patient-profile__physical-info {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n padding: 1rem 0;\n}\n.claudebernard-patient-profile__physical-info-result {\n white-space: nowrap;\n}\n.claudebernard-patient-profile__physical-info-label {\n color: var(--bcbd-gray-600-color, #475569);\n}\n.claudebernard-patient-profile__action-buttons-container {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-content: center;\n flex-wrap: wrap;\n gap: 1rem;\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__action-buttons-container {\n gap: 0.5rem;\n }\n}\n@container (max-width: 450px) {\n .claudebernard-patient-profile__action-buttons-container {\n order: 2;\n margin: 0 auto;\n }\n}\n@container (max-width: 320px) {\n .claudebernard-patient-profile__action-buttons-container {\n order: 3;\n }\n}\n.claudebernard-patient-profile__second-info-container {\n margin-top: 1rem;\n display: none;\n}\n.claudebernard-patient-profile__second-info-container.active {\n display: flex;\n flex-direction: column;\n}\n.claudebernard-patient-profile__second-info {\n margin-top: 1rem;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip {\n display: inline-block;\n}\n.claudebernard-patient-profile__second-info bcbd-tooltip > span {\n font-size: 1rem;\n}\n.claudebernard-patient-profile__second-info-label {\n padding-right: 0.5rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n@container (max-width: 600px) {\n .claudebernard-patient-profile__second-info-label {\n font-size: 0.8rem;\n }\n}\n.claudebernard-patient-profile__second-info-result.sep-dots > * + *::before {\n content: "•";\n margin: 0 0.5rem;\n}';
1685
1583
  const sexOptions = [
1686
1584
  { value: "male", label: "Masculin" },
1687
1585
  { value: "female", label: "Féminin" },
@@ -1717,6 +1615,20 @@ const fetchMoleculesByTerm = async (term, params, apiUrl) => {
1717
1615
  return response.json();
1718
1616
  };
1719
1617
  const patientProfileEditionCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\n}\n.claudebernard-edition-modal-content {\n display: flex;\n flex-direction: column;\n width: 100%;\n min-width: 60vw;\n height: 100%;\n max-height: 60vh;\n gap: 16px;\n}\n.claudebernard-edition-modal-large-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n width: 100%;\n}\n.claudebernard-edition-modal-information-section {\n display: flex;\n flex-direction: row;\n gap: 16px;\n}\n.claudebernard-edition-modal-little-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n flex: 1;\n min-width: 0;\n}\n.claudebernard-edition-modal-little-section bcbd-input {\n height: 100%;\n}\n.claudebernard-edition-modal-pregnant-div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.claudebernard-edition-modal-pregnant-div bcbd-input {\n width: 40% !important;\n}\n.claudebernard-edition-modal-action-buttons {\n display: flex;\n justify-content: flex-end;\n height: 100%;\n gap: 16px;\n padding-top: 10px;\n padding-bottom: 30px;\n align-items: flex-end;\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-age-input-group {\n display: flex;\n gap: 8px;\n}\n.claudebernard-edition-modal-age-input-group bcbd-input {\n width: 50% !important;\n}\n.claudebernard-edition-modal-age-input-group bcbd-select {\n width: 50% !important;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n margin-inline: 0;\n border-radius: 4px;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.claudebernard-edition-modal-disclaimer-section {\n font-size: 0.8rem;\n}\n\nbcbd-checkbox {\n --bcbd-checkbox-font-size: .9rem;\n}";
1618
+ const convertRenalInsufficiency = async (type, value, patient, apiUrl) => {
1619
+ const response = await fetch(`${apiUrl}/prescription/patient/fhir/renal-insufficiency-conversion`, {
1620
+ method: "POST",
1621
+ headers: {
1622
+ "Content-Type": "application/json"
1623
+ },
1624
+ body: JSON.stringify({
1625
+ typeEntree: type,
1626
+ valeur: value,
1627
+ patient
1628
+ })
1629
+ });
1630
+ return response.json();
1631
+ };
1720
1632
  var __defProp$1 = Object.defineProperty;
1721
1633
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
1722
1634
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -1730,10 +1642,9 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
1730
1642
  let PatientProfileEdition = class extends i {
1731
1643
  constructor() {
1732
1644
  super(...arguments);
1645
+ this.apiUrl = "https://api-dev.claudebernard.fr";
1733
1646
  this.patientAge = 0;
1734
1647
  this.patientUnitAge = "ans";
1735
- this.patientWeight = 0;
1736
- this.patientHeight = 0;
1737
1648
  this.creatinineByMg = 0;
1738
1649
  this.creatinineByUmol = 0;
1739
1650
  this.clairanceCreatinine = 0;
@@ -1750,7 +1661,6 @@ let PatientProfileEdition = class extends i {
1750
1661
  this.pathologiesApiErrorMessage = "";
1751
1662
  this.allergiesApiErrorMessage = "";
1752
1663
  this.renalLackInformationErrorMessage = "";
1753
- this.childPughErrorMessage = "";
1754
1664
  this.pathologyOptions = [];
1755
1665
  this.allergyOptions = [];
1756
1666
  this.selectedPathologyOptions = [];
@@ -1889,129 +1799,53 @@ let PatientProfileEdition = class extends i {
1889
1799
  handleBreastfeeding(event) {
1890
1800
  this.breastfeeding = event.detail;
1891
1801
  }
1802
+ async handleRenalConversion(type, value) {
1803
+ if (isNaN(value) || value <= 0) {
1804
+ return;
1805
+ }
1806
+ try {
1807
+ const result = await convertRenalInsufficiency(
1808
+ type,
1809
+ value,
1810
+ this.patientProfile,
1811
+ this.apiUrl
1812
+ );
1813
+ if (result.error) {
1814
+ this.renalLackInformationErrorMessage = result.error;
1815
+ return;
1816
+ }
1817
+ this.renalLackInformationErrorMessage = "";
1818
+ if (type !== 1) {
1819
+ this.creatinineByUmol = Math.round(result.creatinineUmolL * 100) / 100;
1820
+ }
1821
+ if (type !== 2) {
1822
+ this.creatinineByMg = Math.round(result.creatinineMgL * 100) / 100;
1823
+ }
1824
+ if (type !== 3) {
1825
+ this.clairanceCreatinine = Math.round(result.creatinineClearance * 100) / 100;
1826
+ }
1827
+ if (type !== 4) {
1828
+ this.dfg = Math.round(result.gfr * 100) / 100;
1829
+ }
1830
+ } catch {
1831
+ this.renalLackInformationErrorMessage = "Erreur lors de la conversion de l'insuffisance rénale";
1832
+ }
1833
+ }
1892
1834
  recalculateRenalValues() {
1893
1835
  const creatinineUmol = Number(this.creatinineUmolInput?.value ?? "");
1894
1836
  const creatinineMg = Number(this.creatinineMgLInput?.value ?? "");
1895
1837
  const clairance = Number(this.clairanceCreatinineInput?.value ?? "");
1896
1838
  const dfg = Number(this.dfgInput?.value ?? "");
1897
1839
  if (!isNaN(creatinineUmol) && creatinineUmol > 0) {
1898
- this.setFormWithCreatinineUmol();
1840
+ this.handleRenalConversion(1, creatinineUmol);
1899
1841
  } else if (!isNaN(creatinineMg) && creatinineMg > 0) {
1900
- this.setFormWithCreatinineMgL();
1842
+ this.handleRenalConversion(2, creatinineMg);
1901
1843
  } else if (!isNaN(clairance) && clairance > 0) {
1902
- this.setFormWithClairance();
1844
+ this.handleRenalConversion(3, clairance);
1903
1845
  } else if (!isNaN(dfg) && dfg > 0) {
1904
- this.setFormWithDFG();
1846
+ this.handleRenalConversion(4, dfg);
1905
1847
  }
1906
1848
  }
1907
- setFormWithCreatinineUmol() {
1908
- const inputValue = Number(this.creatinineUmolInput?.value ?? "");
1909
- if (isNaN(inputValue) || inputValue <= 0) {
1910
- this.renalLackInformationErrorMessage = "";
1911
- return;
1912
- }
1913
- this.creatinineByUmol = inputValue;
1914
- const scrMgdl = convertCreatinineUmolToMgdL(inputValue);
1915
- if (scrMgdl <= 0) {
1916
- return;
1917
- }
1918
- const age = Number(this.ageInput?.value);
1919
- const weight = Number(this.weightInput?.value);
1920
- const gender = this.genderSelect?.value;
1921
- if (!age || !weight || !gender) {
1922
- this.clairanceCreatinine = 0;
1923
- this.creatinineByMg = 0;
1924
- this.renalLackInformationErrorMessage = "Pour faire les calculs à partir des données de l'insuffisance rénale, il faut que l'âge, le poids et le sexe soient renseignés. Les informations contenues dans cette partie ne seront pas pris en compte.";
1925
- return;
1926
- }
1927
- const isFemale = gender === "Femme";
1928
- const clearance = calculateCreatinineClearance(age, weight, scrMgdl, isFemale);
1929
- this.clairanceCreatinine = Math.round(clearance);
1930
- const scrMgl = convertCreatinineMgdLToMgL(scrMgdl);
1931
- this.creatinineByMg = Math.round(scrMgl);
1932
- this.dfg = Math.round(calculateGFRFromCreatinine(age, isFemale, inputValue));
1933
- this.renalLackInformationErrorMessage = "";
1934
- }
1935
- setFormWithCreatinineMgL() {
1936
- const inputValue = Number(this.creatinineMgLInput?.value ?? "");
1937
- if (isNaN(inputValue) || inputValue <= 0) {
1938
- this.renalLackInformationErrorMessage = "";
1939
- return;
1940
- }
1941
- this.creatinineByMg = inputValue;
1942
- const scrMgdl = convertCreatinineMgLToMgdL(inputValue);
1943
- if (scrMgdl <= 0) {
1944
- return;
1945
- }
1946
- const age = Number(this.ageInput?.value);
1947
- const weight = Number(this.weightInput?.value);
1948
- const gender = this.genderSelect?.value;
1949
- const isFemale = gender === "Femme";
1950
- if (!age || !weight || !gender) {
1951
- this.clairanceCreatinine = 0;
1952
- this.creatinineByUmol = 0;
1953
- this.renalLackInformationErrorMessage = "Pour faire les calculs à partir des données de l'insuffisance rénale, il faut que l'âge, le poids et le sexe soient renseignés. Les informations contenues dans cette partie ne seront pas pris en compte.";
1954
- return;
1955
- }
1956
- const clearance = calculateCreatinineClearance(age, weight, scrMgdl, isFemale);
1957
- this.clairanceCreatinine = Math.round(clearance);
1958
- const scrUmolL = convertCreatinineMgdLToUmol(scrMgdl);
1959
- this.creatinineByUmol = Math.round(scrUmolL);
1960
- this.dfg = Math.round(calculateGFRFromCreatinine(age, isFemale, scrUmolL));
1961
- this.renalLackInformationErrorMessage = "";
1962
- }
1963
- setFormWithClairance() {
1964
- const inputValue = Number(this.clairanceCreatinineInput?.value ?? "");
1965
- if (isNaN(inputValue) || inputValue <= 0) {
1966
- this.renalLackInformationErrorMessage = "";
1967
- return;
1968
- }
1969
- this.clairanceCreatinine = inputValue;
1970
- const age = Number(this.ageInput?.value);
1971
- const weight = Number(this.weightInput?.value);
1972
- const gender = this.genderSelect?.value;
1973
- if (!age || !weight || !gender) {
1974
- this.creatinineByMg = 0;
1975
- this.creatinineByUmol = 0;
1976
- this.renalLackInformationErrorMessage = "Pour faire les calculs à partir des données de l'insuffisance rénale, il faut que l'âge, le poids et le sexe soient renseignés. Les informations contenues dans cette partie ne seront pas pris en compte.";
1977
- return;
1978
- }
1979
- const isFemale = gender === "Femme";
1980
- const computed = computeCreatinineFromClearance(inputValue, age, weight, isFemale);
1981
- const creatinineByMg = computed.find((c2) => c2.unit?.toLowerCase() === "mg/l");
1982
- const creatinineByUmol = computed.find((c2) => c2.unit === "μmol/L");
1983
- this.creatinineByMg = creatinineByMg?.value ?? 0;
1984
- this.creatinineByMg = Math.round(this.creatinineByMg);
1985
- this.creatinineByUmol = creatinineByUmol?.value ?? 0;
1986
- this.creatinineByUmol = Math.round(this.creatinineByUmol);
1987
- this.dfg = Math.round(calculateGFRFromCreatinine(age, isFemale, creatinineByUmol?.value ?? 0));
1988
- this.renalLackInformationErrorMessage = "";
1989
- }
1990
- setFormWithDFG() {
1991
- const inputValue = Number(this.dfgInput?.value ?? "");
1992
- if (isNaN(inputValue) || inputValue <= 0) {
1993
- this.renalLackInformationErrorMessage = "";
1994
- return;
1995
- }
1996
- this.dfg = inputValue;
1997
- const age = Number(this.ageInput?.value);
1998
- const weight = Number(this.weightInput?.value);
1999
- const gender = this.genderSelect?.value;
2000
- if (!age || !weight || !gender) {
2001
- this.creatinineByMg = 0;
2002
- this.creatinineByUmol = 0;
2003
- this.renalLackInformationErrorMessage = "Pour faire les calculs à partir des données de l'insuffisance rénale, il faut que l'âge, le poids et le sexe soient renseignés. Les informations contenues dans cette partie ne seront pas pris en compte.";
2004
- return;
2005
- }
2006
- const isFemale = gender === "Femme";
2007
- const creatinine = calculateCreatinineFromGFR(age, isFemale, this.dfg);
2008
- this.creatinineByUmol = Math.round(creatinine);
2009
- const scrMgdl = convertCreatinineUmolToMgdL(creatinine);
2010
- this.creatinineByMg = Math.round(convertCreatinineMgdLToMgL(scrMgdl));
2011
- const clearance = calculateCreatinineClearance(age, weight, scrMgdl, isFemale);
2012
- this.clairanceCreatinine = Math.round(clearance);
2013
- this.renalLackInformationErrorMessage = "";
2014
- }
2015
1849
  apiReturntoSelectOption(pathology) {
2016
1850
  return {
2017
1851
  value: pathology.code,
@@ -2070,27 +1904,6 @@ let PatientProfileEdition = class extends i {
2070
1904
  this.selectedAllergyOptions = [...updatedSelections, ...newSelections];
2071
1905
  this.allergyOptions = [];
2072
1906
  }
2073
- handleHepaticStade() {
2074
- this.childPughInput.value = "";
2075
- }
2076
- handleHepaticScore() {
2077
- const childPughInputScore = Number(this.childPughInput?.value ?? "");
2078
- if (isNaN(childPughInputScore) || childPughInputScore <= 0) {
2079
- this.defaultHepaticStade = {};
2080
- this.childPughErrorMessage = "";
2081
- } else {
2082
- if (childPughInputScore < 5 || childPughInputScore > 15) {
2083
- this.childPughErrorMessage = "Le score Child-Pugh doit être compris entre 5 et 15";
2084
- } else {
2085
- this.childPughErrorMessage = "";
2086
- }
2087
- const stade = childPughScore(childPughInputScore);
2088
- const selectedOption = hepaticStadeOptions.find((option) => option.label === stade);
2089
- if (selectedOption) {
2090
- this.defaultHepaticStade = { value: selectedOption.value, label: selectedOption.label };
2091
- }
2092
- }
2093
- }
2094
1907
  // eslint-disable-next-line complexity
2095
1908
  validateForm() {
2096
1909
  if (!this.patientProfile || Object.keys(this.patientProfile).length === 0) {
@@ -2107,7 +1920,6 @@ let PatientProfileEdition = class extends i {
2107
1920
  const dfg = Number(this.dfgInput?.value ?? "");
2108
1921
  const gestationalWeeks = Number(this.gestationalWeeksInput?.value ?? "");
2109
1922
  const hepaticStade = this.hepaticStadeSelect?.value ?? "";
2110
- const childPughScore2 = Number(this.childPughInput?.value ?? "");
2111
1923
  if (age > 0) {
2112
1924
  setPatientAge(this.patientProfile, age, ageUnit);
2113
1925
  }
@@ -2133,7 +1945,7 @@ let PatientProfileEdition = class extends i {
2133
1945
  setPatientGFRByBSA(this.patientProfile, dfg);
2134
1946
  }
2135
1947
  if (hepaticStade === "A" || hepaticStade === "B" || hepaticStade === "C") {
2136
- setPatientHepaticInsufficiencyStatus(this.patientProfile, hepaticStade, childPughScore2);
1948
+ setPatientHepaticInsufficiencyStatus(this.patientProfile, hepaticStade);
2137
1949
  } else {
2138
1950
  deletePatientHepaticInsufficiencyStatus(this.patientProfile);
2139
1951
  }
@@ -2225,21 +2037,21 @@ let PatientProfileEdition = class extends i {
2225
2037
  <div class="${PREFIX}-edition-modal-information-section">
2226
2038
  <div class="${PREFIX}-edition-modal-little-section">
2227
2039
  <span>Créatininémie (μmol/L)</span>
2228
- <bcbd-input data-test-id="creatinine-umol-input" id="creatinineUmolInput" type="number" aria-label="Créatininémie (μmol/L)" .value=${this.creatinineByUmol <= 0 ? "" : this.creatinineByUmol} warning-msg="" @change=${this.setFormWithCreatinineUmol}></bcbd-input>
2040
+ <bcbd-input data-test-id="creatinine-umol-input" id="creatinineUmolInput" type="number" aria-label="Créatininémie (μmol/L)" .value=${this.creatinineByUmol <= 0 ? "" : this.creatinineByUmol} warning-msg="" @change=${() => this.handleRenalConversion(1, Number(this.creatinineUmolInput?.value ?? 0))}></bcbd-input>
2229
2041
  </div>
2230
2042
  <div class="${PREFIX}-edition-modal-little-section">
2231
2043
  <span>Créatininémie (mg/L)</span>
2232
- <bcbd-input data-test-id="creatinine-mgl-input" id="creatininemgLInput" type="number" aria-label="Créatininémie (mg/L)" .value=${this.creatinineByMg <= 0 ? "" : this.creatinineByMg} warning-msg="" @change=${this.setFormWithCreatinineMgL}></bcbd-input>
2044
+ <bcbd-input data-test-id="creatinine-mgl-input" id="creatininemgLInput" type="number" aria-label="Créatininémie (mg/L)" .value=${this.creatinineByMg <= 0 ? "" : this.creatinineByMg} warning-msg="" @change=${() => this.handleRenalConversion(2, Number(this.creatinineMgLInput?.value ?? 0))}></bcbd-input>
2233
2045
  </div>
2234
2046
  </div>
2235
2047
  <div class="${PREFIX}-edition-modal-information-section">
2236
2048
  <div class="${PREFIX}-edition-modal-little-section">
2237
2049
  <span>Clairance créatinine (ml/min)</span>
2238
- <bcbd-input data-test-id="clearance-input" id="clairanceCreatinineInput" type="number" aria-label="Clairance créatinine (ml/min)" .value=${this.clairanceCreatinine <= 0 ? "" : this.clairanceCreatinine} warning-msg="" @change=${this.setFormWithClairance}></bcbd-input>
2050
+ <bcbd-input data-test-id="clearance-input" id="clairanceCreatinineInput" type="number" aria-label="Clairance créatinine (ml/min)" .value=${this.clairanceCreatinine <= 0 ? "" : this.clairanceCreatinine} warning-msg="" @change=${() => this.handleRenalConversion(3, Number(this.clairanceCreatinineInput?.value ?? 0))}></bcbd-input>
2239
2051
  </div>
2240
2052
  <div class="${PREFIX}-edition-modal-little-section">
2241
2053
  <span>DFG (mL/min/1.73.m2)</span>
2242
- <bcbd-input data-test-id="dfg-input" id="dfgInput" type="number" aria-label="DFG (mL/min/1.73.m2)" .value=${this.dfg <= 0 ? "" : this.dfg} warning-msg="" @change=${this.setFormWithDFG}></bcbd-input>
2054
+ <bcbd-input data-test-id="dfg-input" id="dfgInput" type="number" aria-label="DFG (mL/min/1.73.m2)" .value=${this.dfg <= 0 ? "" : this.dfg} warning-msg="" @change=${() => this.handleRenalConversion(4, Number(this.dfgInput?.value ?? 0))}></bcbd-input>
2243
2055
  </div>
2244
2056
  </div>
2245
2057
  </fieldset>
@@ -2252,16 +2064,9 @@ let PatientProfileEdition = class extends i {
2252
2064
  <div class="${PREFIX}-edition-modal-little-section">
2253
2065
  <span>Stade de l'insuffisance hépatique</span>
2254
2066
  <bcbd-select data-test-id="hepatic-stade-select" id="hepaticStadeSelect"
2255
- .options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade} clearable
2256
- @change=${this.handleHepaticStade}>
2067
+ .options=${hepaticStadeOptions} .selectedOptions=${this.defaultHepaticStade} clearable>
2257
2068
  </bcbd-select>
2258
2069
  </div>
2259
- <div class="${PREFIX}-edition-modal-little-section">
2260
- <span>Score de Child-Pugh</span>
2261
- <bcbd-input data-test-id="hepatic-score-input" id="childPughInput" type="number" aria-label="Score de Child-Pugh" warning-msg=""
2262
- .value=${getPatientHepaticInsufficiencyScore(this.patientProfile)} @change=${this.handleHepaticScore}></bcbd-input>
2263
- ${this.childPughErrorMessage !== "" ? b`<span class="${PREFIX}-edition-modal-error-message">${this.childPughErrorMessage}</span>` : b` `}
2264
- </div>
2265
2070
  </div>
2266
2071
  </fieldset>
2267
2072
 
@@ -2270,7 +2075,7 @@ let PatientProfileEdition = class extends i {
2270
2075
  </div>
2271
2076
 
2272
2077
  <div class="${PREFIX}-edition-modal-action-buttons" data-test-id="action-buttons">
2273
- <bcbd-button ?disabled=${this.ageErrorMessageInput !== "" || this.sizeErrorMessageInput !== "" || this.weightErrorMessageInput !== "" || this.childPughErrorMessage !== ""}
2078
+ <bcbd-button ?disabled=${this.ageErrorMessageInput !== "" || this.sizeErrorMessageInput !== "" || this.weightErrorMessageInput !== ""}
2274
2079
  data-test-id="save-button" background-color="primary" @click=${this.validateForm}>Valider</bcbd-button>
2275
2080
  <bcbd-button data-test-id="cancel-button" outlined background-color="black" @click=${() => this.editionModalElement.close()}>Annuler</bcbd-button>
2276
2081
  </div>
@@ -2297,12 +2102,6 @@ __decorateClass$1([
2297
2102
  __decorateClass$1([
2298
2103
  r()
2299
2104
  ], PatientProfileEdition.prototype, "patientUnitAge", 2);
2300
- __decorateClass$1([
2301
- r()
2302
- ], PatientProfileEdition.prototype, "patientWeight", 2);
2303
- __decorateClass$1([
2304
- r()
2305
- ], PatientProfileEdition.prototype, "patientHeight", 2);
2306
2105
  __decorateClass$1([
2307
2106
  r()
2308
2107
  ], PatientProfileEdition.prototype, "creatinineByMg", 2);
@@ -2351,9 +2150,6 @@ __decorateClass$1([
2351
2150
  __decorateClass$1([
2352
2151
  r()
2353
2152
  ], PatientProfileEdition.prototype, "renalLackInformationErrorMessage", 2);
2354
- __decorateClass$1([
2355
- r()
2356
- ], PatientProfileEdition.prototype, "childPughErrorMessage", 2);
2357
2153
  __decorateClass$1([
2358
2154
  r()
2359
2155
  ], PatientProfileEdition.prototype, "pathologyOptions", 2);
@@ -2402,9 +2198,6 @@ __decorateClass$1([
2402
2198
  __decorateClass$1([
2403
2199
  e("#hepaticStadeSelect")
2404
2200
  ], PatientProfileEdition.prototype, "hepaticStadeSelect", 2);
2405
- __decorateClass$1([
2406
- e("#childPughInput")
2407
- ], PatientProfileEdition.prototype, "childPughInput", 2);
2408
2201
  __decorateClass$1([
2409
2202
  e("#ageUnitSelect")
2410
2203
  ], PatientProfileEdition.prototype, "ageUnitSelect", 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudebernard/patient-profile-element",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "main": "dist/patient-profile.es.js",
5
5
  "module": "dist/patient-profile.es.js",
6
6
  "types": "dist/patient-profile.d.ts",