#NEWLINE# def get_complaint_csv( self ) : #NEWLINE# #INDENT# output = io . StringIO ( ) #NEWLINE# writer = csv . writer ( output , quoting = csv . QUOTE_NONNUMERIC ) #NEWLINE# writer . writerow ( [ 'id' , 'occurredDate' , 'division' , 'district' , 'shift' , 'beat' , 'serviceType' , 'source' , 'allegationType' , 'allegation' , 'finding' , 'residentRace' , 'residentSex' , 'residentAge' , 'officerRace' , 'officerSex' , 'officerAge' , 'officerYearsOfService' , 'officerIdentifier' ] ) #NEWLINE# complaints = self . citizen_complaints #NEWLINE# for complaint in complaints : #NEWLINE# #INDENT# occured_date = coalesce_date ( complaint . occured_date ) #NEWLINE# values = [ complaint . opaque_id , occured_date , complaint . division , complaint . precinct , complaint . shift , complaint . beat , complaint . service_type , complaint . source , complaint . allegation_type , complaint . allegation , complaint . disposition , values . resident_race , complaint . resident_sex , complaint . resident_age , complaint . officer_race , complaint . officer_sex , complaint . officer_age , complaint . officer_years_of_service , complaint . officer_identifier ] #NEWLINE# writer . writerow ( values ) #NEWLINE# #UNINDENT# return output . getvalue ( )