@claudebernard/patient-profile-element 0.1.4 → 0.2.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.
@@ -20,7 +20,7 @@
20
20
  "type": {
21
21
  "text": "Story"
22
22
  },
23
- "default": "{\n play: async({ canvasElement, step }) => {\n const component = canvasElement.querySelector(\"bcb-patient-profile\") as HTMLElement | null;\n\n await step(\"Verify the patient ID information\", () => {\n const divName = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-name\\\"]\") as HTMLElement | null;\n expect(divName?.textContent).toContain(\"Marie Dupont\");\n\n const divGender = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-gender\\\"]\") as HTMLElement | null;\n expect(divGender?.textContent).toContain(\"Femme\");\n\n const divAge = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-age\\\"]\") as HTMLElement | null;\n expect(divAge?.textContent).toContain(\"41 ans\");\n });\n\n await step(\"Verify the patient physical information\", () => {\n const divHeight = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-height\\\"]\") as HTMLElement | null;\n const textHeight = divHeight?.textContent ?? \"\";\n expect(textHeight).toContain(\"Taille\");\n expect(textHeight).toContain(\"170\");\n expect(textHeight).toContain(\"cm\");\n\n const divWeight = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-weight\\\"]\") as HTMLElement | null;\n const textWeight = divWeight?.textContent ?? \"\";\n expect(textWeight).toContain(\"Poids\");\n expect(textWeight).toContain(\"84\");\n expect(textWeight).toContain(\"kg\");\n\n const divIMC = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-IMC\\\"]\") as HTMLElement | null;\n expect(divIMC?.textContent).toContain(\"29.1\");\n });\n\n const divActions = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"action-buttons\\\"]\") as HTMLElement | null;\n const modifyButton = divActions?.querySelector(\"bcbd-button[data-test-id=\\\"modify-button\\\"]\") as HTMLElement | null;\n const visibleButton = divActions?.querySelector(\"bcbd-button[data-test-id=\\\"visible-button\\\"]\") as HTMLElement | null;\n\n await step(\"Verify the action buttons and more information section\", async() => {\n await expect(modifyButton).not.toBeNull();\n await expect(visibleButton).not.toBeNull();\n });\n\n const moreInfoDiv = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"more-information-section\\\"]\") as HTMLElement | null;\n\n await step(\"Verify the more information section is not visible\", () => {\n expect(moreInfoDiv?.className).not.toContain(\"active\");\n expect(moreInfoDiv).not.toBeVisible();\n });\n\n await step(\"Click on the more information button and verify the displayed information\", async() => {\n if (visibleButton) {\n await visibleButton.click();\n }\n expect(moreInfoDiv).toBeVisible();\n });\n\n const testInput = component?.shadowRoot?.getElementById(\"test\") as HTMLInputElement | null;\n if (testInput) {\n testInput.value = \"pour\";\n testInput.dispatchEvent(new Event(\"input\")); // Trigger input event if needed\n }\n\n await step(\"Verify the content of more information section\", () => {\n const pathologyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"pathology-section\\\"]\") as HTMLElement | null;\n expect(pathologyDiv).toBeVisible();\n const textPathology = pathologyDiv?.textContent ?? \"\";\n expect(textPathology).toContain(\"Pathologies suivies\");\n expect(textPathology).toContain(\"Insuffisance hépatique, Insuffisance rénale aigüe, Insuffisance cardiaque\");\n\n const allergyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"allergy-section\\\"]\") as HTMLElement | null;\n expect(allergyDiv).toBeVisible();\n const textAllergy = allergyDiv?.textContent ?? \"\";\n expect(textAllergy).toContain(\"Allergies\");\n expect(textAllergy).toContain(\"Allergie au paracétamol\");\n\n const hepaticInsufficiencyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"hepatic-insufficiency-section\\\"]\") as HTMLElement | null;\n expect(hepaticInsufficiencyDiv).toBeVisible();\n const textHepaticInsufficiency = hepaticInsufficiencyDiv?.textContent ?? \"\";\n expect(textHepaticInsufficiency).toContain(\"Insuffisance hépatique\");\n expect(textHepaticInsufficiency).toContain(\"Stade B\");\n\n const clairanceDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"clearance-section\\\"]\") as HTMLElement | null;\n expect(clairanceDiv).toBeVisible();\n const textClairance = clairanceDiv?.textContent ?? \"\";\n expect(textClairance).toContain(\"Clairance créatinine\");\n expect(textClairance).toContain(\"60 mL/min\");\n\n const dfgDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"dfg-section\\\"]\") as HTMLElement | null;\n expect(dfgDiv).toBeVisible();\n const textDfg = dfgDiv?.textContent ?? \"\";\n expect(textDfg).toContain(\"DFG\");\n expect(textDfg).toContain(\"51.81 mL/min\");\n });\n\n //Close the more information section at the end of the test\n if (visibleButton) {\n await visibleButton.click();\n }\n },\n}"
23
+ "default": "{\n play: async({ canvasElement, step }) => {\n const component = canvasElement.querySelector(\"bcb-patient-profile\") as HTMLElement | null;\n\n await step(\"Verify the patient ID information\", () => {\n const divName = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-name\\\"]\") as HTMLElement | null;\n expect(divName?.textContent).toContain(\"Marie Dupont\");\n\n const divGender = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-gender\\\"]\") as HTMLElement | null;\n expect(divGender?.textContent).toContain(\"Femme\");\n\n const divAge = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-age\\\"]\") as HTMLElement | null;\n expect(divAge?.textContent).toContain(\"41 ans\");\n });\n\n await step(\"Verify the patient physical information\", () => {\n const divHeight = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-height\\\"]\") as HTMLElement | null;\n const textHeight = divHeight?.textContent ?? \"\";\n expect(textHeight).toContain(\"Taille\");\n expect(textHeight).toContain(\"170\");\n expect(textHeight).toContain(\"cm\");\n\n const divWeight = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-weight\\\"]\") as HTMLElement | null;\n const textWeight = divWeight?.textContent ?? \"\";\n expect(textWeight).toContain(\"Poids\");\n expect(textWeight).toContain(\"84\");\n expect(textWeight).toContain(\"kg\");\n\n const divIMC = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"patient-IMC\\\"]\") as HTMLElement | null;\n expect(divIMC?.textContent).toContain(\"29.1\");\n });\n\n const divActions = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"action-buttons\\\"]\") as HTMLElement | null;\n const modifyButton = divActions?.querySelector(\"bcbd-button[data-test-id=\\\"modify-button\\\"]\") as HTMLElement | null;\n const visibleButton = divActions?.querySelector(\"bcbd-button[data-test-id=\\\"visible-button\\\"]\") as HTMLElement | null;\n\n await step(\"Verify the action buttons and more information section\", async() => {\n await expect(modifyButton).not.toBeNull();\n await expect(visibleButton).not.toBeNull();\n });\n\n const moreInfoDiv = component?.shadowRoot?.querySelector(\"div[data-test-id=\\\"more-information-section\\\"]\") as HTMLElement | null;\n\n await step(\"Verify the more information section is not visible\", () => {\n expect(moreInfoDiv?.className).not.toContain(\"active\");\n expect(moreInfoDiv).not.toBeVisible();\n });\n\n await step(\"Click on the more information button and verify the displayed information\", async() => {\n if (visibleButton) {\n await visibleButton.click();\n }\n expect(moreInfoDiv).toBeVisible();\n });\n\n const testInput = component?.shadowRoot?.getElementById(\"test\") as HTMLInputElement | null;\n if (testInput) {\n testInput.value = \"pour\";\n testInput.dispatchEvent(new Event(\"input\")); // Trigger input event if needed\n }\n\n await step(\"Verify the content of more information section\", () => {\n const pathologyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"pathology-section\\\"]\") as HTMLElement | null;\n expect(pathologyDiv).toBeVisible();\n const textPathology = pathologyDiv?.textContent ?? \"\";\n expect(textPathology).toContain(\"Pathologies suivies\");\n expect(textPathology).toContain(\"Insuffisance hépatique\");\n expect(textPathology).toContain(\"Insuffisance rénale aigüe\");\n expect(textPathology).toContain(\"Insuffisance hépatique mo.\");\n expect(textPathology).toContain(\"Insuffisance cardiaque\");\n\n const allergyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"allergy-section\\\"]\") as HTMLElement | null;\n expect(allergyDiv).toBeVisible();\n const textAllergy = allergyDiv?.textContent ?? \"\";\n expect(textAllergy).toContain(\"Allergies\");\n expect(textAllergy).toContain(\"Allergie au paracétamol\");\n\n const hepaticInsufficiencyDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"hepatic-insufficiency-section\\\"]\") as HTMLElement | null;\n expect(hepaticInsufficiencyDiv).toBeVisible();\n const textHepaticInsufficiency = hepaticInsufficiencyDiv?.textContent ?? \"\";\n expect(textHepaticInsufficiency).toContain(\"Insuffisance hépatique\");\n expect(textHepaticInsufficiency).toContain(\"Stade B\");\n\n const clairanceDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"clearance-section\\\"]\") as HTMLElement | null;\n expect(clairanceDiv).toBeVisible();\n const textClairance = clairanceDiv?.textContent ?? \"\";\n expect(textClairance).toContain(\"Clairance créatinine\");\n expect(textClairance).toContain(\"60 mL/min\");\n\n const dfgDiv = moreInfoDiv?.querySelector(\"div[data-test-id=\\\"dfg-section\\\"]\") as HTMLElement | null;\n expect(dfgDiv).toBeVisible();\n const textDfg = dfgDiv?.textContent ?? \"\";\n expect(textDfg).toContain(\"DFG\");\n expect(textDfg).toContain(\"51.81 mL/min\");\n });\n\n //Close the more information section at the end of the test\n if (visibleButton) {\n await visibleButton.click();\n }\n },\n}"
24
24
  },
