diff --git a/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.pdf b/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.pdf deleted file mode 100644 index 3f304b1..0000000 Binary files a/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.pdf and /dev/null differ diff --git a/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.tar.gz b/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.tar.gz deleted file mode 100644 index 21168e7..0000000 Binary files a/dossier/MSPR_TPRE501_AIT_ABDELKARIM_LELU_LEJOLIVET_LASBLEI.tar.gz and /dev/null differ diff --git a/dossier/uml.md b/dossier/uml.md index c28310e..e66944e 100644 --- a/dossier/uml.md +++ b/dossier/uml.md @@ -17,3 +17,8 @@ UML === # Entity Relations + +UML +=== +# Architecture + diff --git a/dossier/uml/ERD.md b/dossier/uml/ERD.md index 72f8bc8..b2ede2e 100644 --- a/dossier/uml/ERD.md +++ b/dossier/uml/ERD.md @@ -4,17 +4,22 @@ config: layout: elk --- erDiagram - User ||--o{ Objectif: objectif - User |o--o{ Plan: abonnement - User |o--o{ RegimeAlimentaire: regime - User }o--o{ Allergie: allergies - User }o--o{ Exercice: exercices - Aliment }o--|| Allergie: alergène - Aliment }o--|{ Recette: ingredients - Recette }|--|{ RegimeAlimentaire: regime - Exercice }|--|{ Equipement: équipement - Exercice }|--|{ BodyPart: partieCorps - Exercice }|--|{ Muscle: muscle + UserProfile ||--o{ Objective: objective + UserProfile |o--o{ Subscription: subscription + UserProfile |o--o{ Diet: diet + UserProfile }o--o{ Ingredient: allergies + UserProfile ||--|| User: user + + Ingredient |o--o{ Diet: diet + Recipe }|--o{ Ingredient: ingredients + ExercisePlan }|--o{ Exercise: exercises + ExercisePlan ||--o{ User: user + MealPlan }|--o{ Recipe: meals + MealPlan ||--o{ User: user + Exercise |o--o{ Equipement: equipements + Exercise |o--o{ BodyPart: bodyparts + Exercise |o--o{ Muscle: muscles + User{ int id bool is_superuser @@ -37,7 +42,7 @@ erDiagram integer height string picture } - Objectif { + Objective{ int id string name string description @@ -62,36 +67,44 @@ erDiagram int sugars int salt } - Recette { - int Id - string Nom - int MinutesPreparation - int MinutesCuisson - string Resume - string Recette - string ImageUrl + Recipe{ + int id + string name + int minute_preparation + int minute_preparation + string summary + string steps + string picture } - Regime { - int Id - string Nom - string Description + MealPlan { + int id + datetime created_date } - Exercice { - int Id - string Nom - string GifUrl - string Instructions + Diet { + int id + string name + string description + } + Exercise { + int id + string name + string image + string instructions } Equipement { - int Id - string Nom + int id + string name } BodyPart { - int Id - string Nom + int id + string name } Muscle { - int Id - string Nom + int id + string name + } + ExercisePlan { + int id + datetime created_date } ``` diff --git a/dossier/uml/architecture.md b/dossier/uml/architecture.md new file mode 100644 index 0000000..765c09e --- /dev/null +++ b/dossier/uml/architecture.md @@ -0,0 +1,27 @@ +```mermaid +render +architecture-beta + group back(Server)[HealhAI Back] + group api(cloud)[API] in back + group etl(cloud)[ETL] in back + group datavis(cloud)[Data visualisation] in back + + service db(database)[Database] in api + service gunicorn(server)[gunicorn] in api + service grafana(cloud)[Grafana] in datavis + service django-admin(cloud)[Django Admin] in datavis + service redis(database)[Redis] in etl + service parser(server)[Parser] in etl + + junction parserJunction in etl + junction redisJunction in etl + + gunicorn:L -- R:db + parser:B -- T:redis + parser:R --> L:parserJunction + redis:R <-- L:redisJunction + parserJunction:B -- T:redisJunction + + grafana:T <-- B:db + django-admin:T -- B:gunicorn + gunicorn:T -- B:redisJunction +``` diff --git a/flake.nix b/flake.nix index 92343b9..7c85249 100644 --- a/flake.nix +++ b/flake.nix @@ -78,6 +78,7 @@ presenterm yaml-language-server mermaid-cli + pythonSet.python.pkgs.weasyprint ]; }; default = pkgs.mkShellNoCC { diff --git a/src/healthai/api/models.py b/src/healthai/api/models.py index 5dec873..e770e40 100644 --- a/src/healthai/api/models.py +++ b/src/healthai/api/models.py @@ -11,6 +11,7 @@ class UserProfile(models.Model): weight = models.IntegerField() # in g height = models.IntegerField() # in cm picture = models.ImageField(upload_to="profiles") + allergies = models.ManyToManyField("Ingredient", related_name="users") diet = models.ForeignKey( "Diet", on_delete=models.SET_NULL, null=True, blank=True, related_name="users" @@ -27,7 +28,7 @@ class UserProfile(models.Model): # with the date of plan generation. -class Objectif(models.Model): +class Objective(models.Model): name = models.CharField(max_length=200) description = models.TextField() image_url = models.ImageField("objectives") @@ -68,19 +69,27 @@ class Ingredient(models.Model): class Recipe(models.Model): - nom = models.CharField(max_length=300) + name = models.CharField(max_length=300) minutes_preparation = models.IntegerField() minutes_cuisson = models.IntegerField() summary = models.TextField() steps = models.TextField() picture = models.ImageField("recipes") + ingredients = models.ManyToManyField(Ingredient, related_name="ingredients") class ExercisePlan(models.Model): created_date = models.DateTimeField(default=datetime.now, editable=False) exercises = models.ManyToManyField("Exercise", related_name="plans") user = models.ForeignKey( - UserProfile, related_name="plans", on_delete=models.CASCADE + UserProfile, related_name="exercise_plans", on_delete=models.CASCADE + ) + +class MealPlan(models.Model): + created_date = models.DateTimeField(default=datetime.now, editable=False) + meals = models.ManyToManyField("Recipe", related_name="plans") + user = models.ForeignKey( + UserProfile, related_name="meal_plans", on_delete=models.CASCADE )