Fix processing of optional patient record #21
2 changed files with 30 additions and 1 deletions
|
|
@ -99,6 +99,18 @@ required_fields = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
required_patient_fields = [
|
||||||
|
"patient-year-first-symptom",
|
||||||
|
"patient-month-first-symptom",
|
||||||
|
"patient-day-first-symptom",
|
||||||
|
"patient-year-diagnosis",
|
||||||
|
"patient-month-diagnosis",
|
||||||
|
"patient-day-diagnosis",
|
||||||
|
"patient-main-disease",
|
||||||
|
"patient-stronger-impacted-hand"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Browsers might not send disabled or empty input fields at all.
|
# Browsers might not send disabled or empty input fields at all.
|
||||||
# All entries in auto_fields will be added to the incoming field
|
# All entries in auto_fields will be added to the incoming field
|
||||||
# set, if they are not present.
|
# set, if they are not present.
|
||||||
|
|
@ -295,6 +307,16 @@ def hand_message(value):
|
||||||
}[value]
|
}[value]
|
||||||
|
|
||||||
|
|
||||||
|
def disease_message(value):
|
||||||
|
return {
|
||||||
|
"stroke": "Schlaganfall",
|
||||||
|
"parkinson": "Parkinson",
|
||||||
|
"tic": "Tic",
|
||||||
|
"depression": "Depression",
|
||||||
|
"alzheimer": "Alzheimer",
|
||||||
|
}[value]
|
||||||
|
|
||||||
|
|
||||||
def date_message(year, month, day):
|
def date_message(year, month, day):
|
||||||
return "-".join([
|
return "-".join([
|
||||||
str(x)
|
str(x)
|
||||||
|
|
@ -312,6 +334,7 @@ def create_result_page(commit_hash: str, time_stamp: float, json_top_data: dict,
|
||||||
reference=f"{time_stamp}-{commit_hash}",
|
reference=f"{time_stamp}-{commit_hash}",
|
||||||
record=json_top_data["data"],
|
record=json_top_data["data"],
|
||||||
date_message=date_message,
|
date_message=date_message,
|
||||||
|
disease_message=disease_message,
|
||||||
hand_message=hand_message,
|
hand_message=hand_message,
|
||||||
sex_message=sex_message,
|
sex_message=sex_message,
|
||||||
subject_group_message=subject_group_message,
|
subject_group_message=subject_group_message,
|
||||||
|
|
@ -640,6 +663,12 @@ def application(environ, start_response):
|
||||||
# This will throw an error, if the key is not available
|
# This will throw an error, if the key is not available
|
||||||
json_object[key] = get_field_value(entered_data, key)
|
json_object[key] = get_field_value(entered_data, key)
|
||||||
|
|
||||||
|
# Read keys dependent on subject-group
|
||||||
|
if json_object["subject-group"] == "patient":
|
||||||
|
for key in required_patient_fields:
|
||||||
|
# This will throw an error, if the key is not available
|
||||||
|
json_object[key] = get_field_value(entered_data, key)
|
||||||
|
|
||||||
time_stamp = time.time()
|
time_stamp = time.time()
|
||||||
|
|
||||||
json_data = {
|
json_data = {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
{% if record["subject-group"] == "patient" %}
|
{% if record["subject-group"] == "patient" %}
|
||||||
|
|
||||||
{{ render_number("Haupterkrankung", "patient-main-disease") }}
|
{{ render_string("Haupterkrankung", disease_message(record["patient-main-disease"])) }}
|
||||||
{{ render_string("Datum Erstsymptom", date_message(record["patient-year-first-symptom"], record["patient-month-first-symptom"], record["patient-day-first-symptom"])) }}
|
{{ render_string("Datum Erstsymptom", date_message(record["patient-year-first-symptom"], record["patient-month-first-symptom"], record["patient-day-first-symptom"])) }}
|
||||||
{{ render_string("Datum Diagnose", date_message(record["patient-year-diagnosis"], record["patient-month-diagnosis"], record["patient-day-diagnosis"])) }}
|
{{ render_string("Datum Diagnose", date_message(record["patient-year-diagnosis"], record["patient-month-diagnosis"], record["patient-day-diagnosis"])) }}
|
||||||
{{ render_string("Stärker betroffene Hand", hand_message(record["patient-stronger-impacted-hand"])) }}
|
{{ render_string("Stärker betroffene Hand", hand_message(record["patient-stronger-impacted-hand"])) }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue