Skip to content

Commit

Permalink
#108 backend: add triage to patient model
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni000 committed Mar 25, 2024
1 parent 9cb78c9 commit 7e8c478
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions backend/dps_training_k/game/migrations/0006_patient_triage.py
Original file line number Diff line number Diff line change
@@ -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='-'),
),
]
15 changes: 15 additions & 0 deletions backend/dps_training_k/game/models/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down

0 comments on commit 7e8c478

Please sign in to comment.