|
@@ -3,7 +3,8 @@
|
|
|
@author: olivier.massot, 2018
|
|
@author: olivier.massot, 2018
|
|
|
'''
|
|
'''
|
|
|
from core import gis
|
|
from core import gis
|
|
|
-from core.cerberus_extend import is_french_date, is_int, is_float
|
|
|
|
|
|
|
+from core.cerberus_extend import is_int, is_float, \
|
|
|
|
|
+ is_modern_french_date
|
|
|
from core.validation import BaseGeoModel
|
|
from core.validation import BaseGeoModel
|
|
|
from schemas.common import INSEE_VALIDES, XMIN, YMIN, XMAX, YMAX
|
|
from schemas.common import INSEE_VALIDES, XMIN, YMIN, XMAX, YMAX
|
|
|
|
|
|
|
@@ -15,9 +16,10 @@ class Artere(BaseGeoModel):
|
|
|
'AR_LONG': {'empty': False, 'validator': is_float},
|
|
'AR_LONG': {'empty': False, 'validator': is_float},
|
|
|
'AR_ETAT': {'type': 'string', 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
|
|
'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_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']},
|
|
|
- 'AR_NOEUD_A': {'type': 'string', 'maxlength': 20},
|
|
|
|
|
- 'AR_NOEUD_B': {'type': 'string', 'maxlength': 20},
|
|
|
|
|
- 'AR_NB_FOUR': {'type': 'string', 'maxlength': 10},
|
|
|
|
|
|
|
+ '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_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_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_DIAM_FO': {'type': 'string', 'empty': False, 'multiallowed': ['10', '14', '18', '25', '28', '32', '40', '45', '60', 'NUL']},
|
|
@@ -25,8 +27,8 @@ class Artere(BaseGeoModel):
|
|
|
'AR_PRO_CAB': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE']},
|
|
'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_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_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_french_date},
|
|
|
|
|
- 'AR_DATE_RE': {'empty': False, 'validator': is_french_date},
|
|
|
|
|
|
|
+ '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_REF_PLA': {'type': 'string', 'maxlength': 100},
|
|
|
'AR_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
'AR_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
|
'AR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
'AR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
@@ -34,6 +36,9 @@ class Artere(BaseGeoModel):
|
|
|
'AR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
'AR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
|
'AR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'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):
|
|
class Cable(BaseGeoModel):
|
|
|
filename = "cable_geo.shp"
|
|
filename = "cable_geo.shp"
|
|
|
schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
|
|
schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
|
|
@@ -51,14 +56,17 @@ class Cable(BaseGeoModel):
|
|
|
'CA_NB_FO_D': {'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_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']},
|
|
|
'CA_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE FIBRE']},
|
|
'CA_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE FIBRE']},
|
|
|
- 'CA_DATE_IN': {'empty': False, 'validator': is_french_date},
|
|
|
|
|
|
|
+ 'CA_DATE_IN': {'empty': False, 'validator': is_modern_french_date},
|
|
|
'CA_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
'CA_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
|
'CA_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'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):
|
|
class Equipement(BaseGeoModel):
|
|
|
filename = "equipement_passif.shp"
|
|
filename = "equipement_passif.shp"
|
|
|
schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))},
|
|
schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))},
|
|
|
- 'EQ_NOM': {'type': 'string', 'maxlength': 10},
|
|
|
|
|
|
|
+ 'EQ_NOM': {'type': 'string', 'maxlength': 10, 'contains_any_of': ['PBO', 'BPE', 'BAI']},
|
|
|
'EQ_NOM_NOE': {'type': 'string', 'maxlength': 14},
|
|
'EQ_NOM_NOE': {'type': 'string', 'maxlength': 14},
|
|
|
'EQ_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
|
|
'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_OCCP': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']},
|
|
@@ -68,9 +76,12 @@ class Equipement(BaseGeoModel):
|
|
|
'EQ_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
|
|
'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_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_HAUT': {'empty': False, 'validator': is_float},
|
|
|
- 'EQ_DATE_IN': {'empty': False, 'validator': is_french_date},
|
|
|
|
|
|
|
+ 'EQ_DATE_IN': {'empty': False, 'validator': is_modern_french_date},
|
|
|
'EQ_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
'EQ_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
|
'EQ_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'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):
|
|
class Noeud(BaseGeoModel):
|
|
|
filename = "noeud_geo.shp"
|
|
filename = "noeud_geo.shp"
|
|
@@ -84,7 +95,7 @@ class Noeud(BaseGeoModel):
|
|
|
'NO_TYPE_LQ': {'type': 'string', 'maxlength': 10, 'empty': False, 'allowed': ['CHTIR', 'CHRACC', 'POT', 'NRO', 'PM', 'MIMO', '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_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_CODE_PH': {'type': 'string', 'maxlength': 20},
|
|
|
- 'NO_TECH_PS': {'type': 'string', 'maxlength': 4, 'empty': False, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']},
|
|
|
|
|
|
|
+ 'NO_TECH_PS': {'type': 'string', 'maxlength': 20, 'empty': False, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']},
|
|
|
'NO_AMO': {'type': 'string', 'maxlength': 20},
|
|
'NO_AMO': {'type': 'string', 'maxlength': 20},
|
|
|
'NO_PLINOX': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['OUI', 'NON']},
|
|
'NO_PLINOX': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['OUI', 'NON']},
|
|
|
'NO_X': {'empty': False, 'validator': is_float},
|
|
'NO_X': {'empty': False, 'validator': is_float},
|
|
@@ -92,7 +103,7 @@ class Noeud(BaseGeoModel):
|
|
|
'NO_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
|
|
'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_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_HAUT': {'empty': False, 'validator': is_float},
|
|
|
- 'NO_DATE_IN': {'empty': False, 'validator': is_french_date},
|
|
|
|
|
|
|
+ 'NO_DATE_IN': {'empty': False, 'validator': is_modern_french_date},
|
|
|
'NO_REF_PLA': {'type': 'string', 'maxlength': 100},
|
|
'NO_REF_PLA': {'type': 'string', 'maxlength': 100},
|
|
|
'NO_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
'NO_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
|
'NO_QLT_GEO': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
'NO_QLT_GEO': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
@@ -100,6 +111,9 @@ class Noeud(BaseGeoModel):
|
|
|
'NO_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
'NO_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
|
'NO_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'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):
|
|
class Tranchee(BaseGeoModel):
|
|
|
filename = "tranchee_geo.shp"
|
|
filename = "tranchee_geo.shp"
|
|
|
schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
|
|
schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
|
|
@@ -117,17 +131,22 @@ class Tranchee(BaseGeoModel):
|
|
|
'TR_PRO_VOI': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']},
|
|
'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_GEST_VO': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']},
|
|
|
'TR_SCHEMA': {'maxlength': 100, 'type': 'string'},
|
|
'TR_SCHEMA': {'maxlength': 100, 'type': 'string'},
|
|
|
- 'TR_DATE_IN': {'empty': False, 'validator': is_french_date},
|
|
|
|
|
|
|
+ 'TR_DATE_IN': {'empty': False, 'validator': is_modern_french_date},
|
|
|
'TR_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
'TR_SRC_GEO': {'type': 'string', 'maxlength': 50},
|
|
|
'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
|
|
|
'TR_PRO_MD': {'type': 'string', 'maxlength': 20},
|
|
'TR_PRO_MD': {'type': 'string', 'maxlength': 20},
|
|
|
'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
|
|
|
'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
|
|
|
|
|
|
|
|
+ def __repr__(self):
|
|
|
|
|
+ return "Tranchee {}".format(self.TR_VOIE)
|
|
|
|
|
+
|
|
|
class Zapbo(BaseGeoModel):
|
|
class Zapbo(BaseGeoModel):
|
|
|
filename = "zapbo_geo.shp"
|
|
filename = "zapbo_geo.shp"
|
|
|
schema = {'geom': {'geometry': (gis.POLYGON, (XMIN, YMIN, XMAX, YMAX))},
|
|
schema = {'geom': {'geometry': (gis.POLYGON, (XMIN, YMIN, XMAX, YMAX))},
|
|
|
- 'ID_ZAPBO': {'type': 'string', 'maxlength': 30},
|
|
|
|
|
|
|
+ 'ID_ZAPBO': {'type': 'string', 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE']},
|
|
|
'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True},
|
|
'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True},
|
|
|
'STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
'STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ def __repr__(self):
|
|
|
|
|
+ return "Zapbo {}".format(self.ID_ZAPBO)
|