Skip to content

Commit

Permalink
Add text choices to RO/TO model
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 2, 2024
1 parent 6ef1bce commit ac15c3a
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions backend/ebios_rm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,27 @@ class RiskOrigin(models.TextChoices):
AVENGER = "avenger", _("Avenger")
PATHOLOGICAL = "pathological", _("Pathological")

class Motivation(models.IntegerChoices):
UNDEFINED = 0, "undefined"
VERY_LOW = 1, "very_low"
LOW = 2, "low"
SIGNIFICANT = 3, "significant"
STRONG = 4, "strong"

class Resources(models.IntegerChoices):
UNDEFINED = 0, "undefined"
LIMITED = 1, "limited"
SIGNIFICANT = 2, "significant"
IMPORTANT = 3, "important"
UNLIMITED = 4, "unlimited"

class Pertinence(models.IntegerChoices):
UNDEFINED = 0, "undefined"
IRRELAVANT = 1, "irrelevant"
PARTIALLY_RELEVANT = 2, "partially_relevant"
FAIRLY_RELEVANT = 3, "fairly_relevant"
HIGHLY_RELEVANT = 4, "highly_relevant"

ebios_rm_study = models.ForeignKey(
EbiosRMStudy,
verbose_name=_("EBIOS RM study"),
Expand All @@ -140,14 +161,30 @@ class RiskOrigin(models.TextChoices):
FearedEvent, verbose_name=_("Feared events"), related_name="ro_to_couples"
)

risk_origin = models.CharField(max_length=200, verbose_name=_("Risk origin"))
risk_origin = models.CharField(
max_length=32, verbose_name=_("Risk origin"), choices=RiskOrigin.choices
)
target_objective = models.CharField(
max_length=200, verbose_name=_("Target objective")
)
motivation = models.PositiveSmallIntegerField(verbose_name=_("Motivation"))
resources = models.PositiveSmallIntegerField(verbose_name=_("Resources"))
pertinence = models.PositiveSmallIntegerField(verbose_name=_("Pertinence"))
activity = models.PositiveSmallIntegerField(verbose_name=_("Activity"))
motivation = models.PositiveSmallIntegerField(
verbose_name=_("Motivation"),
choices=Motivation.choices,
default=Motivation.UNDEFINED,
)
resources = models.PositiveSmallIntegerField(
verbose_name=_("Resources"),
choices=Resources.choices,
default=Resources.UNDEFINED,
)
pertinence = models.PositiveSmallIntegerField(
verbose_name=_("Pertinence"),
choices=Pertinence.choices,
default=Pertinence.UNDEFINED,
)
activity = models.PositiveSmallIntegerField(
verbose_name=_("Activity"), default=0, validators=[MaxValueValidator(4)]
)
is_selected = models.BooleanField(verbose_name=_("Is selected"))
justification = models.TextField(verbose_name=_("Justification"))

Expand Down

0 comments on commit ac15c3a

Please sign in to comment.