''' @author: olivier.massot, 2018 ''' from core import gis from core.cerberus_extend import is_int, is_float, \ is_modern_french_date from core.validation import BaseGeoModel from schemas.common import INSEE_VALIDES, XMIN, YMIN, XMAX, YMAX class Artere(BaseGeoModel): filename = "artere_geo.shp" schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))}, 'AR_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES}, 'AR_LONG': {'empty': False, 'validator': is_float}, 'AR_ETAT': {'type': 'string', 'empty': False, 'allowed': ['0', '1', '2', '3', '4']}, 'AR_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 'AR_NOEUD_A': {'type': 'string', 'empty': False, 'maxlength': 20}, 'AR_NOEUD_B': {'type': 'string', 'empty': False, 'maxlength': 20}, 'AR_NB_FOUR': {'empty': False, 'validator': is_int}, # 'AR_NB_FOUR': {'type': 'string', 'maxlength': 10}, 'AR_FOU_DIS': {'empty': False, 'validator': is_int}, 'AR_TYPE_FO': {'type': 'string', 'empty': False, 'multiallowed': ['PVC', 'PEHD', 'SOUS-TUBAGE PEHD', 'SOUS-TUBAGE SOUPLE', 'FACADE', 'AERIEN', 'ENCORBELLEMENT', 'AUTRE']}, 'AR_DIAM_FO': {'type': 'string', 'empty': False, 'multiallowed': ['10', '14', '18', '25', '28', '32', '40', '45', '60', 'NUL']}, 'AR_PRO_FOU': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'AUTRE (à préciser)']}, 'AR_PRO_CAB': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE']}, 'AR_GEST_FO': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'ERDF', 'AUTRE (à préciser)', 'NUL']}, 'AR_UTIL_FO': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 'AR_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 'AR_DATE_RE': {'empty': False, 'validator': is_modern_french_date}, 'AR_REF_PLA': {'type': 'string', 'maxlength': 100}, 'AR_SRC_GEO': {'type': 'string', 'maxlength': 50}, 'AR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']}, 'AR_PRO_MD': {'type': 'string', 'empty': False, 'default': 'MANCHE NUMERIQUE', 'allowed': ['MANCHE NUMERIQUE']}, 'AR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 'AR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Artere {}-{}".format(self.AR_NOEUD_A, self.AR_NOEUD_B) class Cable(BaseGeoModel): filename = "cable_geo.shp" schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))}, 'CA_NUMERO': {'type': 'string', 'maxlength': 17}, 'CA_TYPE': {'type': 'string', 'maxlength': 10, 'empty': False, 'allowed': ['AERIEN', 'IMMEUBLE', 'FACADE', 'MIXTE', 'SOUTERRAIN']}, 'CA_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']}, 'CA_LONG': {'validator': is_float}, 'CA_EQ_A': {'type': 'string', 'maxlength': 18}, 'CA_EQ_B': {'type': 'string', 'maxlength': 18}, 'CA_DIAMETR': {'empty': False, 'validator': is_float}, 'CA_COULEUR': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['NOIR', 'BLEU', 'BLANC']}, 'CA_TECHNOL': {'type': 'string', 'maxlength': 17, 'empty': False, 'allowed': ['G657A2_M6', 'G657A2_M12']}, 'CA_NB_FO': {'validator': is_int}, 'CA_NB_FO_U': {'empty': False, 'validator': is_int}, 'CA_NB_FO_D': {'empty': False, 'validator': is_int}, 'CA_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']}, 'CA_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE FIBRE']}, 'CA_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 'CA_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 'CA_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Cable {}-{}".format(self.CA_EQ_A, self.CA_EQ_B) class Equipement(BaseGeoModel): filename = "equipement_passif.shp" schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))}, 'EQ_NOM': {'type': 'string', 'maxlength': 10, 'contains_any_of': ['PBO', 'BPE', 'BAI']}, 'EQ_NOM_NOE': {'type': 'string', 'maxlength': 14}, 'EQ_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']}, 'EQ_OCCP': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 'EQ_TYPE': {'type': 'string', 'empty': False, 'allowed': ['PBO', 'PBOE', 'BPE', 'BAI']}, 'EQ_TYPE_LQ': {'type': 'string', 'maxlength': 6, 'empty': False, 'allowed': ['PBO', 'BPE JB', 'BPE JD', 'BAIDC', 'BAIOP']}, 'EQ_TYPE_PH': {'type': 'string', 'maxlength': 24, 'empty': False, 'allowed': ['PBO 6', 'PBO 12', 'BPE 12EP', 'BPE 24EP', 'BPE 48EP', 'BPE 72EP', 'BPE 96EP', 'BPE 144EP', 'BPE 288EP', 'BPE 576EP', 'BPE 720EP', 'BAI']}, 'EQ_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 'EQ_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 'EQ_HAUT': {'empty': False, 'validator': is_float}, 'EQ_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 'EQ_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 'EQ_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Equipement {}".format(self.EQ_NOM) class Noeud(BaseGeoModel): filename = "noeud_geo.shp" schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))}, 'NO_NOM': {'type': 'string', 'maxlength': 20}, 'NO_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES}, 'NO_VOIE': {'type': 'string', 'maxlength': 100}, 'NO_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']}, 'NO_OCCP': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 'NO_TYPE': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['CHA', 'POT', 'LTE', 'SEM', 'FAC', 'OUV', 'IMM']}, 'NO_TYPE_LQ': {'type': 'string', 'maxlength': 10, 'empty': False, 'allowed': ['CHTIR', 'CHRACC', 'POT', 'NRO', 'PM', 'MIMO', 'FAC', 'OUV', 'IMM']}, 'NO_TYPE_PH': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['CHAMBRE', 'POTEAU', 'ARMOIRE', 'SHELTER', 'BATIMENT', 'SITE MIMO', 'FACADE', 'OUVRAGE', 'IMMEUBLE']}, 'NO_CODE_PH': {'type': 'string', 'maxlength': 20}, 'NO_TECH_PS': {'type': 'string', 'maxlength': 20, 'empty': False, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']}, 'NO_AMO': {'type': 'string', 'maxlength': 20}, 'NO_PLINOX': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['OUI', 'NON']}, 'NO_X': {'empty': False, 'validator': is_float}, 'NO_Y': {'empty': False, 'validator': is_float}, 'NO_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 'NO_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'MANCHE FIBRE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 'NO_HAUT': {'empty': False, 'validator': is_float}, 'NO_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 'NO_REF_PLA': {'type': 'string', 'maxlength': 100}, 'NO_SRC_GEO': {'type': 'string', 'maxlength': 50}, 'NO_QLT_GEO': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['A', 'B', 'C']}, 'NO_PRO_MD': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']}, 'NO_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 'NO_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Noeud {}".format(self.NO_NOM) class Tranchee(BaseGeoModel): filename = "tranchee_geo.shp" schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))}, 'TR_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES}, 'TR_VOIE': {'type': 'string', 'maxlength': 200}, 'TR_TYP_IMP': {'type': 'string', 'empty': False, 'allowed': ['ACCOTEMENT STABILISE', 'ACCOTEMENT NON STABILISE', 'CHAUSSEE LOURDE', 'CHAUSSEE LEGERE', 'FOSSE', 'TROTTOIR', 'ESPACE VERT', 'ENCORBELLEMENT']}, 'TR_MOD_POS': {'type': 'string', 'empty': False, 'allowed': ['TRADITIONNEL', 'MICRO TRANCHEE', 'FONCAGE 60', 'FONCAGE 90', 'FONCAGE 120', 'TRANCHEUSE', 'FORAGE URBAIN', 'FORAGE RURAL', 'ENCORBELLEMENT']}, 'TR_LONG': {'empty': False, 'validator': is_float}, 'TR_LARG': {'empty': False, 'validator': is_float}, 'TR_REVET': {'type': 'string', 'empty': False, 'allowed': ['SABLE', 'BICOUCHE', 'ENROBE', 'BETON', 'PAVE', 'TERRAIN NATUREL']}, 'TR_CHARGE': {'empty': False, 'validator': is_float}, 'TR_GRILLAG': {'empty': False, 'validator': is_float}, 'TR_REMBLAI': {'type': 'string'}, 'TR_PLYNOX': {'type': 'string', 'empty': False, 'allowed': ['OUI', 'NON']}, 'TR_PRO_VOI': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']}, 'TR_GEST_VO': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']}, 'TR_SCHEMA': {'maxlength': 100, 'type': 'string'}, 'TR_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 'TR_SRC_GEO': {'type': 'string', 'maxlength': 50}, 'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']}, 'TR_PRO_MD': {'type': 'string', 'maxlength': 20}, 'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Tranchee {}".format(self.TR_VOIE) class Zapbo(BaseGeoModel): filename = "zapbo_geo.shp" schema = {'geom': {'geometry': (gis.POLYGON, (XMIN, YMIN, XMAX, YMAX))}, 'ID_ZAPBO': {'type': 'string', 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE']}, 'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True}, 'STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}} def __repr__(self): return "Zapbo {}".format(self.ID_ZAPBO)