Fakultas Ilmu Komputer UI

Commit b1861cc9 authored by Dave Nathanael's avatar Dave Nathanael
Browse files

Merge branch 'dave/add-more-filters-and-field' into 'staging'

Add additional fields and filter fields for MonitoringCase

See merge request !40
parents 5643a532 06e53029
Pipeline #42113 passed with stages
in 9 minutes and 1 second
......@@ -218,7 +218,6 @@ class AccountViewTest(APITestCase):
self.assertEqual(account_history_current_count, account_history_prev_count + 1)
self.assertEqual(account_deleted_current_count, account_deleted_prev_count + 1)
def test_retrieve_current_profile_success(self):
url = self.PROFILE_URL
......
......@@ -102,30 +102,74 @@ INVESTIGATION_CASE_ORDERING_FIELDS = (
)
MONITORING_CASE_FILTERSET_FIELDS = (
"investigation_case__case_subject__name",
"investigation_case__case_subject__age",
"investigation_case__case_subject__is_male",
"investigation_case__case_subject__address",
"investigation_case__case_subject__district",
"investigation_case__case_subject__sub_district",
"investigation_case__reference_case__case_relation",
"investigation_case__reference_case__medical_symptoms",
"investigation_case__reference_case__risk_factors",
"investigation_case__reference_case__is_referral_needed",
"investigation_case__reference_case__medical_facility_reference",
"investigation_case__reference_case__outcome",
"is_referred",
"is_checked",
"is_medicated",
"regular_medicine_intake",
"treatment_start_date",
"treatment_end_date",
"medication_outcome",
"author__name",
"created_at",
)
MONITORING_CASE_SEARCH_FIELDS = (
"investigation_case__case_subject__name",
"investigation_case__case_subject__age",
"investigation_case__case_subject__address",
"investigation_case__case_subject__district",
"investigation_case__case_subject__sub_district",
"investigation_case__case_subject__created_at",
"investigation_case__reference_case__case_relation",
"investigation_case__reference_case__medical_symptoms",
"investigation_case__reference_case__risk_factors",
"investigation_case__reference_case__medical_facility_reference",
"investigation_case__reference_case__outcome",
"investigation_case__reference_case__created_at",
"is_referred",
"is_checked",
"is_medicated",
"regular_medicine_intake",
"treatment_start_date",
"treatment_end_date",
"medication_outcome",
"author__name",
)
MONITORING_CASE_ORDERING_FIELDS = (
"investigation_case__case_subject__name",
"investigation_case__case_subject__age",
"investigation_case__case_subject__is_male",
"investigation_case__case_subject__address",
"investigation_case__case_subject__district",
"investigation_case__case_subject__sub_district",
"investigation_case__case_subject__created_at",
"investigation_case__reference_case__case_relation",
"investigation_case__reference_case__medical_symptoms",
"investigation_case__reference_case__risk_factors",
"investigation_case__reference_case__is_referral_needed",
"investigation_case__reference_case__medical_facility_reference",
"investigation_case__reference_case__outcome",
"investigation_case__reference_case__created_at",
"is_referred",
"is_checked",
"is_medicated",
"regular_medicine_intake",
"treatment_start_date",
"treatment_end_date",
"medication_outcome",
"author__name",
"created_at",
)
# Generated by Django 3.0.1 on 2020-04-20 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0008_auto_20200419_0156'),
]
operations = [
migrations.AddField(
model_name='monitoringcase',
name='is_medicated',
field=models.BooleanField(blank=True, db_index=True, null=True),
),
migrations.AddField(
model_name='monitoringcasehistory',
name='is_medicated',
field=models.BooleanField(blank=True, db_index=True, null=True),
),
]
# Generated by Django 3.0.1 on 2020-04-20 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0009_auto_20200420_2255'),
]
operations = [
migrations.AddField(
model_name='monitoringcase',
name='medication_outcome',
field=models.CharField(blank=True, max_length=256, null=True),
),
migrations.AddField(
model_name='monitoringcasehistory',
name='medication_outcome',
field=models.CharField(blank=True, max_length=256, null=True),
),
]
......@@ -155,9 +155,11 @@ class MonitoringCaseHistory(HistoryModel):
investigation_case_id = models.UUIDField(blank=True, null=True)
is_referred = models.BooleanField(blank=True, null=True, db_index=True)
is_checked = models.BooleanField(blank=True, null=True, db_index=True)
is_medicated = models.BooleanField(blank=True, null=True, db_index=True)
regular_medicine_intake = models.TextField(default="[]")
treatment_start_date = models.DateField(blank=True, null=True)
treatment_end_date = models.DateField(blank=True, null=True)
medication_outcome = models.CharField(max_length=256, blank=True, null=True)
author = models.ForeignKey(
Account,
blank=True,
......@@ -186,9 +188,11 @@ class MonitoringCase(HistoryEnabledModel):
)
is_referred = models.BooleanField(blank=True, null=True, db_index=True)
is_checked = models.BooleanField(blank=True, null=True, db_index=True)
is_medicated = models.BooleanField(blank=True, null=True, db_index=True)
regular_medicine_intake = models.TextField(default="[]")
treatment_start_date = models.DateField(blank=True, null=True)
treatment_end_date = models.DateField(blank=True, null=True)
medication_outcome = models.CharField(max_length=256, blank=True, null=True)
author = models.ForeignKey(
Account,
blank=True,
......
......@@ -106,9 +106,11 @@ class MonitoringCaseSummarySerializer(serializers.ModelSerializer):
"investigation_case",
"is_referred",
"is_checked",
"is_medicated",
"regular_medicine_intake",
"treatment_start_date",
"treatment_end_date",
"medication_outcome",
"author",
]
......@@ -122,9 +124,11 @@ class MonitoringCaseSerializer(serializers.ModelSerializer):
"investigation_case",
"is_referred",
"is_checked",
"is_medicated",
"regular_medicine_intake",
"treatment_start_date",
"treatment_end_date",
"medication_outcome",
]
def save(self):
......
......@@ -237,7 +237,9 @@ class InvestigationCaseViewTest(APITestCase):
investigation_case_deleted_current_count = InvestigationCase.objects.deleted().count()
self.assertEqual(investigation_case_current_count, investigation_case_prev_count - 1)
self.assertEqual(investigation_case_deleted_current_count, investigation_case_deleted_prev_count + 1)
self.assertEqual(
investigation_case_deleted_current_count,
investigation_case_deleted_prev_count + 1)
# New InvestigationCaseHistory added
self.assertEqual(
......
......@@ -93,6 +93,8 @@ class MonitoringCaseViewTest(APITestCase):
"investigation_case": str(self.positive_investigation_case.id),
"is_referred": True,
"is_checked": False,
"is_medicated": False,
"medication_outcome": "",
"regular_medicine_intake": "[]",
"treatment_start_date": "1111-11-11",
"treatment_end_date": "1111-11-12"
......@@ -153,7 +155,8 @@ class MonitoringCaseViewTest(APITestCase):
monitoring_case_deleted_current_count = MonitoringCase.objects.deleted().count()
self.assertEqual(monitoring_case_current_count, monitoring_case_prev_count - 1)
self.assertEqual(monitoring_case_deleted_current_count, monitoring_case_deleted_prev_count + 1)
self.assertEqual(monitoring_case_deleted_current_count,
monitoring_case_deleted_prev_count + 1)
# New MonitoringCaseHistory added
self.assertEqual(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment