def get_sendtoapplicant_event(self, licence, events_etape, events_param, licence_children): for id, event in events_etape.iterrows(): event_dict = get_event_dict() event_dict['title'] = 'Envoyé au demandeur' event_dict['type'] = 'sendtoapplicant' event_dict['eventDate'] = event.ETAPE_DATEDEPART licence_children.append(event_dict)
def get_not_receivable_event(self, licence, events_param, licence_dict): if licence.STATUT == 2: event_dict = get_event_dict() event_dict['title'] = 'Non recevable' event_dict['type'] = 'not_receivable' event_dict['event_id'] = main_licence_not_receivable_event_id_mapping[licence_dict['portalType']] # event_dict['eventDate'] = licence.DATE_STATUT licence_dict['__children__'].append(event_dict)
def get_sendtofd_event(self, licence, events_etape, events_param, licence_children): for id, event in events_etape.iterrows(): event_dict = get_event_dict() event_dict['title'] = 'Envoyé au FD' event_dict['type'] = 'sendtofd' event_dict['event_id'] = 'transmis-1er-dossier-rw' event_dict['eventDate'] = event.ETAPE_DATEDEPART licence_children.append(event_dict)
def get_incompletefolder_event(self, licence, events_etape, events_param, licence_children): for id, event in events_etape.iterrows(): event_dict = get_event_dict() event_dict['title'] = 'Dossier incomplet' event_dict['type'] = 'incompletefolder' event_dict['event_id'] = 'dossier-incomplet' event_dict['eventDate'] = event.ETAPE_DATEDEPART licence_children.append(event_dict)
def get_recepisse_event(self, licence, events_param, licence_dict): event_dict = get_event_dict() event_dict['title'] = 'Récépissé' event_dict['type'] = 'recepisse' event_dict['event_id'] = main_licence_deposit_event_id_mapping[licence_dict['portalType']] event_dict['eventPortalType'] = 'UrbanEvent' if licence_dict['portalType'] == "Division": event_dict['eventDate'] = licence.DATE_DEMANDE else: event_dict['eventDate'] = licence.DATE_RECEPISSE if self.verify_date_pattern.match(event_dict['eventDate']): licence_dict['__children__'].append(event_dict)
def get_recepisse_event(self, licence, events_param, licence_dict): event_dict = get_event_dict() event_dict['title'] = 'Récépissé' event_dict['type'] = 'recepisse' event_dict['event_id'] = main_licence_deposit_event_id_mapping[licence_dict['portalType']] event_dict['eventPortalType'] = 'UrbanEvent' if licence.DOSSIER_DATEDEPART: event_dict['eventDate'] = str(licence.DOSSIER_DATEDEPART)[0:10] elif licence.DOSSIER_DATEDEPOT: event_dict['eventDate'] = str(licence.DOSSIER_DATEDEPOT)[0:10] else: return licence_dict['__children__'].append(event_dict)
def get_decision_event(self, licence, events_param, licence_dict): event_dict = get_event_dict() event_dict['title'] = 'Événement décisionnel' event_dict['event_id'] = main_licence_decision_event_id_mapping[licence_dict['portalType']] licence_dict['wf_state'] = state_mapping.get(licence.DOSSIER_OCTROI) if licence_dict['wf_state']: self.licence_description.append({'Précision décision': decision_label_mapping.get(licence_dict['wf_state'])}) # CODT licences need a transition if licence_dict['portalType'].startswith("CODT_") and licence_dict['wf_state']: if licence_dict['wf_state'] == 'accept': licence_dict['wf_transition'] = 'accepted' elif licence_dict['wf_state'] == 'refuse': licence_dict['wf_transition'] = 'refused' elif licence_dict['wf_state'] == 'retire': licence_dict['wf_transition'] = 'retired' licence_dict['wf_state'] = '' if licence.DOSSIER_DATEDELIV: event_dict['eventDate'] = str(licence.DOSSIER_DATEDELIV)[0:10] event_dict['decisionDate'] = str(licence.DOSSIER_DATEDELIV)[0:10] licence_dict['__children__'].append(event_dict)
def get_decision_event(self, licence, events_param, licence_dict): event_dict = get_event_dict() event_dict['title'] = 'Événement décisionnel' event_dict['type'] = 'decision' event_dict['event_id'] = main_licence_decision_event_id_mapping[licence_dict['portalType']] if licence.STATUT == 1: # event_dict['decision'] = main_licence_decision_mapping['OctroiCollege'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Octroi Collège"}) elif licence.STATUT == 2: # event_dict['decision'] = main_licence_decision_mapping['RefusCollege'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus Collège"}) elif licence.STATUT == 3: # event_dict['decision'] = main_licence_decision_mapping['RefusTutelle'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus Tutelle"}) elif licence.STATUT == 4: # event_dict['decision'] = main_licence_decision_mapping['OctroiTutelle'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Octroi Tutelle"}) elif licence.STATUT == 5: # event_dict['decision'] = main_licence_decision_mapping['RefusFD'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus par le FD"}) elif licence.STATUT == 6: # event_dict['decision'] = main_licence_decision_mapping['RefusCollege'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus Collège (2)"}) elif licence.STATUT == 7: # event_dict['decision'] = main_licence_decision_mapping['OctroiCollege'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Autorisation Collège, retrait puis nouvelle autorisation"}) elif licence.STATUT == 8: # event_dict['decision'] = main_licence_decision_mapping['Irrecevable_2xI'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Irrecevable car deux fois incomplet"}) elif licence.STATUT == 9: # pas de date de décision licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus tacite du Fonctionnaire"}) elif licence.STATUT == 10: # event_dict['decision'] = main_licence_decision_mapping['AbandonDemandeur'] licence_dict['wf_state'] = 'retire' self.licence_description.append({'Précision décision': "Abandonné par le demandeur"}) elif licence.STATUT == 14: # event_dict['decision'] = main_licence_decision_mapping['OctroiFD'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Octroi par le FD"}) elif licence.STATUT == 17: # event_dict['decision'] = main_licence_decision_mapping['OctroiFD'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Octroi par le FD"}) elif licence.STATUT == 18: # event_dict['decision'] = main_licence_decision_mapping['RefusFD'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Refus par le FD"}) elif licence.STATUT == 28: # event_dict['decision'] = main_licence_decision_mapping['OctroiFD'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Octroi partiel du FD"}) elif licence.STATUT == 34: # event_dict['decision'] = main_licence_decision_mapping['Abandon'] licence_dict['wf_state'] = 'retire' self.licence_description.append({'Précision décision': "Abandon"}) elif licence.STATUT == 35: # event_dict['decision'] = main_licence_decision_mapping['Recevable'] licence_dict['wf_state'] = 'accept' self.licence_description.append({'Précision décision': "Recevable avec condition"}) elif licence.STATUT == 36: # Twice incomplete : Refused # event_dict['decision'] = main_licence_decision_mapping['Irrecevable'] licence_dict['wf_state'] = 'refuse' self.licence_description.append({'Précision décision': "Irrecevable car deux fois incomplet"}) elif licence.STATUT == 0 or licence.STATUT == 30 or licence.STATUT == 31 or licence.STATUT == '' or licence.STATUT == 15 or licence.STATUT == 27: """ En cours ou non déterminé """ else: import ipdb; ipdb.set_trace() # TODO REMOVE BREAKPOINT print("unknown status") # CUSTOM encoding error for example drt, dat, drc, dac # custom SOIG # if licence_dict['portalType'] == "Declaration": # if licence.REFERENCE in ("2014/DU001", "2014/DU002", "2015/DU013"): # event_dict['decision'] = main_licence_decision_mapping['OctroiFD'] # licence_dict['wf_state'] = 'accept' # self.licence_description.append({'Précision décision': "Erreur encodage : Octroi par le FD"}) # END CUSTOM # get decision date with four dates licencetype system (college/tutelle) if licence_dict['portalType'] in ( 'BuildLicence', 'ParcelOutLicence', 'UniqueLicence', 'EnvClassOne', 'EnvClassTwo', 'EnvClassThree', 'Article127', 'IntegratedLicence', 'MiscDemand' ): drt = licence.AUTORISATION_DATE_REFUS_TUTELLE dat = licence.AUTORISATION_DATE_AUTORISATION_TUTELLE drc = licence.AUTORISATION_DATE_REFUS_COLLEGE dac = licence.AUTORISATION_DATE_AUTORISATION_COLLEGE if hasattr(licence, "DATE_DECISION_TUTELLE") and licence.DATE_DECISION_TUTELLE: event_dict['eventDate'] = licence.DATE_DECISION_TUTELLE elif drt or dat: if drt and dat: event_dict['eventDate'] = drt if drt > dat else dat elif drt: event_dict['eventDate'] = drt else: event_dict['eventDate'] = dat elif drc or dac: if drc and dac: event_dict['eventDate'] = drc if drc > dac else dac elif drc: event_dict['eventDate'] = drc else: event_dict['eventDate'] = dac elif licence_dict['portalType'] in ('Division', 'NotaryLetter', 'UrbanCertificateOne', 'UrbanCertificateTwo'): # get decision date with 2 'colleges' dates licencetype drc = licence.AUTORISATION_DATE_REFUS_COLLEGE dac = licence.AUTORISATION_DATE_AUTORISATION_COLLEGE if drc and dac: event_dict['eventDate'] = drc if drc > dac else dac elif drc: event_dict['eventDate'] = drc else: event_dict['eventDate'] = dac if event_dict['eventDate']: event_dict['decisionDate'] = event_dict['eventDate'] # CODT licences need a transition if licence_dict['portalType'].startswith("CODT_") and licence_dict['wf_state']: if licence_dict['wf_state'] == 'accept': licence_dict['wf_transition'] = 'accepted' elif licence_dict['wf_state'] == 'refuse': licence_dict['wf_transition'] = 'refused' elif licence_dict['wf_state'] == 'retire': licence_dict['wf_transition'] = 'retired' licence_dict['wf_state'] = '' # Divison has a specific WF and hasn't 'refuse' transition if licence_dict['portalType'] == 'Division' and (licence_dict['wf_state'] == 'refuse' or licence_dict['wf_state'] == 'retire'): licence_dict['wf_state'] = 'nonapplicable' if event_dict['eventDate'] and event_dict['decisionDate']: if self.verify_date_pattern.match(event_dict['eventDate']) and self.verify_date_pattern.match(event_dict['decisionDate']): licence_dict['__children__'].append(event_dict)