def test_characteristics_dict_program_referral_event(self): program_referral_event = ProgramReferralEvent( state_code='US_ND', program_id='XXX', event_date=date(2009, 10, 1), supervision_type=StateSupervisionType.PAROLE, participation_status=StateProgramAssignmentParticipationStatus. IN_PROGRESS, assessment_score=23, assessment_type=StateAssessmentType.LSIR, supervising_officer_external_id='OFFICER', supervising_district_external_id='DISTRICT', ) characteristic_dict = calculator.characteristics_dict( self.person, program_referral_event) expected_output = { 'program_id': 'XXX', 'age_bucket': '25-29', 'gender': Gender.FEMALE, 'race': [Race.WHITE], 'ethnicity': [Ethnicity.NOT_HISPANIC], 'person_id': 12345, 'supervision_type': StateSupervisionType.PAROLE, 'participation_status': StateProgramAssignmentParticipationStatus.IN_PROGRESS, 'assessment_score_bucket': '0-23', 'assessment_type': StateAssessmentType.LSIR, 'supervising_officer_external_id': 'OFFICER', 'supervising_district_external_id': 'DISTRICT' } self.assertEqual(expected_output, characteristic_dict)
def test_characteristics_dict_program_participation_event(self): program_participation_event = ProgramParticipationEvent( state_code='US_ND', program_id='XXX', program_location_id='YYY', event_date=date(2009, 10, 1), supervision_type=StateSupervisionType.PAROLE, ) characteristic_dict = calculator.characteristics_dict(self.person, program_participation_event, ProgramParticipationMetric, _DEFAULT_PERSON_METADATA) expected_output = { 'date_of_participation': program_participation_event.event_date, 'program_id': 'XXX', 'age_bucket': '25-29', 'gender': Gender.FEMALE, 'race': [Race.WHITE, Race.BLACK], 'ethnicity': [Ethnicity.NOT_HISPANIC], 'person_id': 12345, 'supervision_type': StateSupervisionType.PAROLE, 'program_location_id': 'YYY', 'prioritized_race_or_ethnicity': _DEFAULT_PERSON_METADATA.prioritized_race_or_ethnicity } self.assertEqual(expected_output, characteristic_dict)
def test_characteristics_dict_program_event(self): program_event = ProgramEvent(state_code='US_ND', program_id='XXX', event_date=date(2009, 10, 1)) characteristic_dict = calculator.characteristics_dict( self.person, program_event) expected_output = { 'program_id': 'XXX', 'age_bucket': '25-29', 'gender': Gender.FEMALE, 'race': [Race.WHITE], 'ethnicity': [Ethnicity.NOT_HISPANIC], 'person_id': 12345 } self.assertEqual(expected_output, characteristic_dict)