From 2863a7fa8d29519fc98f2edb90bc1549a816ff45 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Wed, 6 Sep 2023 20:58:47 +0530 Subject: [PATCH] Multiple diagnosis --- README | 3 ++- data/template/default/index.html | 10 +++++++++- renderer.py | 9 ++++++++- resource/help.html | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README b/README index a66e1a8..12f4c36 100644 --- a/README +++ b/README @@ -47,7 +47,8 @@ There are eight tabs in the tab bar containing important parts of a prescription. 1. Patient tab: It contains the demographical data of the patient, diagnosis -and a few extra parameters of the prescription. +and a few extra parameters of the prescription. The diagnosis can be entered +here. To enter multiple diagnosis semicolon (;) may be used to separate them. 2. Clinical tab: It contains the clinical note regarding the patient. The presets can be selected from the preset box at the top and inserted into the diff --git a/data/template/default/index.html b/data/template/default/index.html index 8dafdc4..703a212 100644 --- a/data/template/default/index.html +++ b/data/template/default/index.html @@ -51,7 +51,15 @@ - {% if diagnosis %}

{{diagnosis}}

{% endif %} + {% if diagnosis %} + {% if diagnosis_list|length > 1 %} + + {% else %} +

{{diagnosis}}

+ {% endif %} + {% endif %} {% if note %}

{{note}}

{% endif %} {% if report %}

{{report}}

{% endif %} diff --git a/renderer.py b/renderer.py index 6f18e38..43cc27a 100644 --- a/renderer.py +++ b/renderer.py @@ -22,7 +22,7 @@ class Renderer: with open(source, "r") as source_file, open(target, "w") as target_file: with open(template) as template_file: template_data = Template(template_file.read()) - data=self.process_medication(json.loads(source_file.read())) + data=self.process_medication(self.process_diagnosis(json.loads(source_file.read()))) try: data["date"]=datetime.datetime.strptime(data["date"], "%Y-%m-%d %H:%M:%S") except Exception as e: @@ -31,6 +31,13 @@ class Renderer: target_file.write(output) return(target) + def process_diagnosis(self, data): + diagnosis_list=[] + for d in data["diagnosis"].split(";"): + diagnosis_list.append(d.strip()) + data["diagnosis_list"]=diagnosis_list + return data + def process_medication(self, data): medication_list=[] pattern=re.compile(r".*?\[(.*)\].*") diff --git a/resource/help.html b/resource/help.html index c124bfe..f60e659 100644 --- a/resource/help.html +++ b/resource/help.html @@ -27,7 +27,7 @@

A new prescription can be created right from the starting window. Alternatively the "New" menu option can be used to create a new prescription.

There are eight tabs in the tab bar containing important parts of a prescription.

    -
  1. Patient tab: It contains the demographical data of the patient, diagnosis and a few extra parameters of the prescription.
  2. +
  3. Patient tab: It contains the demographical data of the patient, diagnosis and a few extra parameters of the prescription. The diagnosis can be entered here. To enter multiple diagnosis semicolon (;) may be used to separate them.
  4. Clinical tab: It contains the clinical note regarding the patient. The presets can be selected from the preset box at the top and inserted into the note by clicking the insert button.
  5. Report tab: It contains the reports shown by the patient. It also has the preset option.
  6. Advice tab: It contains the primary advices given to the patient. It is usually printed at the top of the advice section of the prescription.It also has the preset option.
  7. -- 2.39.2