def test_isMatch_statePersonAlias(self): alias = schema.StatePersonAlias(state_code=_STATE_CODE, full_name='full_name') alias_another = schema.StatePersonAlias(state_code=_STATE_CODE, full_name='full_name') self.assertTrue( _is_match(ingested_entity=alias, db_entity=alias_another)) alias_another.state_code = _STATE_CODE_ANOTHER self.assertFalse( _is_match(ingested_entity=alias, db_entity=alias_another))
def generate_test_person(person_id, sentence_groups, incarceration_period, agent, supervision_period) -> state_schema.StatePerson: """Returns a StatePerson to be used for testing.""" instance = state_schema.StatePerson( person_id=person_id, full_name='name', birthdate=datetime.date(1980, 1, 5), birthdate_inferred_from_age=False, external_ids=[ state_schema.StatePersonExternalId( person_external_id_id=234, external_id='person_external_id', id_type='STATE', state_code='us_ny', person_id=person_id, ) ], aliases=[ state_schema.StatePersonAlias( person_alias_id=1456, state_code='us_ca', full_name='name', person_id=person_id, ) ], races=[ state_schema.StatePersonRace( person_race_id=345, state_code='us_ca', race=Race.BLACK.value, race_raw_text='BLK', person_id=person_id, ) ], ethnicities=[ state_schema.StatePersonEthnicity( person_ethnicity_id=345, state_code='us_ca', ethnicity=Ethnicity.NOT_HISPANIC.value, ethnicity_raw_text='HISP', person_id=person_id, ) ], sentence_groups=sentence_groups, assessments=[ state_schema.StateAssessment( assessment_id=456, person_id=person_id, state_code='us_ca', incarceration_period=incarceration_period, conducting_agent=agent, ), state_schema.StateAssessment( assessment_id=4567, person_id=person_id, state_code='us_ca', supervision_period=supervision_period, conducting_agent=agent, ) ], program_assignments=[ state_schema.StateProgramAssignment( program_assignment_id=567, participation_status= StateProgramAssignmentParticipationStatus. PRESENT_WITHOUT_INFO.value, state_code='us_ca', referring_agent=agent, ) ] ) return instance
def generate_alias(**kwargs) -> schema.StatePersonAlias: args = { "state_code": _STATE_CODE, } args.update(kwargs) return schema.StatePersonAlias(**args)