Skip to content

Commit

Permalink
Merge branch 'develop' into rithviknishad/feat/camera-presets
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Sep 20, 2024
2 parents e5041ce + 857fe7e commit 0a199fb
Show file tree
Hide file tree
Showing 71 changed files with 1,850 additions and 1,149 deletions.
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://raw.githubusercontent.com/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
146 changes: 82 additions & 64 deletions care/abdm/utils/fhir.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ def _procedure(self, procedure):
text=procedure["procedure"],
),
subject=self._reference(self._patient()),
performedDateTime=f"{procedure['time']}:00+05:30"
if not procedure["repetitive"]
else None,
performedString=f"Every {procedure['frequency']}"
if procedure["repetitive"]
else None,
performedDateTime=(
f"{procedure['time']}:00+05:30" if not procedure["repetitive"] else None
),
performedString=(
f"Every {procedure['frequency']}" if procedure["repetitive"] else None
),
)

self._procedure_profiles.append(procedure_profile)
Expand All @@ -213,9 +213,11 @@ def _careplan(self):
description="This includes Treatment Summary, Prescribed Medication, General Notes and Special Instructions",
period=Period(
start=self.consultation.encounter_date.isoformat(),
end=self.consultation.discharge_date.isoformat()
if self.consultation.discharge_date
else None,
end=(
self.consultation.discharge_date.isoformat()
if self.consultation.discharge_date
else None
),
),
note=[
Annotation(text=self.consultation.treatment_plan),
Expand Down Expand Up @@ -260,36 +262,46 @@ def _diagnostic_report(self):
return self._diagnostic_report_profile

def _observation(self, title, value, id, date):
if not value or (type(value) == dict and not value["value"]):
if not value or (isinstance(value, dict) and not value["value"]):
return

return Observation(
id=f"{id}.{title.replace(' ', '').replace('_', '-')}"
if id and title
else str(uuid()),
id=(
f"{id}.{title.replace(' ', '').replace('_', '-')}"
if id and title
else str(uuid())
),
status="final",
effectiveDateTime=date if date else None,
code=CodeableConcept(text=title),
valueQuantity=Quantity(value=str(value["value"]), unit=value["unit"])
if type(value) == dict
else None,
valueString=value if type(value) == str else None,
component=list(
map(
lambda component: ObservationComponent(
code=CodeableConcept(text=component["title"]),
valueQuantity=Quantity(
value=component["value"], unit=component["unit"]
)
if type(component) == dict
else None,
valueString=component if type(component) == str else None,
),
value,
valueQuantity=(
Quantity(value=str(value["value"]), unit=value["unit"])
if isinstance(value, dict)
else None
),
valueString=value if isinstance(value, str) else None,
component=(
list(
map(
lambda component: ObservationComponent(
code=CodeableConcept(text=component["title"]),
valueQuantity=(
Quantity(
value=component["value"], unit=component["unit"]
)
if isinstance(component, dict)
else None
),
valueString=(
component if isinstance(component, str) else None
),
),
value,
)
)
)
if type(value) == list
else None,
if isinstance(value, list)
else None
),
)

def _observations_from_daily_round(self, daily_round):
Expand Down Expand Up @@ -322,20 +334,22 @@ def _observations_from_daily_round(self, daily_round):
),
self._observation(
"Blood Pressure",
[
{
"title": "Systolic Blood Pressure",
"value": daily_round.bp["systolic"],
"unit": "mmHg",
},
{
"title": "Diastolic Blood Pressure",
"value": daily_round.bp["diastolic"],
"unit": "mmHg",
},
]
if "systolic" in daily_round.bp and "diastolic" in daily_round.bp
else None,
(
[
{
"title": "Systolic Blood Pressure",
"value": daily_round.bp["systolic"],
"unit": "mmHg",
},
{
"title": "Diastolic Blood Pressure",
"value": daily_round.bp["diastolic"],
"unit": "mmHg",
},
]
if "systolic" in daily_round.bp and "diastolic" in daily_round.bp
else None
),
id,
date,
),
Expand Down Expand Up @@ -369,21 +383,23 @@ def _encounter(self, include_diagnosis=False):
"class": Coding(code="IMP", display="Inpatient Encounter"),
"subject": self._reference(self._patient()),
"period": Period(start=period_start, end=period_end),
"diagnosis": list(
map(
lambda consultation_diagnosis: EncounterDiagnosis(
condition=self._reference(
self._condition(
consultation_diagnosis.diagnosis_id,
consultation_diagnosis.verification_status,
),
)
),
self.consultation.diagnoses.all(),
"diagnosis": (
list(
map(
lambda consultation_diagnosis: EncounterDiagnosis(
condition=self._reference(
self._condition(
consultation_diagnosis.diagnosis_id,
consultation_diagnosis.verification_status,
),
)
),
self.consultation.diagnoses.all(),
)
)
)
if include_diagnosis
else None,
if include_diagnosis
else None
),
}
)

Expand Down Expand Up @@ -655,10 +671,12 @@ def _immunization_composition(self):
else []
)
],
emptyReason=None
if self._immunization()
else CodeableConcept(
coding=[Coding(code="notasked", display="Not Asked")]
emptyReason=(
None
if self._immunization()
else CodeableConcept(
coding=[Coding(code="notasked", display="Not Asked")]
)
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""

from django.conf import settings
from django.db import migrations

Expand Down
Loading

0 comments on commit 0a199fb

Please sign in to comment.