From e9dc18d65801c306fa7deab299025bc7faf3fb15 Mon Sep 17 00:00:00 2001 From: Domenico Date: Fri, 4 Oct 2024 18:54:58 +0200 Subject: [PATCH] add vision app (#4274) * contrib refactoring * contrib refactoring --------- Co-authored-by: Pavlo Mokiichuk --- .gitignore | 4 + .../apps/core/management/commands/initdemo.py | 9 +- src/hct_mis_api/apps/core/tasks_schedules.py | 4 +- src/hct_mis_api/apps/household/models.py | 4 +- src/hct_mis_api/apps/program/apps.py | 1 + src/hct_mis_api/config/settings.py | 3 +- .../{aurora => contrib}/__init__.py | 0 .../migrations => contrib/aurora}/__init__.py | 0 src/hct_mis_api/{ => contrib}/aurora/admin.py | 12 +-- src/hct_mis_api/{ => contrib}/aurora/api.py | 2 +- src/hct_mis_api/{ => contrib}/aurora/apps.py | 12 +-- .../{ => contrib}/aurora/celery_tasks.py | 4 +- .../{ => contrib}/aurora/fixtures.py | 2 +- .../{ => contrib}/aurora/fixtures/data.json | 0 src/hct_mis_api/{ => contrib}/aurora/forms.py | 2 +- .../aurora/migrations/0001_migration.py | 0 .../aurora/migrations/0002_migration.py | 0 .../aurora/migrations}/__init__.py | 0 .../{ => contrib}/aurora/models.py | 2 +- src/hct_mis_api/{ => contrib}/aurora/rdi.py | 0 .../contrib/aurora/services/__init__.py | 0 .../base_flex_registration_service.py | 6 +- ...zech_republic_flex_registration_service.py | 2 +- .../aurora/services/extract_record.py | 2 +- .../services/flex_registration_service.py | 0 .../services/generic_registration_service.py | 2 +- .../sri_lanka_flex_registration_service.py | 2 +- .../ukraine_flex_registration_service.py | 2 +- .../aurora/static/aurora/datatable.js | 0 .../aurora/static/aurora/datatable.scss | 0 .../templates/admin/aurora/app_index.html | 0 .../templates/admin/aurora/record/fetch.html | 0 .../admin/aurora/registration/analyze.html | 0 .../aurora/templates/dataset_list.html | 0 src/hct_mis_api/{ => contrib}/aurora/urls.py | 2 +- src/hct_mis_api/{ => contrib}/aurora/utils.py | 7 +- src/hct_mis_api/{ => contrib}/aurora/views.py | 4 +- src/hct_mis_api/contrib/vision/__init__.py | 0 src/hct_mis_api/contrib/vision/admin.py | 30 ++++++ src/hct_mis_api/contrib/vision/apps.py | 6 ++ src/hct_mis_api/contrib/vision/fixtures.py | 25 +++++ .../vision/migrations/0001_migration.py | 79 ++++++++++++++++ .../contrib/vision/migrations/__init__.py | 0 src/hct_mis_api/contrib/vision/models.py | 94 +++++++++++++++++++ src/hct_mis_api/urls.py | 2 +- tests/unit/apps/account/test_admin.py | 53 ++++++----- .../registration_datahub/test_celery_tasks.py | 18 ++-- .../test_clean_old_record_files_task.py | 4 +- ...est_czech_republic_registration_service.py | 6 +- .../test_extract_records.py | 4 +- .../test_generic_registration_service.py | 6 +- .../test_sri_lanka_registration_service.py | 6 +- .../test_ukrainian_registration_service.py | 6 +- 53 files changed, 336 insertions(+), 93 deletions(-) rename src/hct_mis_api/{aurora => contrib}/__init__.py (100%) rename src/hct_mis_api/{aurora/migrations => contrib/aurora}/__init__.py (100%) rename src/hct_mis_api/{ => contrib}/aurora/admin.py (97%) rename src/hct_mis_api/{ => contrib}/aurora/api.py (98%) rename src/hct_mis_api/{ => contrib}/aurora/apps.py (60%) rename src/hct_mis_api/{ => contrib}/aurora/celery_tasks.py (97%) rename src/hct_mis_api/{ => contrib}/aurora/fixtures.py (95%) rename src/hct_mis_api/{ => contrib}/aurora/fixtures/data.json (100%) rename src/hct_mis_api/{ => contrib}/aurora/forms.py (92%) rename src/hct_mis_api/{ => contrib}/aurora/migrations/0001_migration.py (100%) rename src/hct_mis_api/{ => contrib}/aurora/migrations/0002_migration.py (100%) rename src/hct_mis_api/{aurora/services => contrib/aurora/migrations}/__init__.py (100%) rename src/hct_mis_api/{ => contrib}/aurora/models.py (98%) rename src/hct_mis_api/{ => contrib}/aurora/rdi.py (100%) create mode 100644 src/hct_mis_api/contrib/aurora/services/__init__.py rename src/hct_mis_api/{ => contrib}/aurora/services/base_flex_registration_service.py (97%) rename src/hct_mis_api/{ => contrib}/aurora/services/czech_republic_flex_registration_service.py (99%) rename src/hct_mis_api/{ => contrib}/aurora/services/extract_record.py (98%) rename src/hct_mis_api/{ => contrib}/aurora/services/flex_registration_service.py (100%) rename src/hct_mis_api/{ => contrib}/aurora/services/generic_registration_service.py (99%) rename src/hct_mis_api/{ => contrib}/aurora/services/sri_lanka_flex_registration_service.py (99%) rename src/hct_mis_api/{ => contrib}/aurora/services/ukraine_flex_registration_service.py (99%) rename src/hct_mis_api/{ => contrib}/aurora/static/aurora/datatable.js (100%) rename src/hct_mis_api/{ => contrib}/aurora/static/aurora/datatable.scss (100%) rename src/hct_mis_api/{ => contrib}/aurora/templates/admin/aurora/app_index.html (100%) rename src/hct_mis_api/{ => contrib}/aurora/templates/admin/aurora/record/fetch.html (100%) rename src/hct_mis_api/{ => contrib}/aurora/templates/admin/aurora/registration/analyze.html (100%) rename src/hct_mis_api/{ => contrib}/aurora/templates/dataset_list.html (100%) rename src/hct_mis_api/{ => contrib}/aurora/urls.py (70%) rename src/hct_mis_api/{ => contrib}/aurora/utils.py (96%) rename src/hct_mis_api/{ => contrib}/aurora/views.py (95%) create mode 100644 src/hct_mis_api/contrib/vision/__init__.py create mode 100644 src/hct_mis_api/contrib/vision/admin.py create mode 100644 src/hct_mis_api/contrib/vision/apps.py create mode 100644 src/hct_mis_api/contrib/vision/fixtures.py create mode 100644 src/hct_mis_api/contrib/vision/migrations/0001_migration.py create mode 100644 src/hct_mis_api/contrib/vision/migrations/__init__.py create mode 100644 src/hct_mis_api/contrib/vision/models.py diff --git a/.gitignore b/.gitignore index b2df655629..691473bbb2 100644 --- a/.gitignore +++ b/.gitignore @@ -133,4 +133,8 @@ cov.json .vscode/ output_data/ .coverage + +archive/ +output.json +pytest_html_report.html compose.dist.yml diff --git a/src/hct_mis_api/apps/core/management/commands/initdemo.py b/src/hct_mis_api/apps/core/management/commands/initdemo.py index 6d72be2bf0..4dc6a92d53 100644 --- a/src/hct_mis_api/apps/core/management/commands/initdemo.py +++ b/src/hct_mis_api/apps/core/management/commands/initdemo.py @@ -65,7 +65,7 @@ def handle(self, *args: Any, **options: Any) -> None: call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/household/fixtures/data.json") call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/accountability/fixtures/data.json") call_command("loaddata", f"{settings.PROJECT_ROOT}/apps/steficon/fixtures/data.json") - call_command("loaddata", f"{settings.PROJECT_ROOT}/aurora/fixtures/data.json") + call_command("loaddata", f"{settings.PROJECT_ROOT}/contrib/aurora/fixtures/data.json") try: call_command("search_index", "--rebuild", "-f") @@ -86,14 +86,9 @@ def handle(self, *args: Any, **options: Any) -> None: "jan.romaniak@kellton.com", "jakub.krasnowski@kellton.com", "pavlo.mokiichuk@kellton.com", - "kamil.swiechowski@kellton.com", - "karolina.sliwinska@kellton.com", "katarzyna.lanecka@kellton.com", - "konrad.marzec@kellton.com", "maciej.szewczyk@kellton.com", "marek.biczysko@kellton.com", - "patryk.dabrowski@kellton.com", - "zuzanna.okrutna@kellton.com", "gerba@unicef.org", "ddinicola@unicef.org", "sapostolico@unicef.org", @@ -103,10 +98,8 @@ def handle(self, *args: Any, **options: Any) -> None: "asrugano@unicef.org", "gkeriri@unicef.org", "jbassette@unicef.org", - "jyablonski@unicef.org", "nmkuzi@unicef.org", "dhassooneh@unicef.org", - "swaheed@unicef.org", ] tester_list = [ "khaddad@unicef.org", diff --git a/src/hct_mis_api/apps/core/tasks_schedules.py b/src/hct_mis_api/apps/core/tasks_schedules.py index 3a819d914e..5e737ff684 100644 --- a/src/hct_mis_api/apps/core/tasks_schedules.py +++ b/src/hct_mis_api/apps/core/tasks_schedules.py @@ -30,7 +30,7 @@ # "schedule": crontab(hour="*/24"), # }, "extract_records_task": { - "task": "hct_mis_api.aurora.celery_tasks.extract_records_task", + "task": "hct_mis_api.contrib.aurora.celery_tasks.extract_records_task", "schedule": crontab(hour="*/24"), }, "remove_old_cash_plan_payment_verification_xls": { @@ -42,7 +42,7 @@ "schedule": crontab(minute="*/15"), }, "clean_old_record_files_task": { - "task": "hct_mis_api.aurora.celery_tasks.clean_old_record_files_task", + "task": "hct_mis_api.contrib.aurora.celery_tasks.clean_old_record_files_task", "schedule": crontab(month_of_year="2-12/2"), }, "periodic_sync_payment_gateway_fsp": { diff --git a/src/hct_mis_api/apps/household/models.py b/src/hct_mis_api/apps/household/models.py index 202fcaa529..052e5499ef 100644 --- a/src/hct_mis_api/apps/household/models.py +++ b/src/hct_mis_api/apps/household/models.py @@ -53,7 +53,7 @@ ) if TYPE_CHECKING: - from hct_mis_api.aurora.models import Record + from hct_mis_api.contrib.aurora.models import Record BLANK = "" IDP = "IDP" @@ -658,7 +658,7 @@ def alternate_collector(self) -> Optional["Individual"]: @property def flex_registrations_record(self) -> Optional["Record"]: - from hct_mis_api.aurora.models import Record + from hct_mis_api.contrib.aurora.models import Record return Record.objects.filter(id=self.flex_registrations_record_id).first() diff --git a/src/hct_mis_api/apps/program/apps.py b/src/hct_mis_api/apps/program/apps.py index 42fa42f6a0..b6bb76699d 100644 --- a/src/hct_mis_api/apps/program/apps.py +++ b/src/hct_mis_api/apps/program/apps.py @@ -3,6 +3,7 @@ class ProgramConfig(AppConfig): name = "hct_mis_api.apps.program" + verbose_name = "Programme" def ready(self) -> None: from hct_mis_api.apps.grievance import signals as grievance_signals diff --git a/src/hct_mis_api/config/settings.py b/src/hct_mis_api/config/settings.py index 8558b88c54..435bc933d0 100644 --- a/src/hct_mis_api/config/settings.py +++ b/src/hct_mis_api/config/settings.py @@ -233,10 +233,11 @@ "hct_mis_api.apps.steficon.apps.SteficonConfig", "hct_mis_api.apps.reporting.apps.ReportingConfig", "hct_mis_api.apps.activity_log.apps.ActivityLogConfig", - "hct_mis_api.aurora.apps.Config", "hct_mis_api.apps.accountability.apps.AccountabilityConfig", "hct_mis_api.apps.web.apps.WebConfig", "hct_mis_api.apps.periodic_data_update.apps.PeriodicDataUpdateConfig", + "hct_mis_api.contrib.aurora.apps.Config", + "hct_mis_api.contrib.vision.apps.Config", ] DJANGO_APPS = [ diff --git a/src/hct_mis_api/aurora/__init__.py b/src/hct_mis_api/contrib/__init__.py similarity index 100% rename from src/hct_mis_api/aurora/__init__.py rename to src/hct_mis_api/contrib/__init__.py diff --git a/src/hct_mis_api/aurora/migrations/__init__.py b/src/hct_mis_api/contrib/aurora/__init__.py similarity index 100% rename from src/hct_mis_api/aurora/migrations/__init__.py rename to src/hct_mis_api/contrib/aurora/__init__.py diff --git a/src/hct_mis_api/aurora/admin.py b/src/hct_mis_api/contrib/aurora/admin.py similarity index 97% rename from src/hct_mis_api/aurora/admin.py rename to src/hct_mis_api/contrib/aurora/admin.py index 02b626c6a7..885ceb3016 100644 --- a/src/hct_mis_api/aurora/admin.py +++ b/src/hct_mis_api/contrib/aurora/admin.py @@ -31,14 +31,14 @@ from hct_mis_api.apps.registration_data.models import RegistrationDataImport from hct_mis_api.apps.utils.admin import HOPEModelAdminBase from hct_mis_api.apps.utils.security import is_root -from hct_mis_api.aurora import models -from hct_mis_api.aurora.celery_tasks import fresh_extract_records_task -from hct_mis_api.aurora.models import Record, Registration -from hct_mis_api.aurora.services.extract_record import extract -from hct_mis_api.aurora.services.flex_registration_service import ( +from hct_mis_api.contrib.aurora import models +from hct_mis_api.contrib.aurora.celery_tasks import fresh_extract_records_task +from hct_mis_api.contrib.aurora.models import Record, Registration +from hct_mis_api.contrib.aurora.services.extract_record import extract +from hct_mis_api.contrib.aurora.services.flex_registration_service import ( create_task_for_processing_records, ) -from hct_mis_api.aurora.utils import fetch_records, get_metadata +from hct_mis_api.contrib.aurora.utils import fetch_records, get_metadata class StatusFilter(ChoicesFieldComboFilter): diff --git a/src/hct_mis_api/aurora/api.py b/src/hct_mis_api/contrib/aurora/api.py similarity index 98% rename from src/hct_mis_api/aurora/api.py rename to src/hct_mis_api/contrib/aurora/api.py index 02dd379db1..2996bc6ebd 100644 --- a/src/hct_mis_api/aurora/api.py +++ b/src/hct_mis_api/contrib/aurora/api.py @@ -1,7 +1,7 @@ # from rest_framework import serializers # from rest_framework.generics import ListAPIView # -# from hct_mis_api.aurora.models import AuroraRegistration +# from hct_mis_api.contrib.aurora.models import AuroraRegistration # # # class RegistrationDetailSerializer(serializers.ModelSerializer): diff --git a/src/hct_mis_api/aurora/apps.py b/src/hct_mis_api/contrib/aurora/apps.py similarity index 60% rename from src/hct_mis_api/aurora/apps.py rename to src/hct_mis_api/contrib/aurora/apps.py index c2ba04a2b4..ec9e28dac6 100644 --- a/src/hct_mis_api/aurora/apps.py +++ b/src/hct_mis_api/contrib/aurora/apps.py @@ -2,20 +2,20 @@ class Config(AppConfig): - name = "hct_mis_api.aurora" + name = "hct_mis_api.contrib.aurora" def ready(self) -> None: - from hct_mis_api.aurora.rdi import registry - from hct_mis_api.aurora.services.czech_republic_flex_registration_service import ( + from hct_mis_api.contrib.aurora.rdi import registry + from hct_mis_api.contrib.aurora.services.czech_republic_flex_registration_service import ( CzechRepublicFlexRegistration, ) - from hct_mis_api.aurora.services.generic_registration_service import ( + from hct_mis_api.contrib.aurora.services.generic_registration_service import ( GenericRegistrationService, ) - from hct_mis_api.aurora.services.sri_lanka_flex_registration_service import ( + from hct_mis_api.contrib.aurora.services.sri_lanka_flex_registration_service import ( SriLankaRegistrationService, ) - from hct_mis_api.aurora.services.ukraine_flex_registration_service import ( + from hct_mis_api.contrib.aurora.services.ukraine_flex_registration_service import ( Registration2024, UkraineBaseRegistrationService, UkraineRegistrationService, diff --git a/src/hct_mis_api/aurora/celery_tasks.py b/src/hct_mis_api/contrib/aurora/celery_tasks.py similarity index 97% rename from src/hct_mis_api/aurora/celery_tasks.py rename to src/hct_mis_api/contrib/aurora/celery_tasks.py index fd7de580c9..ad4a81188d 100644 --- a/src/hct_mis_api/aurora/celery_tasks.py +++ b/src/hct_mis_api/contrib/aurora/celery_tasks.py @@ -13,8 +13,8 @@ ) from hct_mis_api.apps.utils.logs import log_start_and_end from hct_mis_api.apps.utils.sentry import sentry_tags -from hct_mis_api.aurora.models import Record, Registration -from hct_mis_api.aurora.services.extract_record import extract +from hct_mis_api.contrib.aurora.models import Record, Registration +from hct_mis_api.contrib.aurora.services.extract_record import extract if TYPE_CHECKING: from uuid import UUID diff --git a/src/hct_mis_api/aurora/fixtures.py b/src/hct_mis_api/contrib/aurora/fixtures.py similarity index 95% rename from src/hct_mis_api/aurora/fixtures.py rename to src/hct_mis_api/contrib/aurora/fixtures.py index dccf7cd80d..16024f3c5f 100644 --- a/src/hct_mis_api/aurora/fixtures.py +++ b/src/hct_mis_api/contrib/aurora/fixtures.py @@ -6,7 +6,7 @@ from hct_mis_api.apps.account.fixtures import BusinessAreaFactory from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.aurora.models import Organization, Project, Registration +from hct_mis_api.contrib.aurora.models import Organization, Project, Registration faker = Faker() diff --git a/src/hct_mis_api/aurora/fixtures/data.json b/src/hct_mis_api/contrib/aurora/fixtures/data.json similarity index 100% rename from src/hct_mis_api/aurora/fixtures/data.json rename to src/hct_mis_api/contrib/aurora/fixtures/data.json diff --git a/src/hct_mis_api/aurora/forms.py b/src/hct_mis_api/contrib/aurora/forms.py similarity index 92% rename from src/hct_mis_api/aurora/forms.py rename to src/hct_mis_api/contrib/aurora/forms.py index a56a63d2d4..67f57d24a3 100644 --- a/src/hct_mis_api/aurora/forms.py +++ b/src/hct_mis_api/contrib/aurora/forms.py @@ -3,7 +3,7 @@ from django import forms from django.core.exceptions import ValidationError -from hct_mis_api.aurora.models import Registration +from hct_mis_api.contrib.aurora.models import Registration class ProjectForm(forms.ModelForm): diff --git a/src/hct_mis_api/aurora/migrations/0001_migration.py b/src/hct_mis_api/contrib/aurora/migrations/0001_migration.py similarity index 100% rename from src/hct_mis_api/aurora/migrations/0001_migration.py rename to src/hct_mis_api/contrib/aurora/migrations/0001_migration.py diff --git a/src/hct_mis_api/aurora/migrations/0002_migration.py b/src/hct_mis_api/contrib/aurora/migrations/0002_migration.py similarity index 100% rename from src/hct_mis_api/aurora/migrations/0002_migration.py rename to src/hct_mis_api/contrib/aurora/migrations/0002_migration.py diff --git a/src/hct_mis_api/aurora/services/__init__.py b/src/hct_mis_api/contrib/aurora/migrations/__init__.py similarity index 100% rename from src/hct_mis_api/aurora/services/__init__.py rename to src/hct_mis_api/contrib/aurora/migrations/__init__.py diff --git a/src/hct_mis_api/aurora/models.py b/src/hct_mis_api/contrib/aurora/models.py similarity index 98% rename from src/hct_mis_api/aurora/models.py rename to src/hct_mis_api/contrib/aurora/models.py index 99854595e7..2f8e0f9e55 100644 --- a/src/hct_mis_api/aurora/models.py +++ b/src/hct_mis_api/contrib/aurora/models.py @@ -7,7 +7,7 @@ from strategy_field.fields import StrategyField from hct_mis_api.apps.registration_datahub.utils import combine_collections -from hct_mis_api.aurora.rdi import registry +from hct_mis_api.contrib.aurora.rdi import registry class AuroraModel(models.Model): diff --git a/src/hct_mis_api/aurora/rdi.py b/src/hct_mis_api/contrib/aurora/rdi.py similarity index 100% rename from src/hct_mis_api/aurora/rdi.py rename to src/hct_mis_api/contrib/aurora/rdi.py diff --git a/src/hct_mis_api/contrib/aurora/services/__init__.py b/src/hct_mis_api/contrib/aurora/services/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/hct_mis_api/aurora/services/base_flex_registration_service.py b/src/hct_mis_api/contrib/aurora/services/base_flex_registration_service.py similarity index 97% rename from src/hct_mis_api/aurora/services/base_flex_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/base_flex_registration_service.py index ed2fd14baf..6d36b80e7f 100644 --- a/src/hct_mis_api/aurora/services/base_flex_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/base_flex_registration_service.py @@ -14,9 +14,9 @@ from hct_mis_api.apps.household.models import PendingHousehold, PendingIndividual from hct_mis_api.apps.registration_data.models import ImportData, RegistrationDataImport from hct_mis_api.apps.registration_datahub.celery_tasks import rdi_deduplication_task -from hct_mis_api.aurora.celery_tasks import process_flex_records_task -from hct_mis_api.aurora.models import Record, Registration -from hct_mis_api.aurora.rdi import AuroraProcessor +from hct_mis_api.contrib.aurora.celery_tasks import process_flex_records_task +from hct_mis_api.contrib.aurora.models import Record, Registration +from hct_mis_api.contrib.aurora.rdi import AuroraProcessor if TYPE_CHECKING: from uuid import UUID diff --git a/src/hct_mis_api/aurora/services/czech_republic_flex_registration_service.py b/src/hct_mis_api/contrib/aurora/services/czech_republic_flex_registration_service.py similarity index 99% rename from src/hct_mis_api/aurora/services/czech_republic_flex_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/czech_republic_flex_registration_service.py index dba2abe990..70e391a9bc 100644 --- a/src/hct_mis_api/aurora/services/czech_republic_flex_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/czech_republic_flex_registration_service.py @@ -33,7 +33,7 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.registration_data.models import RegistrationDataImport -from hct_mis_api.aurora.services.base_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.base_flex_registration_service import ( BaseRegistrationService, ) diff --git a/src/hct_mis_api/aurora/services/extract_record.py b/src/hct_mis_api/contrib/aurora/services/extract_record.py similarity index 98% rename from src/hct_mis_api/aurora/services/extract_record.py rename to src/hct_mis_api/contrib/aurora/services/extract_record.py index ad71a1814e..b75b95cf4b 100644 --- a/src/hct_mis_api/aurora/services/extract_record.py +++ b/src/hct_mis_api/contrib/aurora/services/extract_record.py @@ -2,7 +2,7 @@ from typing import Any, Iterable from hct_mis_api.apps.registration_datahub.templatetags.smart_register import is_image -from hct_mis_api.aurora.models import Record +from hct_mis_api.contrib.aurora.models import Record logger = logging.getLogger(__name__) diff --git a/src/hct_mis_api/aurora/services/flex_registration_service.py b/src/hct_mis_api/contrib/aurora/services/flex_registration_service.py similarity index 100% rename from src/hct_mis_api/aurora/services/flex_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/flex_registration_service.py diff --git a/src/hct_mis_api/aurora/services/generic_registration_service.py b/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py similarity index 99% rename from src/hct_mis_api/aurora/services/generic_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/generic_registration_service.py index 52736f51c9..d414cda68f 100644 --- a/src/hct_mis_api/aurora/services/generic_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/generic_registration_service.py @@ -22,7 +22,7 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.registration_data.models import RegistrationDataImport -from hct_mis_api.aurora.services.base_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.base_flex_registration_service import ( BaseRegistrationService, ) diff --git a/src/hct_mis_api/aurora/services/sri_lanka_flex_registration_service.py b/src/hct_mis_api/contrib/aurora/services/sri_lanka_flex_registration_service.py similarity index 99% rename from src/hct_mis_api/aurora/services/sri_lanka_flex_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/sri_lanka_flex_registration_service.py index d8ca36e7e3..b847796fff 100644 --- a/src/hct_mis_api/aurora/services/sri_lanka_flex_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/sri_lanka_flex_registration_service.py @@ -23,7 +23,7 @@ from hct_mis_api.apps.periodic_data_update.utils import populate_pdu_with_null_values from hct_mis_api.apps.registration_data.models import RegistrationDataImport from hct_mis_api.apps.utils.age_at_registration import calculate_age_at_registration -from hct_mis_api.aurora.services.base_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.base_flex_registration_service import ( BaseRegistrationService, ) diff --git a/src/hct_mis_api/aurora/services/ukraine_flex_registration_service.py b/src/hct_mis_api/contrib/aurora/services/ukraine_flex_registration_service.py similarity index 99% rename from src/hct_mis_api/aurora/services/ukraine_flex_registration_service.py rename to src/hct_mis_api/contrib/aurora/services/ukraine_flex_registration_service.py index d24f98160a..01cd922083 100644 --- a/src/hct_mis_api/aurora/services/ukraine_flex_registration_service.py +++ b/src/hct_mis_api/contrib/aurora/services/ukraine_flex_registration_service.py @@ -37,7 +37,7 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.registration_data.models import RegistrationDataImport -from hct_mis_api.aurora.services.base_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.base_flex_registration_service import ( BaseRegistrationService, ) diff --git a/src/hct_mis_api/aurora/static/aurora/datatable.js b/src/hct_mis_api/contrib/aurora/static/aurora/datatable.js similarity index 100% rename from src/hct_mis_api/aurora/static/aurora/datatable.js rename to src/hct_mis_api/contrib/aurora/static/aurora/datatable.js diff --git a/src/hct_mis_api/aurora/static/aurora/datatable.scss b/src/hct_mis_api/contrib/aurora/static/aurora/datatable.scss similarity index 100% rename from src/hct_mis_api/aurora/static/aurora/datatable.scss rename to src/hct_mis_api/contrib/aurora/static/aurora/datatable.scss diff --git a/src/hct_mis_api/aurora/templates/admin/aurora/app_index.html b/src/hct_mis_api/contrib/aurora/templates/admin/aurora/app_index.html similarity index 100% rename from src/hct_mis_api/aurora/templates/admin/aurora/app_index.html rename to src/hct_mis_api/contrib/aurora/templates/admin/aurora/app_index.html diff --git a/src/hct_mis_api/aurora/templates/admin/aurora/record/fetch.html b/src/hct_mis_api/contrib/aurora/templates/admin/aurora/record/fetch.html similarity index 100% rename from src/hct_mis_api/aurora/templates/admin/aurora/record/fetch.html rename to src/hct_mis_api/contrib/aurora/templates/admin/aurora/record/fetch.html diff --git a/src/hct_mis_api/aurora/templates/admin/aurora/registration/analyze.html b/src/hct_mis_api/contrib/aurora/templates/admin/aurora/registration/analyze.html similarity index 100% rename from src/hct_mis_api/aurora/templates/admin/aurora/registration/analyze.html rename to src/hct_mis_api/contrib/aurora/templates/admin/aurora/registration/analyze.html diff --git a/src/hct_mis_api/aurora/templates/dataset_list.html b/src/hct_mis_api/contrib/aurora/templates/dataset_list.html similarity index 100% rename from src/hct_mis_api/aurora/templates/dataset_list.html rename to src/hct_mis_api/contrib/aurora/templates/dataset_list.html diff --git a/src/hct_mis_api/aurora/urls.py b/src/hct_mis_api/contrib/aurora/urls.py similarity index 70% rename from src/hct_mis_api/aurora/urls.py rename to src/hct_mis_api/contrib/aurora/urls.py index 71f73d3a94..1f299a26f2 100644 --- a/src/hct_mis_api/aurora/urls.py +++ b/src/hct_mis_api/contrib/aurora/urls.py @@ -1,6 +1,6 @@ from django.urls import path -from hct_mis_api.aurora.views import FetchDataView, RegistrationDataView +from hct_mis_api.contrib.aurora.views import FetchDataView, RegistrationDataView app_name = "aurora" diff --git a/src/hct_mis_api/aurora/utils.py b/src/hct_mis_api/contrib/aurora/utils.py similarity index 96% rename from src/hct_mis_api/aurora/utils.py rename to src/hct_mis_api/contrib/aurora/utils.py index 554101450c..c14e39ab7f 100644 --- a/src/hct_mis_api/aurora/utils.py +++ b/src/hct_mis_api/contrib/aurora/utils.py @@ -11,7 +11,12 @@ from coreapi import codecs from coreapi.exceptions import NoCodecAvailable -from hct_mis_api.aurora.models import Organization, Project, Record, Registration +from hct_mis_api.contrib.aurora.models import ( + Organization, + Project, + Record, + Registration, +) logger = logging.getLogger(__name__) diff --git a/src/hct_mis_api/aurora/views.py b/src/hct_mis_api/contrib/aurora/views.py similarity index 95% rename from src/hct_mis_api/aurora/views.py rename to src/hct_mis_api/contrib/aurora/views.py index 32f003aa3a..e578de9400 100644 --- a/src/hct_mis_api/aurora/views.py +++ b/src/hct_mis_api/contrib/aurora/views.py @@ -11,8 +11,8 @@ from admin_extra_buttons.utils import HttpResponseRedirectToReferrer from sentry_sdk import set_tag -from hct_mis_api.aurora.models import Registration -from hct_mis_api.aurora.utils import fetch_metadata +from hct_mis_api.contrib.aurora.models import Registration +from hct_mis_api.contrib.aurora.utils import fetch_metadata class FetchDataView(ProcessFormView): diff --git a/src/hct_mis_api/contrib/vision/__init__.py b/src/hct_mis_api/contrib/vision/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/hct_mis_api/contrib/vision/admin.py b/src/hct_mis_api/contrib/vision/admin.py new file mode 100644 index 0000000000..435a9f4480 --- /dev/null +++ b/src/hct_mis_api/contrib/vision/admin.py @@ -0,0 +1,30 @@ +from django.contrib import admin + +from adminfilters.filters import ValueFilter + +from hct_mis_api.apps.utils.admin import HOPEModelAdminBase +from hct_mis_api.contrib.vision.models import DownPayment, FundsCommitment + + +@admin.register(FundsCommitment) +class FundsCommitmentAdmin(HOPEModelAdminBase): + list_display = ( + "rec_serial_number", + "business_area", + "funds_commitment_item", + "funds_commitment_number", + "posting_date", + ) + list_filter = ( + "business_area", + "posting_date", + ("business_area", ValueFilter), + ) + search_fields = ("rec_serial_number", "vendor_id", "wbs_element", "funds_commitment_number") + + +@admin.register(DownPayment) +class DownPaymentAdmin(HOPEModelAdminBase): + list_display = ("rec_serial_number", "down_payment_reference", "business_area", "consumed_fc_number") + + list_filter = (("business_area", ValueFilter),) diff --git a/src/hct_mis_api/contrib/vision/apps.py b/src/hct_mis_api/contrib/vision/apps.py new file mode 100644 index 0000000000..83f681e656 --- /dev/null +++ b/src/hct_mis_api/contrib/vision/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class Config(AppConfig): + name = "hct_mis_api.contrib.vision" + verbose_name = "Vision" diff --git a/src/hct_mis_api/contrib/vision/fixtures.py b/src/hct_mis_api/contrib/vision/fixtures.py new file mode 100644 index 0000000000..534a3c7f85 --- /dev/null +++ b/src/hct_mis_api/contrib/vision/fixtures.py @@ -0,0 +1,25 @@ +import factory.fuzzy +from factory.django import DjangoModelFactory +from pytz import utc + +from hct_mis_api.apps.core.models import BusinessArea +from hct_mis_api.contrib.vision.models import FundsCommitment + + +class FundsCommitmentFactory(DjangoModelFactory): + class Meta: + model = FundsCommitment + + rec_serial_number = factory.fuzzy.FuzzyInteger(1000, 99999999) + business_area = factory.LazyAttribute(lambda o: BusinessArea.objects.first().cash_assist_code) + document_type = "DO" + currency_code = factory.Faker("currency_code") + + total_open_amount_local = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + total_open_amount_usd = factory.fuzzy.FuzzyDecimal(100.0, 10000.0) + update_date = factory.Faker( + "date_time_this_decade", + before_now=True, + after_now=False, + tzinfo=utc, + ) diff --git a/src/hct_mis_api/contrib/vision/migrations/0001_migration.py b/src/hct_mis_api/contrib/vision/migrations/0001_migration.py new file mode 100644 index 0000000000..368119e567 --- /dev/null +++ b/src/hct_mis_api/contrib/vision/migrations/0001_migration.py @@ -0,0 +1,79 @@ +# Generated by Django 3.2.25 on 2024-10-01 11:58 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('core', '0087_migration'), + ] + + operations = [ + migrations.CreateModel( + name='DownPayment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rec_serial_number', models.CharField(blank=True, max_length=10, null=True)), + ('business_area', models.CharField(max_length=4)), + ('down_payment_reference', models.CharField(max_length=20)), + ('document_type', models.CharField(max_length=10)), + ('consumed_fc_number', models.CharField(max_length=10)), + ('total_down_payment_amount_local', models.DecimalField(decimal_places=2, max_digits=15)), + ('total_down_payment_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)), + ('currency_code', models.CharField(blank=True, max_length=5, null=True)), + ('posting_date', models.DateField(blank=True, null=True)), + ('doc_year', models.IntegerField(blank=True, null=True)), + ('doc_number', models.CharField(blank=True, max_length=10, null=True)), + ('doc_item_number', models.CharField(max_length=3, null=True)), + ('create_date', models.DateTimeField(auto_now_add=True, null=True)), + ('created_by', models.CharField(blank=True, default='', max_length=20, null=True)), + ('update_date', models.DateTimeField(blank=True, null=True)), + ('updated_by', models.CharField(blank=True, default='', max_length=20, null=True)), + ('business_office_code', models.CharField(blank=True, max_length=4, null=True)), + ('business_area_obj', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.businessarea')), + ], + ), + migrations.CreateModel( + name='FundsCommitment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rec_serial_number', models.CharField(max_length=10, unique=True)), + ('business_area', models.CharField(blank=True, max_length=4, null=True)), + ('funds_commitment_number', models.CharField(blank=True, max_length=10, null=True)), + ('document_type', models.CharField(blank=True, max_length=2, null=True)), + ('document_text', models.CharField(blank=True, max_length=50, null=True)), + ('currency_code', models.CharField(blank=True, max_length=5, null=True)), + ('gl_account', models.CharField(blank=True, max_length=10, null=True)), + ('commitment_amount_local', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)), + ('commitment_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)), + ('total_open_amount_local', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)), + ('total_open_amount_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)), + ('vendor_id', models.CharField(blank=True, max_length=10, null=True)), + ('posting_date', models.DateField(blank=True, null=True)), + ('vision_approval', models.CharField(blank=True, max_length=1, null=True)), + ('document_reference', models.CharField(max_length=16, null=True)), + ('fc_status', models.CharField(blank=True, max_length=1, null=True)), + ('create_date', models.DateTimeField(auto_now_add=True, null=True)), + ('created_by', models.CharField(blank=True, default='', max_length=20, null=True)), + ('update_date', models.DateTimeField(blank=True, null=True)), + ('updated_by', models.CharField(blank=True, default='', max_length=20, null=True)), + ('grant_number', models.CharField(blank=True, default='', max_length=10, null=True)), + ('sponsor', models.CharField(blank=True, default='', max_length=10, null=True)), + ('sponsor_name', models.CharField(blank=True, default='', max_length=100, null=True)), + ('wbs_element', models.CharField(blank=True, default='', max_length=24, null=True)), + ('fund', models.CharField(blank=True, default='', max_length=10, null=True)), + ('funds_center', models.CharField(blank=True, default='', max_length=16, null=True)), + ('funds_commitment_item', models.CharField(blank=True, default='', max_length=3, null=True)), + ('percentage', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)), + ('business_office_code', models.CharField(blank=True, max_length=4, null=True)), + ('business_area_obj', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.businessarea')), + ], + options={ + 'unique_together': {('funds_commitment_number', 'funds_commitment_item')}, + }, + ), + ] diff --git a/src/hct_mis_api/contrib/vision/migrations/__init__.py b/src/hct_mis_api/contrib/vision/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/hct_mis_api/contrib/vision/models.py b/src/hct_mis_api/contrib/vision/models.py new file mode 100644 index 0000000000..69a44bb794 --- /dev/null +++ b/src/hct_mis_api/contrib/vision/models.py @@ -0,0 +1,94 @@ +from django.db import models + +from hct_mis_api.apps.core.models import BusinessArea + + +class FundsCommitment(models.Model): + rec_serial_number = models.CharField(max_length=10, unique=True) + business_area = models.CharField(max_length=4, blank=True, null=True) + funds_commitment_number = models.CharField(max_length=10, blank=True, null=True) + document_type = models.CharField(max_length=2, blank=True, null=True) + document_text = models.CharField(max_length=50, blank=True, null=True) + currency_code = models.CharField(max_length=5, blank=True, null=True) + gl_account = models.CharField(null=True, blank=True, max_length=10) + commitment_amount_local = models.DecimalField( + decimal_places=2, + max_digits=15, + blank=True, + null=True, + ) + commitment_amount_usd = models.DecimalField( + decimal_places=2, + max_digits=15, + blank=True, + null=True, + ) + total_open_amount_local = models.DecimalField( + decimal_places=2, + max_digits=15, + blank=True, + null=True, + ) + total_open_amount_usd = models.DecimalField( + decimal_places=2, + max_digits=15, + blank=True, + null=True, + ) + vendor_id = models.CharField(max_length=10, blank=True, null=True) + posting_date = models.DateField(blank=True, null=True) + vision_approval = models.CharField(max_length=1, blank=True, null=True) + document_reference = models.CharField(max_length=16, null=True) + fc_status = models.CharField(max_length=1, blank=True, null=True) + create_date = models.DateTimeField(null=True, blank=True, auto_now_add=True) + created_by = models.CharField(max_length=20, null=True, blank=True, default="") + update_date = models.DateTimeField(null=True, blank=True) + updated_by = models.CharField(max_length=20, blank=True, null=True, default="") + + grant_number = models.CharField(max_length=10, null=True, blank=True, default="") + sponsor = models.CharField(max_length=10, null=True, blank=True, default="") + sponsor_name = models.CharField(max_length=100, null=True, blank=True, default="") + wbs_element = models.CharField(max_length=24, null=True, blank=True, default="") + fund = models.CharField(max_length=10, null=True, blank=True, default="") + funds_center = models.CharField(max_length=16, null=True, blank=True, default="") + funds_commitment_item = models.CharField(max_length=3, null=True, blank=True, default="") + percentage = models.DecimalField(decimal_places=2, max_digits=5, null=True, blank=True) + + business_office_code = models.CharField(max_length=4, blank=True, null=True) + business_area_obj = models.ForeignKey(BusinessArea, on_delete=models.SET_NULL, null=True, blank=True) + + def __str__(self) -> str: + return self.funds_commitment_number + + class Meta: + unique_together = ("funds_commitment_number", "funds_commitment_item") + + +class DownPayment(models.Model): + rec_serial_number = models.CharField(max_length=10, blank=True, null=True) + business_area = models.CharField(max_length=4) + down_payment_reference = models.CharField(max_length=20) + document_type = models.CharField(max_length=10) + consumed_fc_number = models.CharField(max_length=10) + total_down_payment_amount_local = models.DecimalField( + decimal_places=2, + max_digits=15, + ) + total_down_payment_amount_usd = models.DecimalField( + decimal_places=2, + max_digits=15, + blank=True, + null=True, + ) + currency_code = models.CharField(max_length=5, blank=True, null=True) + posting_date = models.DateField(blank=True, null=True) + doc_year = models.IntegerField(blank=True, null=True) + doc_number = models.CharField(max_length=10, blank=True, null=True) + doc_item_number = models.CharField(max_length=3, null=True) + create_date = models.DateTimeField(null=True, blank=True, auto_now_add=True) + created_by = models.CharField(max_length=20, blank=True, null=True, default="") + update_date = models.DateTimeField(blank=True, null=True) + updated_by = models.CharField(max_length=20, blank=True, null=True, default="") + + business_area_obj = models.ForeignKey(BusinessArea, on_delete=models.SET_NULL, null=True, blank=True) + business_office_code = models.CharField(max_length=4, blank=True, null=True) diff --git a/src/hct_mis_api/urls.py b/src/hct_mis_api/urls.py index c4896a4c42..22a56b66ac 100644 --- a/src/hct_mis_api/urls.py +++ b/src/hct_mis_api/urls.py @@ -101,7 +101,7 @@ path(f"{settings.ADMIN_PANEL_URL}/", admin.site.urls), path("hh-status", hct_mis_api.apps.household.views.HouseholdStatusView.as_view()), path("upload-file/", UploadFile.as_view(), name="upload-file"), - path("aurora/", include("hct_mis_api.aurora.urls", namespace="aurora")), + path("aurora/", include("hct_mis_api.contrib.aurora.urls", namespace="aurora")), ] if settings.PROFILING: diff --git a/tests/unit/apps/account/test_admin.py b/tests/unit/apps/account/test_admin.py index de60521556..abd919d946 100644 --- a/tests/unit/apps/account/test_admin.py +++ b/tests/unit/apps/account/test_admin.py @@ -3,29 +3,34 @@ from django.urls import reverse -from django_webtest import WebTest +import pytest +from django_webtest import DjangoTestApp from hct_mis_api.apps.account.fixtures import RoleFactory, UserFactory -from hct_mis_api.apps.account.models import User - - -class RoleTest(WebTest): - @classmethod - def setUpTestData(cls) -> None: - super().setUpTestData() - RoleFactory() - cls.superuser: User = UserFactory(is_superuser=True, is_staff=True) - - def test_role_perm_matrix(self) -> None: - url = reverse("admin:account_role_matrix") - res = self.app.get(url, user=self.superuser) - assert res.status_code == 200 - - def test_role_sync(self) -> None: - url = reverse("admin:account_role_dumpdata_qs") - res = self.app.get(url, user=self.superuser) - assert res.status_code == 200 - jres = json.loads(unquote(res.json["data"])) - models = set([item["model"] for item in jres]) - assert len(models) == 1 - assert models == {"account.role"} +from hct_mis_api.apps.account.models import Role, User + + +@pytest.fixture() +def superuser(request: pytest.FixtureRequest) -> User: + return UserFactory(is_superuser=True, is_staff=True) + + +@pytest.fixture() +def role(request: pytest.FixtureRequest) -> Role: + return RoleFactory(name="Role") + + +def test_role_perm_matrix(django_app: DjangoTestApp, superuser: pytest.FixtureRequest) -> None: + url = reverse("admin:account_role_matrix") + res = django_app.get(url, user=superuser) + assert res.status_code == 200 + + +def test_role_sync(django_app: DjangoTestApp, superuser: User, role: Role) -> None: + url = reverse("admin:account_role_dumpdata_qs") + res = django_app.get(url, user=superuser) + assert res.status_code == 200 + jres = json.loads(unquote(res.json["data"])) + models = set([item["model"] for item in jres]) + assert len(models) == 1 + assert models == {"account.role"} diff --git a/tests/unit/apps/registration_datahub/test_celery_tasks.py b/tests/unit/apps/registration_datahub/test_celery_tasks.py index dd516ca871..53d63bd82f 100644 --- a/tests/unit/apps/registration_datahub/test_celery_tasks.py +++ b/tests/unit/apps/registration_datahub/test_celery_tasks.py @@ -67,26 +67,26 @@ PullKoboSubmissions, ) from hct_mis_api.apps.utils.models import MergeStatusModel -from hct_mis_api.aurora.celery_tasks import ( +from hct_mis_api.contrib.aurora.celery_tasks import ( automate_rdi_creation_task, process_flex_records_task, ) -from hct_mis_api.aurora.fixtures import ( +from hct_mis_api.contrib.aurora.fixtures import ( OrganizationFactory, ProjectFactory, RegistrationFactory, ) -from hct_mis_api.aurora.models import Record -from hct_mis_api.aurora.services.base_flex_registration_service import ( +from hct_mis_api.contrib.aurora.models import Record +from hct_mis_api.contrib.aurora.services.base_flex_registration_service import ( BaseRegistrationService, ) -from hct_mis_api.aurora.services.flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.flex_registration_service import ( create_task_for_processing_records, ) -from hct_mis_api.aurora.services.sri_lanka_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.sri_lanka_flex_registration_service import ( SriLankaRegistrationService, ) -from hct_mis_api.aurora.services.ukraine_flex_registration_service import ( +from hct_mis_api.contrib.aurora.services.ukraine_flex_registration_service import ( UkraineBaseRegistrationService, UkraineRegistrationService, ) @@ -487,7 +487,7 @@ def create_imported_document_types() -> None: def create_ukraine_business_area() -> None: - from hct_mis_api.aurora.models import Registration + from hct_mis_api.contrib.aurora.models import Registration slug = "ukraine" BusinessArea.objects.create( @@ -553,7 +553,7 @@ def do_nothing_cache(*_args: Any, **_kwargs: Any) -> Generator: @patch( - "hct_mis_api.aurora.services.base_flex_registration_service.BaseRegistrationService.validate_data_collection_type" + "hct_mis_api.contrib.aurora.services.base_flex_registration_service.BaseRegistrationService.validate_data_collection_type" ) class TestAutomatingRDICreationTask(TestCase): databases = { diff --git a/tests/unit/apps/registration_datahub/test_clean_old_record_files_task.py b/tests/unit/apps/registration_datahub/test_clean_old_record_files_task.py index c6adc5baaa..ea212a3691 100644 --- a/tests/unit/apps/registration_datahub/test_clean_old_record_files_task.py +++ b/tests/unit/apps/registration_datahub/test_clean_old_record_files_task.py @@ -3,7 +3,7 @@ from django.utils import timezone from hct_mis_api.apps.core.base_test_case import APITestCase -from hct_mis_api.aurora.models import Record +from hct_mis_api.contrib.aurora.models import Record class TestClearRecordFilesTask(APITestCase): @@ -48,7 +48,7 @@ def setUpTestData(cls) -> None: ) def test_clean_old_record_files_task(self) -> None: - from hct_mis_api.aurora.celery_tasks import clean_old_record_files_task + from hct_mis_api.contrib.aurora.celery_tasks import clean_old_record_files_task clean_old_record_files_task() diff --git a/tests/unit/apps/registration_datahub/test_czech_republic_registration_service.py b/tests/unit/apps/registration_datahub/test_czech_republic_registration_service.py index 1a5c312e9d..40f3d07a53 100644 --- a/tests/unit/apps/registration_datahub/test_czech_republic_registration_service.py +++ b/tests/unit/apps/registration_datahub/test_czech_republic_registration_service.py @@ -24,13 +24,13 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.aurora.fixtures import ( +from hct_mis_api.contrib.aurora.fixtures import ( OrganizationFactory, ProjectFactory, RegistrationFactory, ) -from hct_mis_api.aurora.models import Record -from hct_mis_api.aurora.services.czech_republic_flex_registration_service import ( +from hct_mis_api.contrib.aurora.models import Record +from hct_mis_api.contrib.aurora.services.czech_republic_flex_registration_service import ( CzechRepublicFlexRegistration, ) diff --git a/tests/unit/apps/registration_datahub/test_extract_records.py b/tests/unit/apps/registration_datahub/test_extract_records.py index a995c97509..3fe906d263 100644 --- a/tests/unit/apps/registration_datahub/test_extract_records.py +++ b/tests/unit/apps/registration_datahub/test_extract_records.py @@ -6,8 +6,8 @@ from django.test import TestCase from django.utils import timezone -from hct_mis_api.aurora.celery_tasks import extract_records_task -from hct_mis_api.aurora.models import Record +from hct_mis_api.contrib.aurora.celery_tasks import extract_records_task +from hct_mis_api.contrib.aurora.models import Record class TestExtractRecords(TestCase): diff --git a/tests/unit/apps/registration_datahub/test_generic_registration_service.py b/tests/unit/apps/registration_datahub/test_generic_registration_service.py index bfd6bc9420..cd9bd3127d 100644 --- a/tests/unit/apps/registration_datahub/test_generic_registration_service.py +++ b/tests/unit/apps/registration_datahub/test_generic_registration_service.py @@ -22,13 +22,13 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.aurora.fixtures import ( +from hct_mis_api.contrib.aurora.fixtures import ( OrganizationFactory, ProjectFactory, RegistrationFactory, ) -from hct_mis_api.aurora.models import Record -from hct_mis_api.aurora.services.generic_registration_service import ( +from hct_mis_api.contrib.aurora.models import Record +from hct_mis_api.contrib.aurora.services.generic_registration_service import ( GenericRegistrationService, ) diff --git a/tests/unit/apps/registration_datahub/test_sri_lanka_registration_service.py b/tests/unit/apps/registration_datahub/test_sri_lanka_registration_service.py index 0a16ca5616..88fc8a4503 100644 --- a/tests/unit/apps/registration_datahub/test_sri_lanka_registration_service.py +++ b/tests/unit/apps/registration_datahub/test_sri_lanka_registration_service.py @@ -20,13 +20,13 @@ PendingIndividualRoleInHousehold, ) from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.aurora.fixtures import ( +from hct_mis_api.contrib.aurora.fixtures import ( OrganizationFactory, ProjectFactory, RegistrationFactory, ) -from hct_mis_api.aurora.models import Record -from hct_mis_api.aurora.services.sri_lanka_flex_registration_service import ( +from hct_mis_api.contrib.aurora.models import Record +from hct_mis_api.contrib.aurora.services.sri_lanka_flex_registration_service import ( SriLankaRegistrationService, ) diff --git a/tests/unit/apps/registration_datahub/test_ukrainian_registration_service.py b/tests/unit/apps/registration_datahub/test_ukrainian_registration_service.py index 4e2ca80110..b630d669e7 100644 --- a/tests/unit/apps/registration_datahub/test_ukrainian_registration_service.py +++ b/tests/unit/apps/registration_datahub/test_ukrainian_registration_service.py @@ -18,13 +18,13 @@ PendingIndividual, ) from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.aurora.fixtures import ( +from hct_mis_api.contrib.aurora.fixtures import ( OrganizationFactory, ProjectFactory, RegistrationFactory, ) -from hct_mis_api.aurora.models import Record -from hct_mis_api.aurora.services.ukraine_flex_registration_service import ( +from hct_mis_api.contrib.aurora.models import Record +from hct_mis_api.contrib.aurora.services.ukraine_flex_registration_service import ( Registration2024, UkraineBaseRegistrationService, )