care.facility.models.patient_sample module¶
- class PatientSample(id, external_id, created_date, modified_date, deleted, patient, consultation, sample_type, sample_type_other, has_sari, has_ari, doctor_name, diagnosis, diff_diagnosis, etiology_identified, is_atypical_presentation, atypical_presentation, is_unusual_course, icmr_category, icmr_label, status, result, fast_track, date_of_sample, date_of_result, testing_facility, created_by, last_edited_by)¶
Bases:
FacilityBaseModel
- SAMPLE_TEST_RESULT_MAP = {'AWAITING': 3, 'INVALID': 4, 'NEGATIVE': 2, 'POSITIVE': 1}¶
- SAMPLE_TEST_RESULT_CHOICES = [(1, 'POSITIVE'), (2, 'NEGATIVE'), (3, 'AWAITING'), (4, 'INVALID')]¶
- REVERSE_SAMPLE_TEST_RESULT_CHOICES = {1: 'POSITIVE', 2: 'NEGATIVE', 3: 'AWAITING', 4: 'INVALID'}¶
- PATIENT_ICMR_CATEGORY = [(0, 'Cat 0'), (10, 'Cat 1'), (20, 'Cat 2'), (30, 'Cat 3'), (40, 'Cat 4'), (50, 'Cat 5a'), (60, 'Cat 5b')]¶
- SAMPLE_TEST_FLOW_MAP = {'APPROVED': 2, 'COMPLETED': 7, 'DENIED': 3, 'RECEIVED_AND_FORWARED': 5, 'RECEIVED_AT_LAB': 6, 'REQUEST_SUBMITTED': 1, 'SENT_TO_COLLECTON_CENTRE': 4}¶
- SAMPLE_TEST_FLOW_CHOICES = [(1, 'REQUEST_SUBMITTED'), (2, 'APPROVED'), (3, 'DENIED'), (4, 'SENT_TO_COLLECTON_CENTRE'), (5, 'RECEIVED_AND_FORWARED'), (6, 'RECEIVED_AT_LAB'), (7, 'COMPLETED')]¶
- REVERSE_SAMPLE_TEST_FLOW_CHOICES = {1: 'REQUEST_SUBMITTED', 2: 'APPROVED', 3: 'DENIED', 4: 'SENT_TO_COLLECTON_CENTRE', 5: 'RECEIVED_AND_FORWARED', 6: 'RECEIVED_AT_LAB', 7: 'COMPLETED'}¶
- SAMPLE_FLOW_RULES = {'APPROVED': {'COMPLETED', 'RECEIVED_AND_FORWARED', 'RECEIVED_AT_LAB', 'SENT_TO_COLLECTON_CENTRE'}, 'COMPLETED': {'COMPLETED'}, 'DENIED': {'REQUEST_SUBMITTED'}, 'RECEIVED_AND_FORWARED': {'COMPLETED', 'RECEIVED_AT_LAB'}, 'RECEIVED_AT_LAB': {'COMPLETED'}, 'REQUEST_SUBMITTED': {'APPROVED', 'DENIED'}, 'SENT_TO_COLLECTON_CENTRE': {'COMPLETED', 'RECEIVED_AND_FORWARED', 'RECEIVED_AT_LAB'}}¶
- patient¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- consultation¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- sample_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- sample_type_other¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- has_sari¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- has_ari¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- doctor_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- diagnosis¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- diff_diagnosis¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- etiology_identified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_atypical_presentation¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- atypical_presentation¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_unusual_course¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- icmr_category¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- icmr_label¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- result¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- fast_track¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_of_sample¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_of_result¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- testing_facility¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- last_edited_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- CSV_MAPPING = {'date_of_result': 'Date of Result', 'date_of_sample': 'Date of Sample', 'patient__age': 'Patient Age', 'patient__name': 'Patient Name', 'patient__phone_number': 'Patient Phone Number', 'result': 'Result', 'sample_type': 'Type', 'sample_type_other': 'Other Type', 'status': 'Status', 'testing_facility__name': 'Testing Facility'}¶
- CSV_ANNOTATE_FIELDS = {'patient__age': PatientAgeFunc(Value('year'), Func(CASE WHEN <Q: (AND: ('patient__death_datetime__isnull', True))> THEN Now(), ELSE F(patient__death_datetime__date), Coalesce(F(patient__date_of_birth), Func(F(patient__year_of_birth), Value(1), Value(1), function=MAKE_DATE)), function=age))}¶
- CSV_MAKE_PRETTY = {'result': <function PatientSample.<lambda>>, 'sample_type': <function PatientSample.<lambda>>, 'status': <function PatientSample.<lambda>>}¶
- property flow¶
- static has_write_permission(request)¶
- static has_read_permission(request)¶
- static has_update_permission(request)¶
- has_object_read_permission(request)¶
- has_object_update_permission(request)¶
- has_object_destroy_permission(request)¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- consultation_id¶
- created_by_id¶
- created_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- external_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_icmr_category_display(*, field=<django.db.models.fields.IntegerField: icmr_category>)¶
- get_result_display(*, field=<django.db.models.fields.IntegerField: result>)¶
- get_sample_type_display(*, field=<django.db.models.fields.IntegerField: sample_type>)¶
- get_status_display(*, field=<django.db.models.fields.IntegerField: status>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_edited_by_id¶
- modified_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- patient_id¶
- patientsampleflow_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- testing_facility_id¶
- class PatientSampleFlow(id, external_id, created_date, modified_date, deleted, patient_sample, status, notes, created_by)¶
Bases:
FacilityBaseModel
- patient_sample¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- notes¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- created_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- created_by_id¶
- created_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deleted¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- external_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_status_display(*, field=<django.db.models.fields.IntegerField: status>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- modified_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- patient_sample_id¶