Skip to content

Commit

Permalink
Merge pull request #2575 from ohcnetwork/develop
Browse files Browse the repository at this point in the history
Merge Develop To Staging 24.45.0 | Patch
  • Loading branch information
vigneshhari authored Oct 30, 2024
2 parents 6faba33 + fa80b2c commit b9e19fb
Show file tree
Hide file tree
Showing 14 changed files with 1,341 additions and 1,133 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

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

- name: Install pipenv
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v3

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- uses: pre-commit/[email protected]
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_stages: [commit]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: no-commit-to-branch
args: [--branch, develop, --branch, staging, --branch, production]
Expand All @@ -17,7 +17,7 @@ repos:
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
rev: v0.7.0
hooks:
- id: ruff
args: [ --fix ]
Expand Down
38 changes: 18 additions & 20 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ name = "pypi"
[packages]
argon2-cffi = "==23.1.0"
authlib = "==1.3.2"
boto3 = "==1.35.29"
boto3 = "==1.35.49"
celery = "==5.4.0"
django = "==5.1.1"
django = "==5.1.2"
django-environ = "==0.11.2"
django-cors-headers = "==4.4.0"
django-cors-headers = "==4.5.0"
django-filter = "==24.3"
django-maintenance-mode = "==0.21.1"
django-queryset-csv = "==1.1.0"
django-ratelimit = "==4.1.0"
django-redis = "==5.4.0"
django-rest-passwordreset = "==1.4.1"
django-rest-passwordreset = "==1.4.2"
django-simple-history = "==3.7.0"
djangoql = "==0.18.1"
djangorestframework = "==3.15.2"
Expand All @@ -28,44 +28,42 @@ drf-spectacular = "==0.27.2"
gunicorn = "==23.0.0"
healthy-django = "==0.1.0"
jsonschema = "==4.23.0"
jwcrypto = "==1.5.6"
newrelic = "==10.1.0"
pillow = "==10.4.0"
psycopg = { extras = ["c"], version = "==3.2.2" }
pycryptodome = "==3.20.0"
newrelic = "==10.2.0"
pillow = "==11.0.0"
psycopg = { extras = ["c"], version = "==3.2.3" }
pydantic = "==1.10.18" # fix for fhir.resources < 7.0.2
pyjwt = "==2.9.0"
python-slugify = "==8.0.4"
pywebpush = "==2.0.0"
pywebpush = "==2.0.1"
redis = { extras = ["hiredis"], version = "==5.0.8" } # constraint for redis-om
redis-om = "==0.3.1" # > 0.3.1 broken with pydantic < 2
requests = "==2.32.3"
sentry-sdk = "==2.14.0"
sentry-sdk = "==2.17.0"
whitenoise = "==6.7.0"

[dev-packages]
boto3-stubs = { extras = ["s3", "boto3"], version = "==1.35.29" }
coverage = "==7.6.1"
debugpy = "==1.8.6"
boto3-stubs = { extras = ["s3", "boto3"], version = "==1.35.49" }
coverage = "==7.6.4"
debugpy = "==1.8.7"
django-coverage-plugin = "==3.1.0"
django-extensions = "==3.2.3"
django-silk = "==5.2.0"
djangorestframework-stubs = "==3.15.1"
factory-boy = "==3.3.1"
freezegun = "==1.5.1"
ipython = "==8.27.0"
mypy = "==1.11.2"
pre-commit = "==3.8.0"
ipython = "==8.28.0"
mypy = "==1.12.1"
pre-commit = "==4.0.1"
requests-mock = "==1.12.1"
tblib = "==3.0.0"
watchdog = "==5.0.3"
werkzeug = "==3.0.4"
ruff = "==0.6.8"
werkzeug = "==3.0.6"
ruff = "==0.7.0"

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

[requires]
python_version = "3.12"
python_version = "3.13"
2,310 changes: 1,206 additions & 1,104 deletions Pipfile.lock

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions care/facility/migrations/0467_alter_hospitaldoctors_area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.1 on 2024-10-28 13:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('facility', '0466_camera_presets'),
]

