def __init__(self, *args, **kwargs): super(UnitChangeNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('officer_id'), 'date_sort': get('effective_date'), 'priority_sort': literal(20), 'date': get_date('effective_date'), 'kind': literal('UNIT_CHANGE'), 'unit_name': get('unit_name'), 'unit_description': get('unit_description'), 'rank': get('rank') }
def __init__(self, *args, **kwargs): super(RankChangeNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('officer_id'), 'date_sort': get('spp_date'), 'priority_sort': literal(25), 'date': get_date('spp_date'), 'kind': literal('RANK_CHANGE'), 'unit_name': get('unit_name', ''), 'unit_description': get('unit_description', ''), 'rank': get('rank') }
def __init__(self, *args, **kwargs): super(JoinedNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('id'), 'date_sort': get('appointed_date'), 'priority_sort': literal(10), 'date': get_date('appointed_date'), 'kind': literal('JOINED'), 'unit_name': get('unit_name'), 'unit_description': get('unit_description'), 'rank': get('rank') }
def __init__(self, *args, **kwargs): super(AwardNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('officer_id'), 'date_sort': get('start_date'), 'priority_sort': literal(40), 'date': get_date('start_date'), 'kind': literal('AWARD'), 'award_type': get('award_type'), 'unit_name': get('unit_name'), 'unit_description': get('unit_description'), 'rank': get('rank') }
def __init__(self, *args, **kwargs): super(TRRNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'trr_id': get('id'), 'officer_id': get('officer_id'), 'date_sort': self.get_date_sort, 'priority_sort': literal(50), 'date': get_date('trr_datetime'), 'kind': literal('FORCE'), 'taser': get('taser'), 'firearm_used': get('firearm_used'), 'unit_name': get('unit_name'), 'unit_description': get('unit_description'), 'rank': get('rank'), 'point': get_point('point') }
def __init__(self, *args, **kwargs): super(CRNewTimelineSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('officer_id'), 'date_sort': self._get_date_sort, 'priority_sort': literal(30), 'date': get_date('incident_date'), 'kind': literal('CR'), 'crid': get('crid'), 'category': get('allegation_category__category'), 'subcategory': get('allegation_category__allegation_name'), 'finding': get_finding('final_finding', 'Unknown'), 'outcome': get('final_outcome'), 'coaccused': get('annotated_coaccused_count'), 'unit_name': get('unit_name', ''), 'unit_description': get('unit_description', ''), 'rank': get('rank'), 'victims': _VictimSerializer('victims'), 'attachments': _AttachmentSerializer('attachments'), 'point': get_point('point') }
def __init__(self, *args, **kwargs): super(InvestigatorSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('investigator__officer_id'), 'involved_type': literal('investigator'), 'full_name': self.get_full_name, 'abbr_name': self.get_abbr_name, 'percentile_allegation': get('investigator__officer__complaint_percentile'), 'percentile_allegation_civilian': get('investigator__officer__civilian_allegation_percentile'), 'percentile_allegation_internal': get('investigator__officer__internal_allegation_percentile'), 'percentile_trr': get('investigator__officer__trr_percentile'), 'num_cases': get('num_cases'), 'current_rank': get('current_rank') }
def __init__(self, *args, **kwargs): super(PoliceWitnessSerializer, self).__init__(*args, **kwargs) self._fields = { 'officer_id': get('officer_id'), 'involved_type': literal('police_witness'), 'full_name': self.get_full_name, 'abbr_name': self.get_abbr_name, 'allegation_count': get('allegation_count'), 'sustained_count': get('sustained_count'), 'gender': get_gender('officer__gender'), 'race': get('officer__race'), 'percentile_allegation': get('officer__complaint_percentile'), 'percentile_allegation_civilian': get('officer__civilian_allegation_percentile'), 'percentile_allegation_internal': get('officer__internal_allegation_percentile'), 'percentile_trr': get('officer__trr_percentile') }
def test_literal(self): expect(literal('string')({})).to.eq('string') expect(literal(123)({})).to.eq(123)