Commit 8a33f2a7 authored by Dan-Schaefer's avatar Dan-Schaefer

Uploaded code Max Hirsch Bachelorabeit TEDIAS Use-Case 2 (UC2) Dashboard

parent 956dd335
FLASK_ENV=development
FLASK_APP=api
\ No newline at end of file
/unprocessed_files
/processed_files
/deleted_files/
FROM tiangolo/uwsgi-nginx-flask:python3.8
ENV UWSGI_INI /app/uwsgi.ini
WORKDIR /app
COPY . .
COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /app/api
ENV LISTEN_PORT 8069
EXPOSE 8069
\ No newline at end of file
FLASK_ENV=development
FLASK_APP=api
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
import os, json
from werkzeug.security import generate_password_hash
from getpass import getpass
def add_user():
username = input("Username: ")
with open("../users") as file:
userdata = json.load(file)
usernames = list(userdata.keys())
if username in usernames:
print("username already exists")
return
password = getpass()
password = generate_password_hash(password, 'sha256')
userdata[username] = password
with open("../users", "w") as file:
json.dump(userdata, file)
add_user()
\ No newline at end of file
import json
import copy
import random
# load data
with open("patientdata.json", "r") as file:
patientData = json.load(file)
with open("answers.json", "r") as file:
answers = json.load(file)
with open("questions.json", "r") as file:
questions = json.load(file)
# is later used to check if question of id q_id should be asked according to the answers so far in anser_dictionary
def helper_func_for_check_question(dependency, answer_dictionary):
# print("q")
if dependency.split(".")[0] not in answer_dictionary:
# print("w")
return False
if dependency.split(".")[1] in answer_dictionary[dependency.split(".")[0]]:
return True
return False
def check_question(q_id, answer_dictionary):
if "or" in questions[q_id]["dependency"]:
for dependency in [d for d in questions[q_id]["dependency"] if d != "or"]:
if helper_func_for_check_question(dependency, answer_dictionary):
return True
else:
for dependency in questions[q_id]["dependency"]:
# print(dependency)
if not helper_func_for_check_question(dependency, answer_dictionary):
return False
return True
return False
# to stop the infinite loop coming up
stop_variable = False
while not stop_variable:
patientName = input("patientname (write 'stop' to stop): ")
if patientName == "stop":
stop_variable = True
else:
answer_dictionary = {}
for q_id, question in questions.items():
# print(answer_dictionary)
if check_question(q_id, answer_dictionary):
print(f"{q_id}: "+question["text"])
for a_id, answer in answers.items():
if a_id.split(".")[0] == q_id:
if answer["text"] == "#Freitext":
print(f" Freitext")
else:
a_id_pretty = a_id.split(".")[1]
print(f" {a_id_pretty}: "+answer["text"]+answer["flag"])
if question["single_choices"] == 0:
print(" Multiple answers possible!")
if question["text"] == "#Freitext":
_input = input("Answer: ")
answer_dictionary[q_id] = [_input]
else:
_input = input("Answer (only number): ")
answer_dictionary[q_id] = _input.split("; ")
if len([patientData[idx]["id"] for idx in range(len(patientData))]) == 0:
_id = 1
else:
_id = max([patientData[idx]["id"] for idx in range(len(patientData))])+1
newPatientData = {"id": _id, "first_name": patientName.split(" ")[0], "last_name": patientName.split(" ")[1], "answers": copy.deepcopy(answer_dictionary), "waiting_time": random.randint(1,45)}
patientData.append(newPatientData)
# save data
with open("patientdata.json", "w") as file:
json.dump(patientData, file)
import json
import os
import subprocess
import sys
import time
class QuestionnaireProcessor:
def __init__(self, questionnaire_path: dict = None):
if questionnaire_path is None:
with open("../questionnaire_templates/Processing_Template_Neuro.json") as file:
self.questionnaire = json.load(file)
else:
with open(questionnaire_path) as file:
self.questionnaire = json.load(file)
def loadUnprocessedPatientdata(self, path: str = None) -> dict:
if path is None:
path = "../unprocessed_files/"+os.listdir("../unprocessed_files")[0]
with open(path) as file:
unprocessedPatientdata = json.load(file)
return unprocessedPatientdata
def processPatientdata(self, unprocessedPatientdata: dict) -> dict:
patientdata = dict()
self._createProcessedHeadder(patientdata, unprocessedPatientdata)
self._createPrios(patientdata, unprocessedPatientdata)
self._createPatientpriority(patientdata, unprocessedPatientdata)
self._addEntranceTime(patientdata, unprocessedPatientdata)
return patientdata
def _createProcessedHeadder(self, patientdata: dict, unprocessedPatientdata: dict):
patientdata["first_name"] = " ".join(unprocessedPatientdata["contained"][0]["name"][0]["given"])
patientdata["last_name"] = unprocessedPatientdata["contained"][0]["name"][0]["family"]
patientdata["questionnaireresponseid"] = self.questionnaire["id"]
def _createPrios(self, patientdata: dict, unprocessedPatientdata: dict):
patientdata["prios"] = []
for question in unprocessedPatientdata["item"]:
prio = "yellow"
answer = []
for a in question["answer"]:
if a["flag"] == "red":
prio = "red"
if a["flag"] == "green" and prio != "red":
prio = "green"
answer.append({"valueString": a["valueString"]})
patientdata["prios"].append({"linkId": question["linkId"], "id": self.questionnaire["id"], "prio": prio, "text": question["text"], "answer": answer})
def _createPatientpriority(self, patientdata: dict, unprocessedPatientdata: dict):
patientdata["Patient_Priority"] = "yellow"
for question in patientdata["prios"]:
if question["prio"] == "red":
patientdata["Patient_Priority"] = "red"
if question["prio"] == "green" and patientdata["Patient_Priority"] != "red":
patientdata["Patient_Priority"] = "green"
def _addEntranceTime(self, patientdata: dict, unprocessedPatientdata: dict):
patientdata["entrance"] = time.time()
def saveProcessedData(self, data: dict, path: str = None):
if path is None:
path = "../processed_data/temporary.json"
if not os.path.exists(path):
subprocess.run(["touch", path])
with open(path, "w") as file:
json.dump(data,file)
else:
raise ValueError # file already exists... override?
import json
import sys
import time
class QuestionnaireFlagCheck:
def __init__(self, questionnaire_map=None):
self.questionnaire_response = None
if questionnaire_map is None:
questionnaire_map = "testQAndANeuro.json"
self.questionnaire_map = json.loads(open(questionnaire_map, "rb").read())
def process(self, path=None):
if path is None:
path = "../logic/testQNeuroRedFlag.json"
# todo check if questionnaire already processed
questionnaire = self.load_questionnaire(q_path=path)
prios = self.create_flags(questionnaire)
# return for landing stage
self.create_json_return_landing_stage(prios)
patient_priority = 'yellow'
for possible_flag in ['green', 'red']:
if possible_flag in [elem['prio'] for elem in prios]:
patient_priority = possible_flag
# todo check for correct name and contained.patient,
# do as function to keep code clean
patient_name = questionnaire['contained'][0]['name'][0]
# todo put answers of interest with questions in form (question: \n\t answer)
# check key in patientdata.json
return {
'questionnaireresponseid': questionnaire['id'],
'first_name': ' '.join(given_name for given_name in patient_name['given']),
'last_name': patient_name['family'],
'prios': prios,
'Patient_Priority': patient_priority,
'entrance': time.time()}
@staticmethod
def load_questionnaire(q_path=None):
if q_path is None:
q_path = "../logic/testQuestionareResponse.json"
file = open(q_path, "r")
return json.loads(file.read())
def create_flags(self, questionnaire: dict):
self.questionnaire_response = questionnaire
flag_response = []
for question_response in self.questionnaire_response['item']:
self.compare_question(question_response['linkId'])
prio = self.flag_answer(question_response=question_response)
flag_response.append({
"linkId": question_response['linkId'],
"prio": prio,
"id": questionnaire['id'],
"text": question_response['text'],
"answer": question_response['answer'],
})
return flag_response
def compare_question(self, link_id):
a = self.get_question(link_id, self.questionnaire_response)['text']
q = self.get_question(link_id, self.questionnaire_map)['text']
if q != a:
raise Exception("Questions with linkId={0} of response and map do not match!"
"\n\tq_res: {1}"
"\n\tq_map: {2}".format(link_id, a, q))
def flag_answer(self, question_response=None):
# todo make sure that the given answer exists in the template
question = self.get_question(question_response['linkId'], self.questionnaire_map)
patient_answers = [elem['valueString'] for elem in question_response['answer']]
for possible_answer in question['answer']:
if possible_answer['valueString'] in patient_answers:
if 'if' in possible_answer:
for flag_condition in possible_answer['if']:
cond_patient_answers = self.get_question(flag_condition['linkId'], questionnaire=self.questionnaire_response)
if flag_condition['answer'] in [elem['valueString'] for elem in cond_patient_answers['answer']]:
return possible_answer['flag']
pass
elif 'flag' in possible_answer:
return possible_answer['flag']
return 'yellow'
def get_question(self, question_response_link_id, questionnaire):
for q in questionnaire['item']:
if q['linkId'] == question_response_link_id:
return q
raise ValueError("Key not found in questionnaire")
@staticmethod
def create_json_return_landing_stage(flags):
pass
def load_questionnaire(path=None):
if path is None:
path = "../logic/testQuestionareResponse.json"
file = open(path, "r")
return json.loads(file.read())
if __name__ == '__main__':
print(len(sys.argv))
for i, arg in enumerate(sys.argv):
print(f"Argument {i:>6}: {arg}")
# class_test = QuestionnaireFlagCheck()
# result = class_test.process()
This diff is collapsed.
question 34: 33.1, nein ???
23 and similar: nein-Antwort -> multiple answers: is no answer possible?
[{"id": 1, "first_name": "Jialu", "last_name": "Li", "answers": {"1": ["1"], "2": ["1"], "3": ["2"], "4": ["1"], "6": ["2"]}, "waiting_time": 23}, {"id": 2, "first_name": "Emine", "last_name": "Durmaz", "answers": {"1": ["2"], "10": ["2"], "11": ["1"], "12": ["1"], "13": ["8"], "14": ["1"], "15": ["2"], "16": ["2"], "17": ["1"], "18": ["2"]}, "waiting_time": 45}, {"id": 3, "first_name": "Anna", "last_name": "Fischer", "answers": {"1": ["3"], "20": ["6"], "21": ["1", "2"], "22": ["2"], "23": ["2"]}, "waiting_time": 6}, {"id": 4, "first_name": "Peter", "last_name": "Schulz", "answers": {"1": ["4"], "20": ["2"], "21": ["3"], "22": ["7"], "23": ["5"]}, "waiting_time": 25}, {"id": 5, "first_name": "Desire", "last_name": "Dupont", "answers": {"1": ["5"], "24": ["3"], "25": ["1"], "26": ["3"], "27": ["2"]}, "waiting_time": 38}, {"id": 6, "first_name": "Kim", "last_name": "Park", "answers": {"1": ["6"], "28": ["1"], "29": ["1"], "30": ["1", "3", "4", "7"], "31": ["6"]}, "waiting_time": 40}]
\ No newline at end of file
[{"id": 1, "first_name": "Jialu", "last_name": "Li", "answers": {"1": ["1"], "2": ["1"], "3": ["2"], "4": ["1"], "6": ["2"]}, "waiting_time": 23}, {"id": 2, "first_name": "Emine", "last_name": "Durmaz", "answers": {"1": ["2"], "10": ["2"], "11": ["1"], "12": ["1"], "13": ["8"], "14": ["1"], "15": ["2"], "16": ["2"], "17": ["1"], "18": ["2"]}, "waiting_time": 45}, {"id": 3, "first_name": "Anna", "last_name": "Fischer", "answers": {"1": ["3"], "20": ["6"], "21": ["1", "2"], "22": ["2"], "23": ["2"]}, "waiting_time": 6}, {"id": 4, "first_name": "Peter", "last_name": "Schulz", "answers": {"1": ["4"], "20": ["2"], "21": ["3"], "22": ["7"], "23": ["5"]}, "waiting_time": 25}, {"id": 5, "first_name": "Desire", "last_name": "Dupont", "answers": {"1": ["5"], "24": ["3"], "25": ["1"], "26": ["3"], "27": ["2"]}, "waiting_time": 38}, {"id": 6, "first_name": "Kim", "last_name": "Park", "answers": {"1": ["6"], "28": ["1"], "29": ["1"], "30": ["1", "3", "4", "7"], "31": ["6"]}, "waiting_time": 40}, {"id": 7, "first_name": "Dimitri", "last_name": "Smirnoff", "answers": {"1": ["7"], "32": ["2"], "33": ["1"], "34": ["generelles Unwohlsein"], "38": ["2"], "40": ["2"]}, "waiting_time": 29}]
\ No newline at end of file
{"1": {"text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.)", "number_answers": 8, "single_choices": 1, "dependency": []}, "2": {"text": "Seit wann besteht der Schwindel?", "number_answers": 4, "single_choices": 1, "dependency": ["1.1"]}, "3": {"text": "Leiden Sie zusätzlich unter Übelkeit/Erbrechen?", "number_answers": 2, "single_choices": 1, "dependency": ["1.1"]}, "4": {"text": "Ist der Schwindel dauerhaft vorhanden?", "number_answers": 2, "single_choices": 1, "dependency": ["1.1"]}, "5": {"text": "Tritt der Schwindel nur bei bestimmten Bewegungen auf (z. B. Umdrehen im Bett, Bücken, Kopfneigung nach hinten)?", "number_answers": 2, "single_choices": 1, "dependency": ["1.1", "4.2"]}, "6": {"text": "Haben Sie zusätzliche Beschwerden seit dem Auftreten des Schwindels?", "number_answers": 2, "single_choices": 1, "dependency": ["1.1"]}, "7": {"text": "Welche der folgenden Beschwerden haben Sie zusätzlich?", "number_answers": 8, "single_choices": 0, "dependency": ["1.1", "6.1"]}, "8": {"text": "Wie äußern sich die Doppelbilder konkret?", "number_answers": 3, "single_choices": 0, "dependency": ["1.1", "7.1"]}, "9": {"text": "Wie äußern sich Ihre Probleme konkret?", "number_answers": 4, "single_choices": 1, "dependency": ["1.1", "7.2"]}, "10": {"text": "Seit wann besteht der Kopfschmerz?", "number_answers": 4, "single_choices": 1, "dependency": ["1.2"]}, "11": {"text": "Sind die Schmerzen plötzlich oder innerhalb sehr kurzer Zeit (d. h. innerhalb einer Minute) aufgetreten?", "number_answers": 2, "single_choices": 1, "dependency": ["1.2"]}, "12": {"text": "In welchem Bereich des Kopfes?", "number_answers": 4, "single_choices": 1, "dependency": ["1.2"]}, "13": {"text": "Wie stark sind die Schmerzen?\n(0=keine Schmerzen, 10=maximal starke Schmerzen)?", "number_answers": 11, "single_choices": 1, "dependency": ["1.2"]}, "14": {"text": "Sind die Schmerzen hinsichtlich Ort ihres Auftretens, ihrer Stärke oder anderweitig anders als Kopfschmerzen, die Sie kennen?", "number_answers": 2, "single_choices": 1, "dependency": ["1.2"]}, "15": {"text": "Haben Sie Fieber?", "number_answers": 5, "single_choices": 1, "dependency": ["1.2"]}, "16": {"text": "Hatten Sie kürzlich eine Kopfverletzung, einen Sturz auf den Kopf oder heftiger Anprall?", "number_answers": 2, "single_choices": 1, "dependency": ["1.2"]}, "17": {"text": "Ging den Kopfschmerzen eine körperliche Anstrengung (inkl. Husten/Niesen/Pressen/schweres Heben) voraus?", "number_answers": 2, "single_choices": 1, "dependency": ["1.2"]}, "18": {"text": "Haben Sie weitere Beschwerden zusätzlich zu den Kopfschmerzen?", "number_answers": 2, "single_choices": 1, "dependency": ["1.2"]}, "19": {"text": "Welche der folgenden Beschwerden haben Sie zusätzlich?", "number_answers": 8, "single_choices": 0, "dependency": ["1.2", "18.1"]}, "20": {"text": "Seit wann besteht die Schwäche/Lähmung/ Missempfindung?", "number_answers": 6, "single_choices": 1, "dependency": ["1.3", "or", "1.4"]}, "21": {"text": "Welche Beschwerden haben Sie?", "number_answers": 3, "single_choices": 0, "dependency": ["1.3", "or", "1.4"]}, "22": {"text": "Wo sind Ihre Beschwerden?", "number_answers": 7, "single_choices": 1, "dependency": ["1.3", "or", "1.4"]}, "23": {"text": "Nehmen Sie derzeit eines der folgenden Medikamente ein?", "number_answers": 6, "single_choices": 0, "dependency": ["1.3", "or", "1.4"]}, "24": {"text": "Seit wann besteht die Sprach-/ Sprechstörung?", "number_answers": 4, "single_choices": 1, "dependency": ["1.5"]}, "25": {"text": "Welche Aussage beschreibt die Beschwerden am besten?", "number_answers": 3, "single_choices": 1, "dependency": ["1.5"]}, "26": {"text": "Haben oder hatten Sie zusätzlich eine oder mehrere der folgenden Beschwerden:", "number_answers": 3, "single_choices": 0, "dependency": ["1.5"]}, "27": {"text": "Nehmen Sie derzeit eines der folgenden Medikamente ein?", "number_answers": 6, "single_choices": 0, "dependency": ["1.5"]}, "28": {"text": "Seit wann besteht die Sehstörung?", "number_answers": 4, "single_choices": 1, "dependency": ["1.6"]}, "29": {"text": "Welche Aussage beschreibt die Beschwerden am besten?", "number_answers": 3, "single_choices": 1, "dependency": ["1.6"]}, "30": {"text": "Sind die Sehstörungen von anderen Symptomen begleitet:", "number_answers": 7, "single_choices": 0, "dependency": ["1.6"]}, "31": {"text": "Nehmen Sie derzeit eines der folgenden Medikamente ein?", "number_answers": 6, "single_choices": 0, "dependency": ["1.6"]}, "32": {"text": "Kommen Sie wegen eines stattgehabten Krampfanfalls in die Klinik?", "number_answers": 2, "single_choices": 1, "dependency": ["1.7"]}, "33": {"text": "Geben Sie bitte den Grund Ihres Kommens an.", "number_answers": 2, "single_choices": 1, "dependency": ["1.7", "32.2"]}, "34": {"text": "Warum kommen Sie in die Klinik?", "number_answers": 1, "single_choices": 1, "dependency": ["1.7", "33.1"]}, "35": {"text": "Wann war der Anfall?", "number_answers": 3, "single_choices": 1, "dependency": ["1.7", "32.1"]}, "36": {"text": "Hatten Sie mehr als einen Krampfanfall?", "number_answers": 2, "single_choices": 1, "dependency": ["1.7", "32.1"]}, "37": {"text": "Wie viele Krampfanfälle hatten Sie?", "number_answers": 3, "single_choices": 1, "dependency": ["1.7", "36.1"]}, "38": {"text": "Ist bei Ihnen eine Epilepsie bekannt?", "number_answers": 2, "single_choices": 1, "dependency": ["1.7"]}, "39": {"text": "Sind Sie deswegen in regelmäßiger Behandlung bei einem niedergelassenen Neurologen?", "number_answers": 2, "single_choices": 1, "dependency": ["1.7", "38.1"]}, "40": {"text": "Nehmen Sie regelmäßig ein Antiepileptikum (Medikament gegen epileptische Anfälle) ein?", "number_answers": 2, "single_choices": 1, "dependency": ["1.7"]}, "41": {"text": "Handelt es sich bei Ihren Beschwerden um", "number_answers": 6, "single_choices": 0, "dependency": ["1.8"]}, "42": {"text": "Welche anderen Beschwerden haben Sie?", "number_answers": 1, "single_choices": 1, "dependency": ["1.8", "41.6"]}, "43": {"text": "Seit wann bestehen diese Beschwerden?", "number_answers": 5, "single_choices": 1, "dependency": ["1.8"]}, "44": {"text": "Nehmen Sie wegen dieser Beschwerden Medikamente ein?", "number_answers": 2, "single_choices": 1, "dependency": ["1.8"]}, "45": {"text": "Welche Medikamente nehmen Sie aufgrund dieser Beschwerden?", "number_answers": 1, "single_choices": 1, "dependency": ["1.8", "44.1"]}, "46": {"text": "Waren Sie wegen dieser Beschwerden schon in ärztlicher Behandlung?", "number_answers": 3, "single_choices": 1, "dependency": ["1.8"]}, "47": {"text": "Ist bei Ihnen eine neurologische Erkrankung bekannt?", "number_answers": 2, "single_choices": 1, "dependency": [""]}, "48": {"text": "Welche neurologische Erkrankung ist bei Ihnen bekannt?", "number_answers": 5, "single_choices": 0, "dependency": ["47.1"]}, "49": {"text": "Sind Sie deswegen in regelmäßiger Behandlung bei einem niedergelassenen Neurologen?", "number_answers": 2, "single_choices": 1, "dependency": ["48.1"]} }
\ No newline at end of file
This diff is collapsed.
<html lang="GER">
<head>
<meta http-equiv="refresh" content="10" /> <title>
Patients and their flags
</title>
</head>
<body style="background-color:grey">
<b>Patient List</b><table>
<tr>
<th>Patient</th>
<th>Flag</th>
<th>Wait Time [s]</th>
</tr>
<tr>
<td>Hatsune, Miku</td>
<td> <p style="color:green;"> green
</p> </td> <td>44128</td>
</tr>
</table>
</body>
</html>
# Import server module
import time
import http.server
# Import SocketServer module
import socketserver
def start_server(port=8000):
# Create object for handling HTTP requests
handler = http.server.SimpleHTTPRequestHandler
# Run the server forever to handle the HTTP requests
with socketserver.TCPServer(("", port), handler) as httpd:
print("Web Server is running at http://localhost:%s" % port)
print("Patient list can be accessed at http://localhost:%s/web/PatientFlags.html" % port)
httpd.serve_forever()
def update_function(patient_list):
while True:
update_html_file(patient_list=patient_list)
time.sleep(0.5)
def html_patient(patient):
html_str = " <tr>\n" \
" <td>{0}</td>\n" \
" <td>" \
" <p style=\"color:{1};\">" \
" {1}\n" \
" </p>" \
" </td>" \
" <td>{2}</td>\n" \
" </tr>\n".format(patient["last_name"] + ' ' + patient["first_name"],
patient["Patient_Priority"],
int(time.time()-patient["entrance"]))
return html_str
def html_patient_list(patient_list):
html_str = "<b>Patient List</b>"
html_str += "<table>\n" \
" <tr>\n" \
" <th>Patient</th>\n" \
" <th>Flag</th>\n" \
" <th>Wait Time [s]</th>\n" \
" </tr>\n"
for elem in patient_list:
html_str += html_patient(elem)
html_str += "</table>\n"
return html_str
def html_header():
html_str = " <head>\n" \
" <meta http-equiv=\"refresh\" content=\"10\" />" \
" <title>\n" \
" Patients and their flags\n" \
" </title>\n" \
" </head>\n"
return html_str
def build_html(patient_list):
html_str = "<html lang=\"GER\">\n"
html_str += html_header()
html_str += "<body style=\"background-color:grey\">\n"
html_str += html_patient_list(patient_list)
html_str += "</body>\n"
html_str += "</html>\n"
return html_str
def update_html_file(patient_list):
table_file = open('web/PatientFlags.html', 'w')
table_file.write(build_html(patient_list))
table_file.close()
{
"resourceType":"QuestionnaireResponse",
"id":"e6f93635-cbd6-468b-9fb6-1fabde7b879a",
"identifier":{
"type":{
"text":"Questionnaire Id"
},
"value":"087445ac-56e2-438b-9aa3-f144d7114307"
},
"status":"completed",
"authored":"2022-01-20T12:58:21.776000+00:00",
"source":{
"reference":"#4ae96da4-e763-43b6-bced-cac45d6949db"
},
"item":[
{
"linkId":"Datum_1",
"text":"Heutiges Datum",
"answer":[
{
"valueString":"2022-03-09",
"flag":"red"
}
]
},
{
"linkId":"Freitext_1",
"text":"Wie geht es Ihnen sonst?",
"answer":[
{
"valueString":"Zweiter Fragebogen",
"flag":"green",
"if":[
{
"linkId":"Datum_1",
"answer":"2022-03-09"
}
]
}
]
}
]
}
\ No newline at end of file
{
"resourceType":"QuestionnaireResponse",
"id":"e6f93635-cbd6-468b-9fb6-1fabde7b879a",
"identifier":{
"type":{
"text":"Questionnaire Id"
},
"value":"087445ac-56e2-438b-9aa3-f144d7114307"
},
"status":"completed",
"authored":"2022-04-20T12:58:21.776000+00:00",
"source":{
"reference":"#4ae96da4-e763-43b6-bced-cac45d6949db"
},
"item":
[
{"linkId": "question neutral", "text": "question neutral", "multipleAnswers": "0",
"answer": [{"valueString": "Answer1", "flag": "yellow"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1RedFlag", "text": "question 1RedFlag", "multipleAnswers": "0",
"answer": [{"valueString": "Answer1", "flag": "red"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1GreenFlag", "text": "question 1GreenFlag", "multipleAnswers": "0",
"answer": [{"valueString": "Answer1", "flag": "green"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1Green2Red3yellow", "text": "question 1Green2Red3yellow", "multipleAnswers": "0",
"answer": [{"valueString": "Answer1", "flag": "green"}, {"valueString": "Answer2", "flag": "red"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question neutral multipleAnswers", "text": "question neutral multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "yellow"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1RedFlag multipleAnswers", "text": "question 1RedFlag multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "red"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 12RedFlag multipleAnswers", "text": "question 12RedFlag multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "red"}, {"valueString": "Answer2", "flag": "red"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1GreenFlag multipleAnswers", "text": "question 1GreenFlag multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "green"}, {"valueString": "Answer2", "flag": "yellow"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 12GreenFlag multipleAnswers", "text": "question 12GreenFlag multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "green"}, {"valueString": "Answer2", "flag": "green"}, {"valueString": "Answer3", "flag": "yellow"}]},
{"linkId": "question 1Green2Red3Yellow multipleAnswers", "text": "question 1Green2Red3Yellow multipleAnswers", "multipleAnswers": "1",
"answer": [{"valueString": "Answer1", "flag": "green"}, {"valueString": "Answer2", "flag": "red"}, {"valueString": "Answer3", "flag": "yellow"}]}
]
}
\ No newline at end of file
{"questionnaireresponseid": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "first_name": "Miku", "last_name": "Hatsune", "prios": [{"linkId": "1", "prio": "yellow", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.): ", "answer": [{"valueString": "Schwindel"}]}, {"linkId": "2", "prio": "yellow", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Seit wann besteht der Schwindel?", "answer": [{"valueString": "L\u00e4nger als 6 Tage ohne k\u00fcrzliche Verschlimmerung"}]}, {"linkId": "3", "prio": "yellow", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Leiden Sie zus\u00e4tzlich unter \u00dcbelkeit/Erbrechen?", "answer": [{"valueString": "Nein"}]}, {"linkId": "4", "prio": "yellow", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Ist der Schwindel dauerhaft vorhanden?", "answer": [{"valueString": "Ja"}]}, {"linkId": "5", "prio": "green", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Tritt der Schwindel nur bei bestimmten Bewegungen auf (z. B. Umdrehen im Bett, B\u00fccken, Kopfneigung nach hinten)?", "answer": [{"valueString": "Ja"}]}, {"linkId": "6", "prio": "green", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "text": "Haben Sie zus\u00e4tzliche Beschwerden seit dem Auftreten des Schwindels? ", "answer": [{"valueString": "Nein"}]}], "Patient_Priority": "green", "entrance": 1648650461.425189}
\ No newline at end of file
{"resourceType": "QuestionnaireResponse", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "contained": [{"resourceType": "Patient", "id": "4ae96da4-e763-43b6-bced-cac45d6949db", "identifier": [{"type": {"text": "Patient Number"}, "value": "0"}, {"type": {"text": "Case Number"}, "value": "0"}], "name": [{"family": "Hatsune", "given": ["Miku"]}], "gender": "female", "birthDate": "1900-01-01", "address": [{"text": "Musterstr"}]}], "identifier": {"type": {"text": "Questionnaire Id"}, "value": "087445ac-56e2-438b-9aa3-f144d7114307"}, "status": "completed", "authored": "2022-01-20T12:58:21.776000+00:00", "source": {"reference": "#4ae96da4-e763-43b6-bced-cac45d6949db"}, "item": [{"linkId": "1", "text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.): ", "answer": [{"valueString": "Schwindel"}]}, {"linkId": "2", "text": "Seit wann besteht der Schwindel?", "answer": [{"valueString": "L\u00e4nger als 6 Tage ohne k\u00fcrzliche Verschlimmerung"}]}, {"linkId": "3", "text": "Leiden Sie zus\u00e4tzlich unter \u00dcbelkeit/Erbrechen?", "answer": [{"valueString": "Nein"}]}, {"linkId": "4", "text": "Ist der Schwindel dauerhaft vorhanden?", "answer": [{"valueString": "Ja"}]}, {"linkId": "5", "text": "Tritt der Schwindel nur bei bestimmten Bewegungen auf (z. B. Umdrehen im Bett, B\u00fccken, Kopfneigung nach hinten)?", "answer": [{"valueString": "Ja"}]}, {"linkId": "6", "text": "Haben Sie zus\u00e4tzliche Beschwerden seit dem Auftreten des Schwindels? ", "answer": [{"valueString": "Nein"}]}]}
\ No newline at end of file
cd api
flask run &
cd ../ui
npm run serve
\ No newline at end of file
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# hello-world
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# hello-world
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.12"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<!--img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/-->
<router-view />
</template>
<script>
// import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
// HelloWorld
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
import { createApp } from 'vue'
import router from './router'
import App from './App.vue'
createApp(App).use(router).mount('#app')
import { createRouter, createWebHistory } from 'vue-router'
import Ampel from '../views/Ampel.vue'
import WaitingTime from '../views/WaitingTime.vue'
const routes = [
{
path: '/ampel',
name: 'Ampel',
component: Ampel
},
{
path: '/waitingtime',
name: 'WaitingTime',
component: WaitingTime
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
<template>
<div>
<p>Test</p>
</div>
</template>
<script>
//import statements
export default {
name: "Ampel",
//components from import statements
data() {
return {
patients: []
}
},
methods: {
//search(){
//postSearch({ //only a get function?
//json like
//})
//.then(response => response.json())
//.then(data => {console.log(data); this.patients = data})
//}
}
}
</script>
<!--<style></style>-->
<template>
<div>
<p>Waiting</p>
</div>
</template>
<script>
//import statements
export default {
name: "WaitingTime",
//components from import statements
data() {
return {
// todo
}
},
methods: {
// todo
}
}
</script>
<!--<style></style>-->
\ No newline at end of file
npm uninstall tailwindcss postcss autoprefixer
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
\ No newline at end of file
This diff is collapsed.
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"fusioncharts": "^3.18.0",
"vue": "^3.0.0",
"vue-fusioncharts": "^3.2.0",
"vue-router": "^4.0.12",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"autoprefixer": "^9.8.8",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"postcss": "^7.0.39",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer')
]
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>UC2</title>
</head>
<body>
<noscript>
<strong>We're sorry but UC2 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<!--img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/-->
<router-view />
</template>
<script>
// import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
// HelloWorld
}
}
</script>
<!--<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>-->
\ No newline at end of file
const API_URL = "http://localhost:5000"
//const API_URL = "http://localhost:8710"
export function get_patient_list(jwt) {
return fetch(`${API_URL}/ampel`, {
method: 'GET',
headers: {
'Content-Type': 'application/json;charset=utf-8',
Authorization: `Bearer: ${jwt}`
}
})
}
export function delete_patient(id_, jwt) {
return fetch(`${API_URL}/ampel`, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
Authorization: `Bearer: ${jwt}`
},
body: JSON.stringify(id_)
})
}
export function login(auth) {
return fetch(`${API_URL}/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(auth)
})
}
\ No newline at end of file
export function isValidJwt (jwt) {
console.log(jwt.split('.').length)
if (!jwt || jwt.split('.').length < 1) { // If no Token exists or it is formatted wrong this function will return false and you will be rerouted to login
return false
}
return true //returns true only to say that the jwt token exists in the correct form, not that the logindata was correct.
}
\ No newline at end of file
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
@tailwind base;
@tailwind components;
@tailwind utilities;
\ No newline at end of file
import { createApp } from 'vue'
import router from './router'
import App from './App.vue'
import store from './store'
import './main.css'
createApp(App).use(store).use(router).mount('#app')
import { createRouter, createWebHistory } from 'vue-router'
import Ampel from '../views/Ampel.vue'
import Login from '../views/Login.vue'
import store from '@/store'
const routes = [
{
path: '/ampel',
name: 'Ampel',
component: Ampel
},
{
path: '/login',
name: 'Login',
component: Login
},
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
// Login Guard
router.beforeEach((to, from, next) => {
if (store.getters['isAuthenticated']) {
if (to.name === 'Login') next({name: 'Ampel'})
else next()
} else {
if (to.name !== 'Login')
next({name: 'Login'})
else next()
}
})
export default router
import { createStore } from 'vuex'
import { login } from '@/api'
import { isValidJwt } from '@/authentification'
const store = createStore({
state() {
return {
jwt: '',
userData: {},
}
},
mutations: {
setUserData(state, payload) {
console.log('setUserData payload = ', payload)
state.userData = payload.userData
},
setJwtToken(state, payload) {
console.log('setJwtToken payload = ', payload)
localStorage.jwt = payload.jwt
state.jwt = payload.jwt
}
},
actions: {
login(context, userData) {
console.log("login userData = ", userData)
context.commit('setUserData', { userData })
return login(userData)
.then(response => response.json())
.then(data => { context.commit('setJwtToken', { jwt: data.token }) } )
.catch(error => {
console.log('Error Authenticating: ', error)
})
},
tryRecoverJwt(context) {
if (localStorage.getItem('jwt') !== '') {
console.log("recovering from localStorage")
context.commit("setJwtToken", { jwt: localStorage.jwt })
}
},
logout(context) {
context.commit("setUserData", { userData: {} })
context.commit("setJwtToken", { jwt: '' })
}
},
modules: {
},
getters: {
isAuthenticated(state) {
console.log(state, isValidJwt(state.jwt))
return isValidJwt(state.jwt)
}
}
})
export default store
\ No newline at end of file
<!--todo:
"done" button,
autorefresh -> noch mal googeln (so alle 5 Sekunden),
sorting -> Zweitrangig
longterm: history
-->
<template>
<div>
<div>
<p>todo: options(change to waiting time, change colorblindness, etc)</p>
</div>
<!-- todo: pretty, additional info, widths-->
<div class="content-center"><!--does not seem to work maybe just give some space in each direction-->
<table class="w-full border-collapse border border-slate-900 table-fixed" id="patientTable">
<thead>
<tr>
<th class="border border-slate-500" v-for="col in columns" :key="col" v-bind:class="this.tablewidths[col]">{{niceColumnNames[col]}}</th>
</tr>
</thead>
<tbody>
<template v-for="patient in patients" :key="patient.id">
<tr class="border border-slate-500">
<template v-for="col in columns" :key="col">
<td @click="this.changeAddionalInfoBools(patient.id)" v-bind:class="this.tablewidths[col]">{{patient[col]}} </td>
</template>
<td @click="this.changeAddionalInfoBools(patient.id)" v-bind:class="colornames[patient.color]"></td>
<td @click="this.patientDone(patient.id, 'done')" class="">Bearbeitet</td>
<td @click="this.patientDone(patient.id, 'sent_home')" class="">Nach Hause geschickt</td>
<td @click="this.patientDone(patient.id, 'sent_on')" class="">Weitergeleitet</td>
</tr>
<tr>
<td colspan="6" v-if="this.additionalInfoBools[patient.id]">
<div v-for="answerInText in patient.answersInText" :key="answerInText">
{{answerInText}}
</div>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</template>
<script>
import { get_patient_list } from '@/api'
import { delete_patient } from '@/api'
export default {
name: "Ampel",
//components from import statements
methods: {
fillAdditionalInfoBools() {
console.log({"fill": "called"})
for (const patient in this.patients){
if (!(patient.id in this.additionalInfoBools)){
this.additionalInfoBools[patient.id] = false;
}
}
},
changeAddionalInfoBools(patientid){
console.log({"change": "called", "id": patientid})
if (this.additionalInfoBools[patientid]){
this.additionalInfoBools[patientid] = false;
}
else{
this.additionalInfoBools[patientid] = true;
}
},
Intervallmethod(){
setInterval(() => {
get_patient_list(this.$store.state.jwt)
.then(response => response.json())
.then(data => { this.patients = data; console.log(data) })
.then(this.fillAdditionalInfoBools())
}, 5000)
},
patientDone(id_, done_how){
delete_patient({"id_": id_, "done_how": done_how}, this.$store.state.jwt)
.then(response => response.json())
.then(data => { this.patients = data; console.log(data) })
.then(this.fillAdditionalInfoBools())
},
},
beforeMount() {
get_patient_list(this.$store.state.jwt)
.then(response => response.json())
.then(data => { this.patients = data; console.log(data) })
.then(this.fillAdditionalInfoBools())
this.Intervallmethod()
},
data() {
return {
patients: [],
additionalInfoBools: {},
columns: ["id", "first_name", "last_name", "primary_concern", "waiting_time"],
niceColumnNames: {"id": "ID", "first_name": "Vorname", "last_name": "Nachname", "waiting_time": "Wartezeit", "primary_concern": "Besuchgrund", "color": ""},
tablewidths: {"id": "border border-slate-500 flex justify-center", "first_name": "border border-slate-500", "last_name": "border border-slate-500", "waiting_time": "border border-slate-500", "primary_concern": "border border-slate-500 w-5/12", "color": "border border-slate-500"},
colornames: {"red": "bg-red-600", "green": "bg-green-600", "yellow": "bg-yellow-600"}
}
},
}
</script>
<template>
<div class="flex flex-col items-center">
<div class="text-left w-64 mb-8 space-y-2 text-center text-2xl">Bitte authentifizieren Sie sich</div>
<div class="flex flex-col space-y-2">
<input
type="text" id="username" name="username" v-model="username"
placeholder="username">
<input
type="password" id="password" name="password" v-model="password"
placeholder="password">
</div>
<div>
<button @click="postLogin" class="bg-blue-400 text-white">
Login
</button>
</div>
</div>
</template>
<script>
export default {
name: "Login",
methods: {
postLogin(){
this.$store.dispatch('login', { username: this.username, password: this.password })
.then(() => this.$router.push('/ampel'))
},
},
data() {
return {
username: "",
password: "",
}
},
}
</script>
\ No newline at end of file
<template>
<div>
<p>Waiting</p>
</div>
</template>
<script>
//import Vue from 'vue';
//import VueFusionCharts from 'vue-fusioncharts';
//import FusionCharts from 'fusioncharts';
//import Column2D from 'fusioncharts/fusioncharts.charts';
//import FusionTheme from 'fusioncharts/themes/fusioncharts.theme.fusion';
//
//Vue.use(VueFusionCharts, FusionCharts, Column2D, FusionTheme);
export default {
name: "WaitingTime",
//components from import statements
data() {
return {
// todo
}
},
methods: {
// todo
}
}
</script>
<!--<style></style>-->
\ No newline at end of file
module.exports = {
content: ["./src/App.vue", "./src/**/*.{html, js, vue}"],
theme: {
extend: {},
},
plugins: [],
}
\ No newline at end of file
{"resourceType": "QuestionnaireResponse", "id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a", "contained": [{"resourceType": "Patient", "id": "4ae96da4-e763-43b6-bced-cac45d6949db", "identifier": [{"type": {"text": "Patient Number"}, "value": "0"}, {"type": {"text": "Case Number"}, "value": "0"}], "name": [{"family": "Hatsune", "given": ["Miku"]}], "gender": "female", "birthDate": "1900-01-01", "address": [{"text": "Musterstr"}]}], "identifier": {"type": {"text": "Questionnaire Id"}, "value": "087445ac-56e2-438b-9aa3-f144d7114307"}, "status": "completed", "authored": "2022-01-20T12:58:21.776000+00:00", "source": {"reference": "#4ae96da4-e763-43b6-bced-cac45d6949db"}, "item": [{"linkId": "1", "text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.): ", "answer": [{"valueString": "Schwindel"}]}, {"linkId": "2", "text": "Seit wann besteht der Schwindel?", "answer": [{"valueString": "L\u00e4nger als 6 Tage ohne k\u00fcrzliche Verschlimmerung"}]}, {"linkId": "3", "text": "Leiden Sie zus\u00e4tzlich unter \u00dcbelkeit/Erbrechen?", "answer": [{"valueString": "Nein"}]}, {"linkId": "4", "text": "Ist der Schwindel dauerhaft vorhanden?", "answer": [{"valueString": "Ja"}]}, {"linkId": "5", "text": "Tritt der Schwindel nur bei bestimmten Bewegungen auf (z. B. Umdrehen im Bett, B\u00fccken, Kopfneigung nach hinten)?", "answer": [{"valueString": "Ja"}]}, {"linkId": "6", "text": "Haben Sie zus\u00e4tzliche Beschwerden seit dem Auftreten des Schwindels? ", "answer": [{"valueString": "Nein"}]}]}
\ No newline at end of file
{"user1": "sha256$qoYHrJmQr0tZMhJ9$61dd48c6c3f9c1fb06ac1a1416bd8dcb37d87ca3e558ded37da5448b568e1eef"}
\ No newline at end of file
.TEDIAS @ 8d91e986
Subproject commit 8d91e98692c223e464302ed25da22573438ae328
This source diff could not be displayed because it is too large. You can view the blob instead.
Username: mhirsch
Token: w1kB_NGNf9qZxaHCqdRS
Mit folgendem Command kannst du das Repository clonen:
git clone https://mhirsch:w1kB_NGNf9qZxaHCqdRS@gitlab.cc-asp.fraunhofer.de/tedias/architecture/tedias.architecture.git
Probier mal, ob das bei dir klappt.
import json
import os
from copy import deepcopy
response = {
"resourceType": "QuestionnaireResponse",
"id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a",
"contained":
[
{
"resourceType": "Patient",
"id": "4ae96da4-e763-43b6-bced-cac45d6949db",
"identifier":
[
{
"type":
{
"text": "Patient Number"
},
"value": "0"
},
{
"type":
{
"text": "Case Number"
},
"value": "0"
}
],
"name":
[
{
"family": "Tepes",
"given":
[
"Krul"
]
}
],
"gender": "female",
"birthDate": "1900-01-01",
"address":
[
{
"text": "Musterstr"
}
]
}
],
"identifier":
{
"type":
{
"text": "Questionnaire Id"
},
"value": "087445ac-56e2-438b-9aa3-f144d7114307"
},
"status": "completed",
"authored": "2022-01-20T12:58:21.776000+00:00",
"source":
{
"reference": "#4ae96da4-e763-43b6-bced-cac45d6949db"
},
"item":
[
{
"linkId": "1",
"text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.): ",
"answer":
[
{
"valueString": "Schwindel"
}
]
},
]
}
def f(x):
return x.split("-")[-1].split(".")[0]
with open("questionnaire") as file:
questionnaire = json.load(file)
files_already_created = list(map(f, os.listdir("unprocessed_files")))
files_already_created.sort(key = lambda i: int(i, 16))
last_patient_id = "e6f93635-cbd6-468b-9fb6-" + files_already_created[-1]
patient_name = " " # placeholder
while patient_name != "":
response["item"] = []
patient_name = input("Patient Name: ")
if " " in patient_name:
first_name = patient_name.split(" ")[1]
last_name = patient_name.split(" ")[0]
else:
first_name = patient_name
last_name = ""
response["id"] = "-".join(last_patient_id.split("-")[:-1]) + "-" + hex(int(last_patient_id.split("-")[-1],16)+1)[2:] # counts the last hexadecimal one up
last_patient_id = deepcopy(response["id"])
print(f"ID: {last_patient_id}")
response["contained"][0]["name"] = [
{
"family": first_name,
"given":
[
last_name
]
}
]
for question in questionnaire["item"]:
question_processed = {"linkId": question["linkId"], "text": question["text"], "answer": []}
print(question["text"])
print("Answers: ")
for idx, answer in enumerate(question["answer"]):
print(str(idx+1)+": "+answer["valueString"])
if int(question["multipleAnswers"]):
input_answer = " " # placeholder
print("choose by number untill done, then press enter")
while input_answer != "":
input_answer = input("> ")
if input_answer != "":
try:
input_answer = int(input_answer)
except Exception:
input_answer = -1
if input_answer-1 in range(len(question["answer"])):
question_processed["answer"].append(question["answer"][input_answer-1])
else:
print("Invalid")
else:
input_answer = -1
while input_answer-1 not in range(len(question["answer"])):
print("choose an answer by number")
input_answer = input("> ")
try:
input_answer = int(input_answer)
except Exception:
input_answer = -1
question_processed["answer"].append(question["answer"][input_answer-1])
response["item"].append(question_processed)
os.system("touch unprocessed_files/"+last_patient_id+".json")
with open("unprocessed_files/"+last_patient_id+".json", "w") as file:
json.dump(response, file)
{
"resourceType": "QuestionnaireResponse",
"id": "e6f93635-cbd6-468b-9fb6-1fabde7b879a",
"contained":
[
{
"resourceType": "Patient",
"id": "4ae96da4-e763-43b6-bced-cac45d6949db",
"identifier":
[
{
"type":
{
"text": "Patient Number"
},
"value": "0"
},
{
"type":
{
"text": "Case Number"
},
"value": "0"
}
],
"name":
[
{
"family": "Tepes",
"given":
[
"Krul"
]
}
],
"gender": "female",
"birthDate": "1900-01-01",
"address":
[
{
"text": "Musterstr"
}
]
}
],
"identifier":
{
"type":
{
"text": "Questionnaire Id"
},
"value": "087445ac-56e2-438b-9aa3-f144d7114307"
},
"status": "completed",
"authored": "2022-01-20T12:58:21.776000+00:00",
"source":
{
"reference": "#4ae96da4-e763-43b6-bced-cac45d6949db"
},
"item":
[
{
"linkId": "1",
"text": "Wegen welcher der folgenden Beschwerden haben Sie heute die Notaufnahme aufgesucht oder wurden von einem Arzt in die Notaufnahme geschickt (Bei Vorhandensein mehrerer Beschwerden kreuzen Sie bitte diejenige an, die im Vordergrund steht und zur Vorstellung hier Anlass gegeben hat.): ",
"answer":
[
{
"valueString": "Schwindel"
}
]
},
{
"linkId": "2",
"text": "Seit wann besteht der Schwindel?",
"answer":
[
{
"valueString": "Seit 4 Stunden oder kürzer"
}
]
},
{
"linkId": "3",
"text": "Leiden Sie zusätzlich unter Übelkeit/Erbrechen?",
"answer":
[
{
"valueString": "Nein"
}
]
},
{
"linkId": "4",
"text": "Ist der Schwindel dauerhaft vorhanden?",
"answer":
[
{
"valueString": "Ja"
}
]
},
{
"linkId": "5",
"text": "Tritt der Schwindel nur bei bestimmten Bewegungen auf (z. B. Umdrehen im Bett, Bücken, Kopfneigung nach hinten)?",
"answer":
[
{
"valueString": "Ja"
}
]
},
{
"linkId": "6",
"text": "Haben Sie zusätzliche Beschwerden seit dem Auftreten des Schwindels? ",
"answer":
[
{
"valueString": "Ja"
}
]
}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment