Skip to content

Commit

Permalink
Merge branch 'develop' into sainak/feat/new-asset-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshhari authored Aug 30, 2024
2 parents 1566259 + 92f717e commit 112663d
Show file tree
Hide file tree
Showing 43 changed files with 1,029 additions and 779 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
* @coronasafe/care-developers
*.yml @tomahawk-pilot @mathew-alex
* @ohcnetwork/care-developers
*.yml @tomahawk-pilot
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

_*Only PR's with test cases included and passing lint and test pipelines will be reviewed*_

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins
@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

jobs:
build-docs:
if: github.repository == 'coronasafe/care'
if: github.repository == 'ohcnetwork/care'
name: Build docs
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
retention-days: 30

deploy-docs:
if: github.repository == 'coronasafe/care' && github.ref == 'refs/heads/develop'
if: github.repository == 'ohcnetwork/care' && github.ref == 'refs/heads/develop'
name: Deploy docs
runs-on: ubuntu-latest
needs: build-docs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/issue-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ jobs:
issue_opened_and_reopened:
name: issue_opened_and_reopened
runs-on: ubuntu-latest
if: github.repository == 'coronasafe/care' && github.event_name == 'issues' && github.event.action == 'opened' || github.event.action == 'reopened'
if: github.repository == 'ohcnetwork/care' && github.event_name == 'issues' && github.event.action == 'opened' || github.event.action == 'reopened'
steps:
- name: 'Move issue to "Triage"'
uses: leonsteinhaeuser/project-beta-automations@v1.0.1
with:
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
organization: coronasafe
organization: ohcnetwork
project_id: 4
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Triage"
issue_closed:
name: issue_closed
runs-on: ubuntu-latest
if: github.repository == 'coronasafe/care' && github.event_name == 'issues' && github.event.action == 'closed'
if: github.repository == 'ohcnetwork/care' && github.event_name == 'issues' && github.event.action == 'closed'
steps:
- name: 'Moved issue to "Done"'
uses: leonsteinhaeuser/project-beta-automations@v1.0.1
with:
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
organization: coronasafe
organization: ohcnetwork
project_id: 4
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Done"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Any support is welcome. You could help by writing documentation, pull-requests,

### Getting Started

