From 7e8c478ce91fbd1a0b60e40cea71cecb0fea9f24 Mon Sep 17 00:00:00 2001 From: Toni000 Date: Mon, 25 Mar 2024 15:59:06 +0100 Subject: [PATCH] #108 backend: add triage to patient model --- .../game/migrations/0006_patient_triage.py | 18 ++++++++++++++++++ backend/dps_training_k/game/models/patient.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 backend/dps_training_k/game/migrations/0006_patient_triage.py diff --git a/backend/dps_training_k/game/migrations/0006_patient_triage.py b/backend/dps_training_k/game/migrations/0006_patient_triage.py new file mode 100644 index 00000000..aa95ab95 --- /dev/null +++ b/backend/dps_training_k/game/migrations/0006_patient_triage.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.1 on 2024-03-25 14:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('game', '0005_rename_invitation_code_exercise_exerciseid_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='patient', + name='triage', + field=models.CharField(choices=[('-', 'undefined'), ('R', 'red'), ('Y', 'yellow'), ('G', 'green'), ('A', 'airway'), ('B', 'breathing'), ('C', 'circulation'), ('D', 'disability'), ('E', 'exposure')], default='-'), + ), + ] diff --git a/backend/dps_training_k/game/models/patient.py b/backend/dps_training_k/game/models/patient.py index 558e2d6b..8136b3b6 100644 --- a/backend/dps_training_k/game/models/patient.py +++ b/backend/dps_training_k/game/models/patient.py @@ -4,6 +4,17 @@ class Patient(Eventable, models.Model): + class Triage(models.TextChoices): + UNDEFINED = "-", "undefined" + RED = "R", "red" + YELLOW = "Y", "yellow" + GREEN = "G", "green" + Airway = "A", "airway" + BREATHING = "B", "breathing" + CIRCULATION = "C", "circulation" + DISABILITY = "D", "disability" + EXPOSURE = "E", "exposure" + name = models.CharField( max_length=100, default="Max Mustermann" ) # technically patientData but kept here for simplicity for now @@ -14,6 +25,10 @@ class Patient(Eventable, models.Model): patientId = models.IntegerField( help_text="patientId used to log into patient - therefore part of authentication" ) + triage = models.CharField( + choices=Triage.choices, + default=Triage.UNDEFINED, + ) def __str__(self): return f"Patient #{self.id} called {self.name} with ID {self.patientId}"