Fakultas Ilmu Komputer UI

models.py 5.23 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from django.db import models
from django.contrib.postgres.fields import ArrayField
from multiselectfield import MultiSelectField
from authentication.models import CustomUser
from constants.model_choices import (
    YesNoChoices,
    GeneralPurpose,
    Profession,
    LastEducation,
    MealPreference,
    DietaryChange,
    BreakfastFrequency,
    BreakfastMealType,
    BeverageConsumptionFrequency,
    AdditionalSpoonOfSugarConsumed,
    LiquidConsumptionFrequency,
    MealProvider,
    CigaretteAlcoholCondition,
    Disease,
    Complaint,
)


class DietQuestionnaire(models.Model):
    user = models.OneToOneField(
        CustomUser,
        on_delete=models.CASCADE,
        primary_key=False,
        related_name="diet_questionnaire",
        null=False,
        blank=True
    )
    agree_to_all_statements_consent = models.IntegerField(
        choices = YesNoChoices.choices, null=True, blank=True
    )
    personal_data_consent = models.IntegerField(
        choices = YesNoChoices.choices, null=True, blank=True
    )
    general_purpose = models.IntegerField(
        choices = GeneralPurpose.choices, null=True, blank=True
    )
    date_of_birth = models.DateField(null=True, blank=True)
    city_and_area_of_residence = models.CharField(max_length=200, null=True, blank=True)
    handphone_no = models.CharField(max_length=50, null=True, blank=True)
    whatsapp_no = models.CharField(max_length=50, null=True, blank=True)
    profession = models.IntegerField(
        choices = Profession.choices, null=True, blank=True
    )
    last_education = models.IntegerField(
        choices = LastEducation.choices, null=True, blank=True
    )
    meal_preference = models.IntegerField(
        choices = MealPreference.choices, null=True, blank=True
    )
    waist_size = models.PositiveIntegerField(null=True, blank=True)
    dietary_change = models.IntegerField(
        choices = DietaryChange.choices, null=True, blank=True
    )
    has_weigher = models.IntegerField(
        choices = YesNoChoices.choices, null=True, blank=True
    )
    breakfast_frequency = models.IntegerField(
        choices = BreakfastFrequency.choices, null=True, blank=True
    )
    breakfast_meal_type = models.IntegerField(
        choices = BreakfastMealType.choices, null=True, blank=True
    )
    sweet_tea_consumption_frequency = models.IntegerField(
        choices = BeverageConsumptionFrequency.choices, null=True, blank=True
    )
    coffee_consumption_frequency = models.IntegerField(
        choices = BeverageConsumptionFrequency.choices, null=True, blank=True
    )
    milk_consumption_frequency = models.IntegerField(
        choices = BeverageConsumptionFrequency.choices, null=True, blank=True
    )
    other_drink_consumption_frequency = models.IntegerField(
        choices = BeverageConsumptionFrequency.choices, null=True, blank=True
    )
    additional_sugar_in_a_day = models.IntegerField(
        choices = AdditionalSpoonOfSugarConsumed.choices, null=True, blank=True
    )
    liquid_consumption_frequency = models.IntegerField(
        choices = LiquidConsumptionFrequency.choices, null=True, blank=True
    )
    meal_consumed_almost_every_day = models.CharField(max_length=200, null=True, blank=True)
    unliked_food = models.CharField(max_length=200, null=True, blank=True)
    preferred_food_taste = models.CharField(max_length=200, null=True, blank=True)
    expected_food_on_breakfast = models.CharField(max_length=200, null=True, blank=True)
    expected_food_on_lunch_dinner = models.CharField(max_length=200, null=True, blank=True)
    breakfast_meal_explanation = models.TextField(null=True, blank=True)
    morning_snack_explanation = models.TextField(null=True, blank=True)
    lunch_meal_explanation = models.TextField(null=True, blank=True)
    evening_snack_explanation = models.TextField(null=True, blank=True)
    dinner_meal_explanation = models.TextField(null=True, blank=True)
    night_snack_explanation = models.TextField(null=True, blank=True)
    food_alergies = models.CharField(max_length=200, null=True, blank=True)
    diet_drinks = models.CharField(max_length=200, null=True, blank=True)
    meal_provider = MultiSelectField(
        choices = MealProvider.choices, null=True, blank=True
    )
    cigarette_alcohol_condition = MultiSelectField(
        choices = CigaretteAlcoholCondition.choices, null=True, blank=True
    )
    multivitamin_tablet_suplement = models.CharField(max_length=200, null=True, blank=True)
    physical_activity = ArrayField(models.CharField(max_length=200), null=True, blank=True)
    diet_and_life_style_story = models.TextField(null=True, blank=True)
    disease = MultiSelectField(
        choices = Disease.choices, null=True, blank=True
    )
    complaint = MultiSelectField(
        choices = Complaint.choices, null=True, blank=True
    )
    regular_drug_consumption = models.TextField(null=True, blank=True)
    other_disease = models.TextField(null=True, blank=True)
    motivation_using_dietela = models.TextField(null=True, blank=True)
    dietela_nutritionist_expectation = models.TextField(null=True, blank=True)
    dietela_program_expectation = models.TextField(null=True, blank=True)
    finished_steps = ArrayField(models.PositiveIntegerField(), null=True, blank=True, default=list)
120
121
122

    def __str__(self):
        return str(self.user)