forked from ohcnetwork/care
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Tracking and Storing of Plausible Statistics (ohcnetwork#1580)
* Track and store plausible stats * Remove immediate run * Update migrations * Update request * Format * Update celery.json * rebase migration --------- Co-authored-by: Vignesh Hari <[email protected]> Co-authored-by: Aakash Singh <[email protected]>
- Loading branch information
1 parent
07c045c
commit 2829067
Showing
7 changed files
with
416 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
care/facility/migrations/0388_goal_goalentry_goalproperty_goalpropertyentry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
# Generated by Django 4.2.2 on 2023-09-06 08:36 | ||
|
||
import uuid | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("facility", "0387_merge_20230911_2303"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Goal", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_date", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"modified_date", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
("name", models.CharField(max_length=200)), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="GoalEntry", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_date", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"modified_date", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
("date", models.DateField()), | ||
("visitors", models.IntegerField(null=True)), | ||
("events", models.IntegerField(null=True)), | ||
( | ||
"goal", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="entries", | ||
to="facility.goal", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="GoalProperty", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_date", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"modified_date", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
("name", models.CharField(max_length=200)), | ||
( | ||
"goal", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="properties", | ||
to="facility.goal", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="GoalPropertyEntry", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_date", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"modified_date", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
("value", models.CharField(max_length=200)), | ||
("visitors", models.IntegerField(null=True)), | ||
("events", models.IntegerField(null=True)), | ||
( | ||
"goal_entry", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="properties", | ||
to="facility.goalentry", | ||
), | ||
), | ||
( | ||
"goal_property", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="entries", | ||
to="facility.goalproperty", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.db import models | ||
|
||
from care.utils.models.base import BaseModel | ||
|
||
|
||
class Goal(BaseModel): | ||
name = models.CharField(max_length=200) | ||
|
||
|
||
class GoalEntry(BaseModel): | ||
goal = models.ForeignKey( | ||
Goal, | ||
on_delete=models.PROTECT, | ||
related_name="entries", | ||
) | ||
date = models.DateField() | ||
visitors = models.IntegerField(null=True) | ||
events = models.IntegerField(null=True) | ||
|
||
|
||
class GoalProperty(BaseModel): | ||
name = models.CharField(max_length=200) | ||
goal = models.ForeignKey( | ||
Goal, | ||
on_delete=models.CASCADE, | ||
related_name="properties", | ||
) | ||
|
||
|
||
class GoalPropertyEntry(BaseModel): | ||
goal_entry = models.ForeignKey( | ||
GoalEntry, | ||
on_delete=models.PROTECT, | ||
related_name="properties", | ||
) | ||
goal_property = models.ForeignKey( | ||
GoalProperty, | ||
on_delete=models.PROTECT, | ||
related_name="entries", | ||
) | ||
value = models.CharField(max_length=200) | ||
visitors = models.IntegerField(null=True) | ||
events = models.IntegerField(null=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.