operations = [
migrations.AlterField(
model_name='hospitaldoctors',
name='area',
field=models.IntegerField(choices=[(1, 'General Medicine'), (2, 'Pulmonology'), (3, 'Intensivist'), (4, 'Pediatrician'), (5, 'Others'), (6, 'Anesthesiologist'), (7, 'Cardiac Surgeon'), (8, 'Cardiologist'), (9, 'Dentist'), (10, 'Dermatologist'), (11, 'Diabetologist'), (12, 'Emergency Medicine Physician'), (13, 'Endocrinologist'), (14, 'Family Physician'), (15, 'Gastroenterologist'), (16, 'General Surgeon'), (17, 'Geriatrician'), (18, 'Hematologist'), (19, 'Immunologist'), (20, 'Infectious Disease Specialist'), (21, 'MBBS doctor'), (22, 'Medical Officer'), (23, 'Nephrologist'), (24, 'Neuro Surgeon'), (25, 'Neurologist'), (26, 'Obstetrician/Gynecologist (OB/GYN)'), (27, 'Oncologist'), (28, 'Oncology Surgeon'), (29, 'Ophthalmologist'), (30, 'Oral and Maxillofacial Surgeon'), (31, 'Orthopedic'), (32, 'Orthopedic Surgeon'), (33, 'Otolaryngologist (ENT)'), (34, 'Palliative care Physician'), (35, 'Pathologist'), (36, 'Pediatric Surgeon'), (37, 'Physician'), (38, 'Plastic Surgeon'), (39, 'Psychiatrist'), (40, 'Pulmonologist'), (41, 'Radio technician'), (42, 'Radiologist'), (43, 'Rheumatologist'), (44, 'Sports Medicine Specialist'), (45, 'Thoraco-Vascular Surgeon'), (46, 'Transfusion Medicine Specialist'), (47, 'Urologist'), (48, 'Nurse'), (49, 'Allergist/Immunologist'), (50, 'Cardiothoracic Surgeon'), (51, 'Gynecologic Oncologist'), (52, 'Hepatologist'), (53, 'Internist'), (54, 'Neonatologist'), (55, 'Pain Management Specialist'), (56, 'Physiatrist (Physical Medicine and Rehabilitation)'), (57, 'Podiatrist'), (58, 'Preventive Medicine Specialist'), (59, 'Radiation Oncologist'), (60, 'Sleep Medicine Specialist'), (61, 'Transplant Surgeon'), (62, 'Trauma Surgeon'), (63, 'Vascular Surgeon'), (64, 'Critical Care Physician')]),
),
]
2 changes: 1 addition & 1 deletion care/facility/models/facility.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class FacilityFeature(models.IntegerChoices):
(16, "General Surgeon"),
(17, "Geriatrician"),
(18, "Hematologist"),
(29, "Immunologist"),
(19, "Immunologist"),
(20, "Infectious Disease Specialist"),
(21, "MBBS doctor"),
(22, "Medical Officer"),
Expand Down
9 changes: 9 additions & 0 deletions care/users/api/serializers/plug_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from rest_framework import serializers

from care.users.models import PlugConfig


class PLugConfigSerializer(serializers.ModelSerializer):
class Meta:
model = PlugConfig
exclude = ("id",)
44 changes: 44 additions & 0 deletions care/users/api/viewsets/plug_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from django.core.cache import cache
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewSet

from care.users.api.serializers.plug_config import PLugConfigSerializer
from care.users.models import PlugConfig


class PlugConfigViewset(
ModelViewSet,
GenericViewSet,
):
lookup_field = "slug"
serializer_class = PLugConfigSerializer
queryset = PlugConfig.objects.all().order_by("slug")
cache_key = "care_plug_viewset_list"
authentication_classes = []

def list(self, request, *args, **kwargs):
# Cache data and return
response = cache.get(self.cache_key)
if not response:
serializer = self.get_serializer(self.queryset, many=True)
response = serializer.data
cache.set(self.cache_key, response)
return Response({"configs": [response]})

def perform_create(self, serializer):
cache.delete(self.cache_key)
serializer.save()

def perform_update(self, serializer):
cache.delete(self.cache_key)
serializer.save()

def perform_destroy(self, instance):
cache.delete(self.cache_key)
instance.delete()

def get_permissions(self):
if self.action in ["list", "retrieve"]:
return []
return [IsAdminUser()]
21 changes: 21 additions & 0 deletions care/users/migrations/0020_plugconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.1.1 on 2024-10-29 19:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0019_rename_doctor_qualification_user_qualification'),
]

operations = [
migrations.CreateModel(
name='PlugConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.CharField(max_length=255, unique=True)),
('meta', models.JSONField(default=dict)),
],
),
]
8 changes: 8 additions & 0 deletions care/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@ def __str__(self):
return self.facility.name


class PlugConfig(models.Model):
slug = models.CharField(max_length=255, unique=True)
meta = models.JSONField(default=dict)

def __str__(self):
return self.slug


class UserFlag(BaseFlag):
user = models.ForeignKey(User, on_delete=models.CASCADE, null=False, blank=False)

Expand Down
4 changes: 4 additions & 0 deletions config/api_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@
StateViewSet,
WardViewSet,
)
from care.users.api.viewsets.plug_config import PlugConfigViewset
from care.users.api.viewsets.skill import SkillViewSet
from care.users.api.viewsets.users import UserViewSet
from care.users.api.viewsets.userskill import UserSkillViewSet

router = DefaultRouter() if settings.DEBUG else SimpleRouter()

router.register("users", UserViewSet, basename="users")

router.register("plug_config", PlugConfigViewset, basename="plug_configs")

user_nested_router = NestedSimpleRouter(router, r"users", lookup="users")
user_nested_router.register("skill", UserSkillViewSet, basename="users-skill")

Expand Down
4 changes: 2 additions & 2 deletions docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim-bookworm
FROM python:3.13-slim-bookworm

ARG TYPST_VERSION=0.11.0

Expand Down Expand Up @@ -28,7 +28,7 @@ RUN ARCH=$(dpkg --print-architecture) && \

# use pipenv to manage virtualenv
RUN python -m venv /venv
RUN pip install pipenv
RUN pip install pipenv==2024.2.0

COPY Pipfile Pipfile.lock ./
RUN pipenv install --system --categories "packages dev-packages"
Expand Down
4 changes: 2 additions & 2 deletions docker/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim-bookworm AS base
FROM python:3.13-slim-bookworm AS base

ARG APP_HOME=/app
ARG TYPST_VERSION=0.11.0
Expand Down Expand Up @@ -41,7 +41,7 @@ RUN ARCH=$(dpkg --print-architecture) && \

# use pipenv to manage virtualenv
RUN python -m venv /venv
RUN pip install pipenv
RUN pip install pipenv==2024.2.0

COPY Pipfile Pipfile.lock $APP_HOME
RUN pipenv sync --system --categories "packages"
Expand Down

0 comments on commit b9e19fb

Please sign in to comment.