25
25
  {
26
26
  "kind": "variable",
@@ -109,6 +109,28 @@
109
109
  "kind": "method",
110
110
  "name": "displayCreatininemieSection"
111
111
  },
112
+ {
113
+ "kind": "method",
114
+ "name": "truncateLabel",
115
+ "privacy": "private",
116
+ "return": {
117
+ "type": {
118
+ "text": "string"
119
+ }
120
+ },
121
+ "parameters": [
122
+ {
123
+ "name": "label",
124
+ "type": {
125
+ "text": "string"
126
+ }
127
+ },
128
+ {
129
+ "name": "maxLength",
130
+ "default": "25"
131
+ }
132
+ ]
133
+ },
112
134
  {
113
135
  "kind": "method",
114
136
  "name": "displayPathologies"
@@ -258,7 +280,7 @@
258
280
  "type": {
259
281
  "text": "Bundle"
260
282
  },
261
- "default": "{\n resourceType: \"Bundle\",\n id: \"patient-complete\",\n type: \"document\",\n entry: [\n {\n resource: {\n resourceType: \"Composition\", // On a Bundle of type document, the first entry must be a Composition\n id: \"composition-complete\",\n status: \"final\",\n type: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"34133-9\",\n display: \"Summary of episode note\",\n },\n ],\n },\n subject: [{ reference: \"Patient/patient-complete\" }],\n date: \"2025-09-02\",\n title: \"Patient complete composition\",\n author: [{ reference: \"Practitioner/dr-martin\" }],\n },\n },\n {\n resource: {\n resourceType: \"Patient\",\n id: \"patient-complete\",\n gender: \"female\", // sex at birth\n birthDate: \"1984-01-01\", // birthDate used to calculate age\n name: [\n {\n family: \"Dupont\",\n given: [\"Marie\"],\n },\n ],\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-gestational-age\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"18185-9\",\n display: \"Gestational age\", // Most used Loinc code for gestational age / number of weeks of amenorrhea\n },\n ],\n text: \"Âge gestationnel\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 20,\n unit: \"weeks\",\n system: \"http://unitsofmeasure.org\",\n code: \"wk\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine-clearance\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"2164-2\",\n display: \"Creatinine renal clearance in 24 hour Urine and Serum or Plasma\", // Most used Loinc code for creatinine clearance\n },\n ],\n text: \"Clairance de la créatinine\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 60,\n unit: \"mL/min\",\n system: \"http://unitsofmeasure.org\",\n code: \"mL/min\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"15051-6\",\n display: \"Creatinine [Moles/volume] in Serum or Plasma\", // LOINC code for serum creatinine in μmol/L\n },\n ],\n text: \"Créatininémie\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 141,\n unit: \"μmol/L\",\n system: \"http://unitsofmeasure.org\",\n code: \"umol/L\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"2160-0\",\n display: \"Creatinine [Mass/volume] in Serum or Plasma\", // Most used Loinc code for serum creatinine\n },\n ],\n text: \"Créatininémie\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 1.6,\n unit: \"mg/dL\",\n system: \"http://unitsofmeasure.org\",\n code: \"mg/dL\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-dfg\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"48643-1\",\n // eslint-disable-next-line @stylistic/max-len\n display: \"Glomerular filtration rate [Volume Rate/Area] in Serum, Plasma or Blood by Creatinine-based formula (MDRD)/1.73 sq M among black population\",\n },\n ],\n text: \"DFG\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 45,\n unit: \"mL/min/1.73.m2\",\n system: \"http://unitsofmeasure.org\",\n code: \"mL/min/1.73.m2\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-child-pugh-score\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"98152-2\",\n display: \"Total score [Child-Pugh]\", // Most used Loinc code for Child-Pugh score allowing to calculate hepatic insufficiency status\n },\n ],\n text: \"Score total Child-Pugh\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 7,\n unit: \"score\",\n system: \"http://unitsofmeasure.org\",\n code: \"{score}\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-body-weight\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"29463-7\",\n display: \"Body weight\", // Most used Loinc code for body weight\n },\n ],\n text: \"Poids corporel\",\n },\n subject: {\n reference: \"Patient/patient-complete\",\n },\n valueQuantity: {\n value: 84,\n unit: \"kg\",\n system: \"http://unitsofmeasure.org\",\n code: \"kg\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-body-height\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"8302-2\",\n display: \"Body height\", // Most used Loinc code for body height\n },\n ],\n text: \"Taille corporelle\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 170,\n unit: \"cm\",\n system: \"http://unitsofmeasure.org\",\n code: \"cm\",\n },\n },\n },\n {\n resource: {\n resourceType: \"AdverseEvent\", // Resource used to specify adverse events like drug side effects the patient is experiencing\n id: \"adverseevent-amoxicillin-rash\",\n actuality: \"actual\",\n subject: { reference: \"Patient/patient-complete\" },\n status: \"unknown\",\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"271807003\",\n display: \"Rash\",\n },\n ],\n text: \"Éruption cutanée\",\n },\n suspectEntity: [ // Link to the medication request that supposedly or certainly caused the adverse event\n {\n instanceReference: {\n reference: \"MedicationRequest/req-cardensiel\",\n },\n causality: {\n assessmentMethod: {\n coding: [\n {\n system: \"http://terminology.hl7.org/CodeSystem/adverse-event-causality-assess\",\n code: \"certain\",\n display: \"Certain\",\n },\n ],\n },\n },\n },\n ],\n seriousness: {\n coding: [\n {\n system: \"http://terminology.hl7.org/CodeSystem/adverse-event-seriousness\",\n code: \"non-serious\",\n display: \"Non-serious\",\n },\n ],\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-pregnancy-status\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"82810-3\",\n display: \"Pregnancy status\", // Most used Loinc code for pregnancy status\n },\n ],\n text: \"Statut de grossesse\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueCodeableConcept: { // result of the observation meaning the patient is currently pregnant (it can also be represented more simply by a Condition resource with the same snomed code)\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"77386006\",\n display: \"Pregnant\",\n },\n ],\n text: \"Grossesse\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-breastfeeding-status\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"63895-7\",\n display: \"Breastfeeding status\", // Most used Loinc code for breastfeeding status\n },\n ],\n text: \"Statut d'allaitement\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueCodeableConcept: { // result of the observation meaning the patient is currently breastfeeding (it can also be represented more simply by a Condition resource with the same snomed code)\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"69840006\",\n display: \"Breastfeeding\",\n },\n ],\n text: \"Allaitement\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Condition\", // Resources of type Condition are used to specify pathologies\n id: \"hepatic-insufficiency\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"59927004\",\n display: \"Hepatic failure\",\n },\n ],\n text: \"Insuffisance hépatique\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"Condition\",\n id: \"cond-medical-terrain\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"723189000\",\n display: \"Insuffisance rénale aigüe\",\n },\n ],\n text: \"Insuffisance rénale aigüe\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"Condition\",\n id: \"cond-followed-pathology\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"84114007\",\n display: \"Insuffisance cardiaque\",\n },\n ],\n text: \"Insuffisance cardiaque\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"AllergyIntolerance\", // Resource used to specify allergies or intolerances the patient has\n id: \"allergy-paracetamol\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"293584003\",\n display: \"Allergie au paracétamol\",\n },\n ],\n text: \"Allergie au paracétamol\",\n },\n patient: { reference: \"Patient/patient-complete\" },\n },\n },\n ],\n}"
283
+ "default": "{\n resourceType: \"Bundle\",\n id: \"patient-complete\",\n type: \"document\",\n entry: [\n {\n resource: {\n resourceType: \"Composition\", // On a Bundle of type document, the first entry must be a Composition\n id: \"composition-complete\",\n status: \"final\",\n type: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"34133-9\",\n display: \"Summary of episode note\",\n },\n ],\n },\n subject: [{ reference: \"Patient/patient-complete\" }],\n date: \"2025-09-02\",\n title: \"Patient complete composition\",\n author: [{ reference: \"Practitioner/dr-martin\" }],\n },\n },\n {\n resource: {\n resourceType: \"Patient\",\n id: \"patient-complete\",\n gender: \"female\", // sex at birth\n birthDate: \"1984-01-01\", // birthDate used to calculate age\n name: [\n {\n family: \"Dupont\",\n given: [\"Marie\"],\n },\n ],\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-gestational-age\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"18185-9\",\n display: \"Gestational age\", // Most used Loinc code for gestational age / number of weeks of amenorrhea\n },\n ],\n text: \"Âge gestationnel\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 20,\n unit: \"weeks\",\n system: \"http://unitsofmeasure.org\",\n code: \"wk\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine-clearance\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"2164-2\",\n display: \"Creatinine renal clearance in 24 hour Urine and Serum or Plasma\", // Most used Loinc code for creatinine clearance\n },\n ],\n text: \"Clairance de la créatinine\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 60,\n unit: \"mL/min\",\n system: \"http://unitsofmeasure.org\",\n code: \"mL/min\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"15051-6\",\n display: \"Creatinine [Moles/volume] in Serum or Plasma\", // LOINC code for serum creatinine in μmol/L\n },\n ],\n text: \"Créatininémie\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 141,\n unit: \"μmol/L\",\n system: \"http://unitsofmeasure.org\",\n code: \"umol/L\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-creatinine\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"2160-0\",\n display: \"Creatinine [Mass/volume] in Serum or Plasma\", // Most used Loinc code for serum creatinine\n },\n ],\n text: \"Créatininémie\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 1.6,\n unit: \"mg/dL\",\n system: \"http://unitsofmeasure.org\",\n code: \"mg/dL\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-dfg\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"48643-1\",\n // eslint-disable-next-line @stylistic/max-len\n display: \"Glomerular filtration rate [Volume Rate/Area] in Serum, Plasma or Blood by Creatinine-based formula (MDRD)/1.73 sq M among black population\",\n },\n ],\n text: \"DFG\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 45,\n unit: \"mL/min/1.73.m2\",\n system: \"http://unitsofmeasure.org\",\n code: \"mL/min/1.73.m2\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-child-pugh-score\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"98152-2\",\n display: \"Total score [Child-Pugh]\", // Most used Loinc code for Child-Pugh score allowing to calculate hepatic insufficiency status\n },\n ],\n text: \"Score total Child-Pugh\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 7,\n unit: \"score\",\n system: \"http://unitsofmeasure.org\",\n code: \"{score}\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-body-weight\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"29463-7\",\n display: \"Body weight\", // Most used Loinc code for body weight\n },\n ],\n text: \"Poids corporel\",\n },\n subject: {\n reference: \"Patient/patient-complete\",\n },\n valueQuantity: {\n value: 84,\n unit: \"kg\",\n system: \"http://unitsofmeasure.org\",\n code: \"kg\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-body-height\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"8302-2\",\n display: \"Body height\", // Most used Loinc code for body height\n },\n ],\n text: \"Taille corporelle\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueQuantity: {\n value: 170,\n unit: \"cm\",\n system: \"http://unitsofmeasure.org\",\n code: \"cm\",\n },\n },\n },\n {\n resource: {\n resourceType: \"AdverseEvent\", // Resource used to specify adverse events like drug side effects the patient is experiencing\n id: \"adverseevent-amoxicillin-rash\",\n actuality: \"actual\",\n subject: { reference: \"Patient/patient-complete\" },\n status: \"unknown\",\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"271807003\",\n display: \"Rash\",\n },\n ],\n text: \"Éruption cutanée\",\n },\n suspectEntity: [ // Link to the medication request that supposedly or certainly caused the adverse event\n {\n instanceReference: {\n reference: \"MedicationRequest/req-cardensiel\",\n },\n causality: {\n assessmentMethod: {\n coding: [\n {\n system: \"http://terminology.hl7.org/CodeSystem/adverse-event-causality-assess\",\n code: \"certain\",\n display: \"Certain\",\n },\n ],\n },\n },\n },\n ],\n seriousness: {\n coding: [\n {\n system: \"http://terminology.hl7.org/CodeSystem/adverse-event-seriousness\",\n code: \"non-serious\",\n display: \"Non-serious\",\n },\n ],\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-pregnancy-status\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"82810-3\",\n display: \"Pregnancy status\", // Most used Loinc code for pregnancy status\n },\n ],\n text: \"Statut de grossesse\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueCodeableConcept: { // result of the observation meaning the patient is currently pregnant (it can also be represented more simply by a Condition resource with the same snomed code)\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"77386006\",\n display: \"Pregnant\",\n },\n ],\n text: \"Grossesse\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Observation\",\n id: \"obs-breastfeeding-status\",\n status: \"final\",\n code: {\n coding: [\n {\n system: \"http://loinc.org\",\n code: \"63895-7\",\n display: \"Breastfeeding status\", // Most used Loinc code for breastfeeding status\n },\n ],\n text: \"Statut d'allaitement\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n valueCodeableConcept: { // result of the observation meaning the patient is currently breastfeeding (it can also be represented more simply by a Condition resource with the same snomed code)\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"69840006\",\n display: \"Breastfeeding\",\n },\n ],\n text: \"Allaitement\",\n },\n },\n },\n {\n resource: {\n resourceType: \"Condition\", // Resources of type Condition are used to specify pathologies\n id: \"hepatic-insufficiency\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"59927004\",\n display: \"Hepatic failure\",\n },\n ],\n text: \"Insuffisance hépatique\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"Condition\",\n id: \"cond-medical-terrain\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"723189000\",\n display: \"Insuffisance rénale aigüe\",\n },\n ],\n text: \"Insuffisance rénale aigüe\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"Condition\",\n id: \"cond-medical-terrain\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"723188000\",\n display: \"Insuffisance hépatique modérée\",\n },\n ],\n text: \"Insuffisance hépatique modérée\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"Condition\",\n id: \"cond-followed-pathology\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/condition-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"84114007\",\n display: \"Insuffisance cardiaque\",\n },\n ],\n text: \"Insuffisance cardiaque\",\n },\n subject: { reference: \"Patient/patient-complete\" },\n },\n },\n {\n resource: {\n resourceType: \"AllergyIntolerance\", // Resource used to specify allergies or intolerances the patient has\n id: \"allergy-paracetamol\",\n clinicalStatus: { coding: [{ system: \"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical\", code: \"active\" }] },\n code: {\n coding: [\n {\n system: \"http://snomed.info/sct\",\n code: \"293584003\",\n display: \"Allergie au paracétamol\",\n },\n ],\n text: \"Allergie au paracétamol\",\n },\n patient: { reference: \"Patient/patient-complete\" },\n },\n },\n ],\n}"
262
284
  }
