diff options
Diffstat (limited to 'carer')
| -rw-r--r-- | carer/README.md | 20 | ||||
| -rw-r--r-- | carer/__init__.py | 0 | ||||
| -rw-r--r-- | carer/app/__init__.py | 0 | ||||
| -rw-r--r-- | carer/app/manage.py | 9 | ||||
| -rw-r--r-- | carer/app/settings.py | 24 | ||||
| -rw-r--r-- | carer/apps.py | 9 | ||||
| -rw-r--r-- | carer/mtwerk/__init__.py | 0 | ||||
| -rw-r--r-- | carer/mtwerk/migrations/0001_initial.py | 157 | ||||
| -rw-r--r-- | carer/mtwerk/migrations/__init__.py | 0 | ||||
| -rw-r--r-- | carer/mtwerk/models.py | 130 | ||||
| -rw-r--r-- | carer/requirements.txt | 4 |
11 files changed, 0 insertions, 353 deletions
diff --git a/carer/README.md b/carer/README.md deleted file mode 100644 index e5f9123..0000000 --- a/carer/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# amt-jb - -This refers to the Django carer that handles DB models - -## Environment - -- amt-jb-carer: (amt-jb-carer-venv) Python 3.13.7 - - -```shell - -python3.13 -m venv /root/amt-jb-carer-venv -source /root/amt-jb-carer-venv/bin/activate -pip install -U pip setuptools wheel -cd ~/amt-jb/carer/ -pip install -r requirements.txt - -python3 manage.py makemigrations mtwerk --settings=carer.settings.production -python3 manage.py migrate mtwerk --settings=carer.settings.production -```
\ No newline at end of file diff --git a/carer/__init__.py b/carer/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/carer/__init__.py +++ /dev/null diff --git a/carer/app/__init__.py b/carer/app/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/carer/app/__init__.py +++ /dev/null diff --git a/carer/app/manage.py b/carer/app/manage.py deleted file mode 100644 index 9ae482e..0000000 --- a/carer/app/manage.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "carer.app.settings") - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/carer/app/settings.py b/carer/app/settings.py deleted file mode 100644 index 55dd93b..0000000 --- a/carer/app/settings.py +++ /dev/null @@ -1,24 +0,0 @@ -import os - -INSTALLED_APPS = [ - "django.contrib.postgres", - "django.contrib.contenttypes", - "carer.mtwerk", -] - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.postgresql", - "NAME": os.environ.get("DB_NAME", "thl-test"), - "USER": os.environ.get("DB_USER", "postgres"), - "PASSWORD": os.environ.get("DB_PASSWORD", "password"), - "HOST": os.environ.get("DB_HOST", "127.0.0.1"), - "PORT": "5432", - } -} -DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" -LANGUAGE_CODE = "en-us" -TIME_ZONE = "UTC" -USE_I18N = True -USE_L10N = True -USE_TZ = True diff --git a/carer/apps.py b/carer/apps.py deleted file mode 100644 index c96687b..0000000 --- a/carer/apps.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.apps import AppConfig - - -class MTwerkSchemaConfig(AppConfig): - name = "carer.mtwerk" - label = "mtwerk" - - def ready(self): - from .mtwerk import models # pycharm: keep diff --git a/carer/mtwerk/__init__.py b/carer/mtwerk/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/carer/mtwerk/__init__.py +++ /dev/null diff --git a/carer/mtwerk/migrations/0001_initial.py b/carer/mtwerk/migrations/0001_initial.py deleted file mode 100644 index d5c856a..0000000 --- a/carer/mtwerk/migrations/0001_initial.py +++ /dev/null @@ -1,157 +0,0 @@ -# Generated by Django 5.2.7 on 2025-10-28 22:06 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Hit', - fields=[ - ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('amt_hit_id', models.CharField(max_length=30, unique=True)), - ('amt_group_id', models.CharField(max_length=30)), - ('status', models.SmallIntegerField()), - ('review_status', models.SmallIntegerField()), - ('creation_time', models.DateTimeField()), - ('expiration', models.DateTimeField()), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('modified_at', models.DateTimeField(auto_now=True)), - ('max_assignments', models.IntegerField(default=1)), - ('assignment_pending_count', models.IntegerField(default=0)), - ('assignment_available_count', models.IntegerField(default=0)), - ('assignment_completed_count', models.IntegerField(default=0)), - ], - options={ - 'db_table': 'mtwerk_hit', - }, - ), - migrations.CreateModel( - name='Assignment', - fields=[ - ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('amt_assignment_id', models.CharField(max_length=30, unique=True)), - ('amt_worker_id', models.CharField(max_length=30)), - ('status', models.SmallIntegerField()), - ('auto_approval_time', models.DateTimeField(null=True)), - ('accept_time', models.DateTimeField(null=True)), - ('submit_time', models.DateTimeField(null=True)), - ('approval_time', models.DateTimeField(null=True)), - ('rejection_time', models.DateTimeField(null=True)), - ('requester_feedback', models.CharField(max_length=1024, null=True)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('modified_at', models.DateTimeField(auto_now=True)), - ('tsid', models.UUIDField(null=True)), - ('hit', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mtwerk.hit')), - ], - options={ - 'db_table': 'mtwerk_assignment', - }, - ), - migrations.CreateModel( - name='HitType', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('amt_hit_type_id', models.CharField(max_length=30, unique=True)), - ('title', models.CharField(max_length=200)), - ('description', models.CharField(max_length=2000)), - ('reward', models.DecimalField(decimal_places=2, max_digits=8)), - ('assignment_duration', models.PositiveIntegerField()), - ('auto_approval_delay', models.PositiveIntegerField()), - ('keywords', models.CharField(max_length=256)), - ('min_active', models.IntegerField(default=0)), - ], - options={ - 'db_table': 'mtwerk_hittype', - 'indexes': [models.Index(fields=['amt_hit_type_id'], name='mtwerk_hitt_amt_hit_05dd10_idx'), models.Index(fields=['min_active'], name='mtwerk_hitt_min_act_e18222_idx')], - }, - ), - migrations.AddField( - model_name='hit', - name='hit_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mtwerk.hittype'), - ), - migrations.CreateModel( - name='Question', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('url', models.URLField()), - ('height', models.IntegerField(default=1200)), - ], - options={ - 'db_table': 'mtwerk_question', - 'unique_together': {('url', 'height')}, - }, - ), - migrations.AddField( - model_name='hit', - name='question', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mtwerk.question'), - ), - migrations.CreateModel( - name='Bonus', - fields=[ - ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('payout_event_id', models.UUIDField(unique=True)), - ('amt_worker_id', models.CharField(max_length=30, null=True)), - ('amount', models.DecimalField(decimal_places=2, max_digits=10)), - ('grant_time', models.DateTimeField()), - ('reason', models.CharField(max_length=1024)), - ('assignment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mtwerk.assignment')), - ], - options={ - 'indexes': [models.Index(fields=['amt_worker_id'], name='mtwerk_bonu_amt_wor_77d514_idx'), models.Index(fields=['grant_time'], name='mtwerk_bonu_grant_t_d43c6c_idx')], - }, - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['amt_worker_id'], name='mtwerk_assi_amt_wor_7dbe42_idx'), - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['status'], name='mtwerk_assi_status_4e01de_idx'), - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['submit_time'], name='mtwerk_assi_submit__429d3e_idx'), - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['created_at'], name='mtwerk_assi_created_9292fa_idx'), - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['modified_at'], name='mtwerk_assi_modifie_44f1d0_idx'), - ), - migrations.AddIndex( - model_name='assignment', - index=models.Index(fields=['tsid'], name='mtwerk_assi_tsid_bd796d_idx'), - ), - migrations.AddIndex( - model_name='hit', - index=models.Index(fields=['status'], name='mtwerk_hit_status_ae726f_idx'), - ), - migrations.AddIndex( - model_name='hit', - index=models.Index(fields=['review_status'], name='mtwerk_hit_review__a9f420_idx'), - ), - migrations.AddIndex( - model_name='hit', - index=models.Index(fields=['creation_time'], name='mtwerk_hit_creatio_48e0fd_idx'), - ), - migrations.AddIndex( - model_name='hit', - index=models.Index(fields=['created_at'], name='mtwerk_hit_created_f1614b_idx'), - ), - migrations.AddIndex( - model_name='hit', - index=models.Index(fields=['modified_at'], name='mtwerk_hit_modifie_45c2ed_idx'), - ), - ] diff --git a/carer/mtwerk/migrations/__init__.py b/carer/mtwerk/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/carer/mtwerk/migrations/__init__.py +++ /dev/null diff --git a/carer/mtwerk/models.py b/carer/mtwerk/models.py deleted file mode 100644 index 5cb026d..0000000 --- a/carer/mtwerk/models.py +++ /dev/null @@ -1,130 +0,0 @@ -from django.db import models - - -class Question(models.Model): - """The iFrame location and details for a HIT""" - - id = models.AutoField(primary_key=True) - - url = models.URLField(max_length=200) - height = models.IntegerField(default=1200) - - class Meta: - db_table = "mtwerk_question" - unique_together = ["url", "height"] - - -class HitType(models.Model): - id = models.AutoField(primary_key=True) - amt_hit_type_id = models.CharField(max_length=30, unique=True) - - title = models.CharField(max_length=200) - description = models.CharField(max_length=2000) - reward = models.DecimalField(decimal_places=2, max_digits=8) - assignment_duration = models.PositiveIntegerField() - auto_approval_delay = models.PositiveIntegerField() - keywords = models.CharField(max_length=256) - - # If set, don't let the active HIT count drop below this amount - min_active = models.IntegerField(null=False, default=0) - - class Meta: - db_table = "mtwerk_hittype" - indexes = [ - models.Index(fields=["amt_hit_type_id"]), - models.Index(fields=["min_active"]), - ] - - -class Hit(models.Model): - id = models.BigAutoField(primary_key=True) - amt_hit_id = models.CharField(max_length=30, unique=True) - - hit_type = models.ForeignKey(HitType, on_delete=models.PROTECT) - - amt_group_id = models.CharField(max_length=30) - - status = models.SmallIntegerField(null=False) - review_status = models.SmallIntegerField(null=False) - creation_time = models.DateTimeField(null=False) - expiration = models.DateTimeField(null=False) - - question = models.ForeignKey(Question, on_delete=models.PROTECT) - created_at = models.DateTimeField(null=False, auto_now_add=True) - modified_at = models.DateTimeField(null=False, auto_now=True) - - max_assignments = models.IntegerField(null=False, default=1) - assignment_pending_count = models.IntegerField(null=False, default=0) - assignment_available_count = models.IntegerField(null=False, default=0) - assignment_completed_count = models.IntegerField(null=False, default=0) - - class Meta: - db_table = "mtwerk_hit" - indexes = [ - models.Index(fields=["status"]), - models.Index(fields=["review_status"]), - models.Index(fields=["creation_time"]), - models.Index(fields=["created_at"]), - models.Index(fields=["modified_at"]), - ] - - -class Assignment(models.Model): - id = models.BigAutoField(primary_key=True) - amt_assignment_id = models.CharField(max_length=30, unique=True) - - amt_worker_id = models.CharField(max_length=30, null=False) - - hit = models.ForeignKey(Hit, on_delete=models.PROTECT) - - status = models.SmallIntegerField(null=False) - - auto_approval_time = models.DateTimeField(null=True) - accept_time = models.DateTimeField(null=True) - submit_time = models.DateTimeField(null=True) - approval_time = models.DateTimeField(null=True) - rejection_time = models.DateTimeField(null=True) - - # Don't need this - # answer = models.CharField - - requester_feedback = models.CharField(null=True, max_length=1024) - - # Internal tracking - created_at = models.DateTimeField(null=False, auto_now_add=True) - modified_at = models.DateTimeField(null=False, auto_now=True) - tsid = models.UUIDField(null=True) - - class Meta: - db_table = "mtwerk_assignment" - indexes = [ - models.Index(fields=["amt_worker_id"]), - models.Index(fields=["status"]), - models.Index(fields=["submit_time"]), - models.Index(fields=["created_at"]), - models.Index(fields=["modified_at"]), - models.Index(fields=["tsid"]), - ] - - -class Bonus(models.Model): - """Issued bonuses to workers for supplemental payments""" - - id = models.BigAutoField(primary_key=True) - payout_event_id = models.UUIDField(null=False, unique=True) - - amt_worker_id = models.CharField(max_length=30, null=True) - - # Not unique=True because maybe multiple Bonuses will be associated - # with a single Assignment - assignment = models.ForeignKey(Assignment, null=False, on_delete=models.PROTECT) - - amount = models.DecimalField(max_digits=10, decimal_places=2) - grant_time = models.DateTimeField(null=False) - reason = models.CharField(max_length=1024) - - class Meta: - indexes = [ - models.Index(fields=["amt_worker_id"]), - models.Index(fields=["grant_time"]), - ] diff --git a/carer/requirements.txt b/carer/requirements.txt deleted file mode 100644 index f4f866e..0000000 --- a/carer/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -asgiref==3.10.0 -Django==5.2.7 -psycopg==3.2.10 -sqlparse==0.5.3 |