An issue wih the [good first](https://github.com/coronasafe/care/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22) or [help wanted](https://github.com/coronasafe/care/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22help+wanted%22+is%3Aopen) label might be a good place to start with.
An issue wih the [good first](https://github.com/ohcnetwork/care/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22) or [help wanted](https://github.com/ohcnetwork/care/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22help+wanted%22+is%3Aopen) label might be a good place to start with.

### Setting up the development environment

Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build, re-build, up, down, list, logs, test, makemigrations
.PHONY: build, re-build, up, down, list, logs, test, makemigrations, reset_db


DOCKER_VERSION := $(shell docker --version 2>/dev/null)
Expand Down Expand Up @@ -47,3 +47,10 @@ test-coverage:
docker compose exec backend bash -c "coverage run manage.py test --settings=config.settings.test --keepdb --parallel --shuffle"
docker compose exec backend bash -c "coverage combine || true; coverage xml"
docker compose cp backend:/app/coverage.xml coverage.xml

reset_db:
docker compose exec backend bash -c "python manage.py reset_db --noinput"
docker compose exec backend bash -c "python manage.py migrate"

%:
docker compose exec backend bash -c "python manage.py $*"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
</a>
</p>

[![Deploy Care](https://github.com/coronasafe/care/actions/workflows/deployment.yaml/badge.svg)](https://github.com/coronasafe/care/actions/workflows/deployment.yaml)
[![Deploy Care](https://github.com/ohcnetwork/care/actions/workflows/deployment.yaml/badge.svg)](https://github.com/ohcnetwork/care/actions/workflows/deployment.yaml)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Cookiecutter Django](https://img.shields.io/badge/built%20with-Cookiecutter%20Django-ff69b4.svg)](https://github.com/pydanny/cookiecutter-django/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Chat](https://img.shields.io/badge/-Join%20us%20on%20slack-7b1c7d?logo=slack)](https://slack.coronasafe.in/)
[![Open in Dev Containers](https://img.shields.io/static/v1?label=&message=Open%20in%20Dev%20Containers&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/coronasafe/care)
[![Chat](https://img.shields.io/badge/-Join%20us%20on%20slack-7b1c7d?logo=slack)](https://slack.ohc.network/)
[![Open in Dev Containers](https://img.shields.io/static/v1?label=&message=Open%20in%20Dev%20Containers&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/ohcnetwork/care)

This is the backend for care. an open source platform for managing patients, health workers, and hospitals.

Expand Down Expand Up @@ -70,7 +70,7 @@ make load-dummy-data
#### Docker
Prebuilt docker images for server deployments are available
on [ghcr](https://github.com/coronasafe/care/pkgs/container/care)
on [ghcr](https://github.com/ohcnetwork/care/pkgs/container/care)
## Contributing
Expand Down
30 changes: 15 additions & 15 deletions care/facility/api/serializers/patient_consultation.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,11 @@ class Meta:
"created_by",
"kasp_enabled_date",
"is_readmission",
"deprecated_diagnosis",
"deprecated_verified_by",
)
exclude = (
"deleted",
"external_id",
"deprecated_icd11_provisional_diagnoses",
"deprecated_icd11_diagnoses",
"deprecated_icd11_principal_diagnosis",
)

def validate_bed_number(self, bed_number):
Expand Down Expand Up @@ -613,32 +609,36 @@ def validate(self, attrs):
{"patient_no": "This field is required for admission."}
)

if (
"suggestion" in validated
and validated["suggestion"] != SuggestionChoices.DD
):
if "treating_physician" not in validated:
if "suggestion" in validated and validated["suggestion"] not in [
SuggestionChoices.DD,
SuggestionChoices.DC,
]:
treating_physician = validated.get("treating_physician")
if not treating_physician:
raise ValidationError(
{
"treating_physician": [
"This field is required as the suggestion is not 'Declared Death'"
]
}
)
if (
not validated["treating_physician"].user_type
== User.TYPE_VALUE_MAP["Doctor"]
):
if not treating_physician.user_type == User.TYPE_VALUE_MAP["Doctor"]:
raise ValidationError("Only Doctors can verify a Consultation")

facility = (
self.instance
and self.instance.facility
or validated["patient"].facility
)
# Check if the Doctor is associated with the Facility (.facilities)
if not treating_physician.facilities.filter(id=facility.id).exists():
raise ValidationError(
"The treating doctor is no longer linked to this facility. Please update the respective field in the form before proceeding."
)

if (
validated["treating_physician"].home_facility
and validated["treating_physician"].home_facility != facility
treating_physician.home_facility
and treating_physician.home_facility != facility
):
raise ValidationError(
"Home Facility of the Doctor must be the same as the Consultation Facility"
Expand Down
60 changes: 60 additions & 0 deletions care/facility/migrations/0450_corrections_for_io_balance_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated by Django 4.2.10 on 2024-08-20 12:38

from django.core.paginator import Paginator
from django.db import migrations


class Migration(migrations.Migration):
"""
Migration to correct the entries with spelling mistake for "Rules Tube Aspiration"
to "Ryles Tube Aspiration" in both DailyRound's output JSONField.
"""

dependencies = [
("facility", "0449_merge_20240822_1343"),
]

def forward_rename_dailyround_entries(apps, schema_editor):
DailyRound = apps.get_model("facility", "DailyRound")

paginator = Paginator(
DailyRound.objects.filter(
output__contains=[{"name": "Rules Tube Aspiration"}]
).order_by("id"),
1000,
)

for page_number in paginator.page_range:
bulk = []
for instance in paginator.page(page_number).object_list:
for entry in instance.output:
if entry["name"] == "Rules Tube Aspiration":
entry["name"] = "Ryles Tube Aspiration"
bulk.append(instance)
DailyRound.objects.bulk_update(bulk, ["output"])

def reverse_rename_dailyround_entries(apps, schema_editor):
DailyRound = apps.get_model("facility", "DailyRound")

paginator = Paginator(
DailyRound.objects.filter(
output__contains=[{"name": "Ryles Tube Aspiration"}]
).order_by("id"),
1000,
)

for page_number in paginator.page_range:
bulk = []
for instance in paginator.page(page_number).object_list:
for entry in instance.output:
if entry["name"] == "Ryles Tube Aspiration":
entry["name"] = "Rules Tube Aspiration"
bulk.append(instance)
DailyRound.objects.bulk_update(bulk, ["output"])

operations = [
migrations.RunPython(
forward_rename_dailyround_entries,
reverse_code=reverse_rename_dailyround_entries,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Generated by Django 4.2.10 on 2024-08-23 10:57

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("facility", "0451_merge_20240823_1642"),
]

operations = [
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_diagnosis",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_icd11_diagnoses",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_icd11_principal_diagnosis",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_icd11_provisional_diagnoses",
),
migrations.RemoveField(
model_name="patientconsultation",
name="discharge_advice",
),
migrations.RemoveField(
model_name="patientconsultation",
name="discharge_prescription",
),
migrations.RemoveField(
model_name="patientconsultation",
name="discharge_prn_prescription",
),
migrations.RemoveField(
model_name="patientconsultation",
name="prn_prescription",
),
migrations.RemoveField(
model_name="dailyround",
name="deprecated_additional_symptoms",
),
migrations.RemoveField(
model_name="dailyround",
name="deprecated_other_symptoms",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_other_symptoms",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_symptoms",
),
migrations.RemoveField(
model_name="patientconsultation",
name="deprecated_symptoms_onset_date",
),
]
13 changes: 13 additions & 0 deletions care/facility/migrations/0453_merge_20240824_2040.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 4.2.10 on 2024-08-24 15:10

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("facility", "0450_corrections_for_io_balance_fields"),
("facility", "0452_remove_patientconsultation_deprecated_diagnosis_and_more"),
]

operations = []
11 changes: 0 additions & 11 deletions care/facility/models/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from django.db import models
from django.db.models import JSONField
from django.shortcuts import get_object_or_404
from multiselectfield import MultiSelectField
from multiselectfield.utils import get_max_length

from care.facility.models import (
CATEGORY_CHOICES,
Expand All @@ -25,7 +23,6 @@
PAIN_SCALE_ENHANCED,
PRESSURE_SORE,
)
from care.facility.models.patient_base import SYMPTOM_CHOICES
from care.facility.models.patient_consultation import PatientConsultation
from care.users.models import User
from care.utils.models.validators import JSONFieldSchemaValidator
Expand Down Expand Up @@ -141,14 +138,6 @@ class InsulinIntakeFrequencyType(enum.Enum):
max_digits=4, decimal_places=2, blank=True, null=True, default=None
)
physical_examination_info = models.TextField(null=True, blank=True)
deprecated_additional_symptoms = MultiSelectField(
choices=SYMPTOM_CHOICES,
default=1,
null=True,
blank=True,
max_length=get_max_length(SYMPTOM_CHOICES, None),
) # Deprecated
deprecated_other_symptoms = models.TextField(default="", blank=True) # Deprecated
deprecated_covid_category = models.CharField(
choices=COVID_CATEGORY_CHOICES,
max_length=8,
Expand Down
Loading

0 comments on commit 112663d

Please sign in to comment.