263
285
  ],
264
286
  "exports": [
@@ -10,6 +10,7 @@ export declare class PatientProfile extends LitElement {
10
10
  handleMoreInformation(): void;
11
11
  displayRenalInsufficiencyStatus(): symbol | TemplateResult<1>;
12
12
  displayCreatininemieSection(): TemplateResult<1>;
13
+ private truncateLabel;
13
14
  displayPathologies(): TemplateResult<1>;
14
15
  displayAllergies(): TemplateResult<1>;
15
16
  render(): TemplateResult<1>;
@@ -293,8 +293,12 @@ function getPatientConditions(patient) {
293
293
  }
294
294
  const conditions = [];
295
295
  for (const entry of patient.entry) {
296
- if (entry.resource?.resourceType === "Condition" && entry.resource.code?.text) {
297
- conditions.push(entry.resource.code.text);
296
+ if (entry.resource?.resourceType === "Condition") {
297
+ if (entry.resource.code?.text) {
298
+ conditions.push(entry.resource.code.text);
299
+ } else {
300
+ conditions.push(entry.resource.code?.coding?.[0].display ?? "");
301
+ }
298
302
  }
299
303
  }
300
304
  return conditions;
@@ -305,8 +309,12 @@ function getPatientAllergies(patient) {
305
309
  }
306
310
  const allergies = [];
307
311
  for (const entry of patient.entry) {
308
- if (entry.resource?.resourceType === "AllergyIntolerance" && entry.resource.code?.text) {
309
- allergies.push(entry.resource.code.text);
312
+ if (entry.resource?.resourceType === "AllergyIntolerance") {
313
+ if (entry.resource.code?.text) {
314
+ allergies.push(entry.resource.code.text);
315
+ } else {
316
+ allergies.push(entry.resource.code?.coding?.[0].display ?? "");
317
+ }
310
318
  }
311
319
  }
312
320
  return allergies;
@@ -860,7 +868,7 @@ function n2(t2) {
860
868
  function r(r2) {
861
869
  return n2({ ...r2, state: true, attribute: false });
862
870
  }
863
- 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}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\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-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 > * + *::before {\n content: "•";\n margin: 0 0.5rem;\n}';
871
+ 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}\n@container (max-width: 600px) {\n .claudebernard-patient-profile {\n font-size: 0.8rem;\n }\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}';
864
872
  var __defProp = Object.defineProperty;
865
873
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
866
874
  var __decorateClass = (decorators, target, key, kind) => {
@@ -907,21 +915,64 @@ let PatientProfile = class extends i {
907
915
  const creatinineByMg = creatinine.find((c2) => c2.unit?.toLowerCase() === "mg/l");
908
916
  const creatinineByUmol = creatinine.find((c2) => c2.unit === "μmol/L");
909
917
  return x`
910
- <div class="${PREFIX}-patient-profile__second-info" data-test-id="creatinine-section">
918
+ <div class="${PREFIX}-patient-profile__second-info" id="creatinine-section" data-test-id="creatinine-section">
911
919
  <span class="${PREFIX}-patient-profile__second-info-label">Créatininémie </span>
912
920
  <span class="${PREFIX}-patient-profile__second-info-result sep-dots">
913
921
  <span>${creatinineByUmol?.value} ${creatinineByUmol?.unit}</span>
914
- <span class="">${creatinineByMg?.value} ${creatinineByMg?.unit}</span>
922
+ <span>${creatinineByMg?.value} ${creatinineByMg?.unit}</span>
915
923
  </span>
916
924
  </div>`;
917
925
  }
926
+ truncateLabel(label, maxLength = 25) {
927
+ if (!label) {
928
+ return "";
929
+ }
930
+ if (label.length <= maxLength) {
931
+ return label;
932
+ }
933
+ return `${label.slice(0, maxLength)}.`;
934
+ }
918
935
  displayPathologies() {
919
936
  const conditions = getPatientConditions(this.patientProfile);
920
- return x`${conditions.join(", ")}`;
937
+ const items = conditions.map((condition, index) => {
938
+ const truncated = this.truncateLabel(condition);
939
+ const separator = index < conditions.length - 1 ? ", " : "";
940
+ if (truncated === condition) {
941
+ return x`
942
+ <span>${truncated}${separator}</span>
943
+ `;
944
+ }
945
+ return x`
946
+ <bcbd-tooltip
947
+ content=${condition}
948
+ placement="top"
949
+ >
950
+ <span>${truncated}${separator}</span>
951
+ </bcbd-tooltip>
952
+ `;
953
+ });
954
+ return x`${items}`;
921
955
  }
922
956
  displayAllergies() {
923
957
  const allergies = getPatientAllergies(this.patientProfile);
924
- return x`${allergies.join(", ")}`;
958
+ const items = allergies.map((allergy, index) => {
959
+ const truncated = this.truncateLabel(allergy);
960
+ const separator = index < allergies.length - 1 ? ", " : "";
961
+ if (truncated === allergy) {
962
+ return x`
963
+ <span>${truncated}${separator}</span>
964
+ `;
965
+ }
966
+ return x`
967
+ <bcbd-tooltip
968
+ content=${allergy}
969
+ placement="top"
970
+ >
971
+ <span>${truncated}${separator}</span>
972
+ </bcbd-tooltip>
973
+ `;
974
+ });
975
+ return x`${items}`;
925
976
  }
926
977
  render() {
927
978
  return x`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudebernard/patient-profile-element",
3
- "version": "0.1.4",
3
+ "version": "0.2.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",