Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Backend
Commits
06e53029
Commit
06e53029
authored
Apr 20, 2020
by
Dave Nathanael
Browse files
Add additional fields and filter fields for MonitoringCase
parent
5643a532
Changes
8
Hide whitespace changes
Inline
Side-by-side
apps/accounts/tests/test_units/test_accounts.py
View file @
06e53029
...
...
@@ -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
...
...
apps/cases/filters.py
View file @
06e53029
...
...
@@ -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"
,
)
apps/cases/migrations/0009_auto_20200420_2255.py
0 → 100644
View file @
06e53029
# 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
),
),
]
apps/cases/migrations/0010_auto_20200420_2300.py
0 → 100644
View file @
06e53029
# 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
),
),
]
apps/cases/models.py
View file @
06e53029
...
...
@@ -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
,
...
...
apps/cases/serializers.py
View file @
06e53029
...
...
@@ -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
):
...
...
apps/cases/tests/test_units/test_investigation_cases.py
View file @
06e53029
...
...
@@ -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
(
...
...
apps/cases/tests/test_units/test_monitoring_cases.py
View file @
06e53029
...
...
@@ -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
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment