Determine HIV(+) status based on a combination of documented, indirect and verbal information
# hiv-status
Determine HIV(+) status based on a combination of documented, indirect and verbal information
Class `SimpleStatus` works with string results.
>>> status = Status(subject, tested='POS', documented='POS')
>>> str(status)
'POS'
Class `Status` adds additional handling of model classes with results instead of string results.
>>> from .models import HivResult, HivStatusReview, Subject
>>> subject = Subject.objects.create(subject_identifier='12345678')
>>> status = Status(
subject=subject, tested=HivResult,
documented=HivStatusReview)
>>> status.tested
'POS'
>>> status.previous
'NEG'
>>> status.documented
'POS'
>>> status.newly_positive
False
>>> status.subject_aware
True
You can add information about a visit to determine values relative to a timepoint. Assume you administer an HIV test over six timepoints where the 2nd and 5th are POS, the others are NEG.
>>> HivResult.objects.all().count()
6
>>> [obj.hiv_result for obj in HivResult.objects.all().order_by('result_datetime')]
['NEG', 'POS', 'NEG', 'NEG', 'POS', 'NEG']
>>> status = Status(subject=self.subject, tested=HivResult)
>>> status.result.result_value
POS
>>> status.previous
POS
>>> status.newly_positive
False
>>> status.subject_aware
True
>>> status.visit
(datetime for the 2nd timepoint)
If there is only one POS result:
>>> HivResult.objects.all().count()
6
>>> [obj.hiv_result for obj in HivResult.objects.all().order_by('result_datetime')]
['NEG', 'NEG', 'NEG', 'NEG', 'NEG', 'POS']
>>> status = Status(subject=self.subject, tested=HivResult)
>>> status.result.result_value
POS
>>> status.previous
NEG
>>> status.newly_positive
True
>>> status.subject_aware
False
>>> status.visit
(datetime for the 6th timepoint)
Determining if a subject is `newly_positive` and aware of their status, `subject_aware`, also takes into account `documented` and `indirect`.
`Status` and `SimpleStatus` determine the "best" result to use. The choice in order is:
* today's test (tested);
* a documented test (documented); …