models.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. '''
  2. @author: olivier.massot, 2018
  3. '''
  4. from core import gis
  5. from core.cerberus_extend import is_french_date, is_int, is_float
  6. from core.validation import BaseGeoModel
  7. from schemas.common import INSEE_VALIDES, XMIN, YMIN, XMAX, YMAX
  8. class Artere(BaseGeoModel):
  9. filename = "artere_geo.shp"
  10. schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
  11. 'AR_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES},
  12. 'AR_LONG': {'empty': False, 'validator': is_float},
  13. 'AR_ETAT': {'type': 'string', 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
  14. 'AR_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']},
  15. 'AR_NOEUD_A': {'type': 'string', 'maxlength': 20},
  16. 'AR_NOEUD_B': {'type': 'string', 'maxlength': 20},
  17. 'AR_NB_FOUR': {'type': 'string', 'maxlength': 10},
  18. 'AR_FOU_DIS': {'empty': False, 'validator': is_int},
  19. 'AR_TYPE_FO': {'type': 'string', 'empty': False, 'multiallowed': ['PVC', 'PEHD', 'SOUS-TUBAGE PEHD', 'SOUS-TUBAGE SOUPLE', 'FACADE', 'AERIEN', 'ENCORBELLEMENT', 'AUTRE']},
  20. 'AR_DIAM_FO': {'type': 'string', 'empty': False, 'multiallowed': ['10', '14', '18', '25', '28', '32', '40', '45', '60', 'NUL']},
  21. 'AR_PRO_FOU': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'AUTRE (à préciser)']},
  22. 'AR_PRO_CAB': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE']},
  23. 'AR_GEST_FO': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'ERDF', 'AUTRE (à préciser)', 'NUL']},
  24. 'AR_UTIL_FO': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
  25. 'AR_DATE_IN': {'empty': False, 'validator': is_french_date},
  26. 'AR_DATE_RE': {'empty': False, 'validator': is_french_date},
  27. 'AR_REF_PLA': {'type': 'string', 'maxlength': 100},
  28. 'AR_SRC_GEO': {'type': 'string', 'maxlength': 50},
  29. 'AR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
  30. 'AR_PRO_MD': {'type': 'string', 'empty': False, 'default': 'MANCHE NUMERIQUE', 'allowed': ['MANCHE NUMERIQUE']},
  31. 'AR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
  32. 'AR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
  33. class Cable(BaseGeoModel):
  34. filename = "cable_geo.shp"
  35. schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
  36. 'CA_NUMERO': {'type': 'string', 'maxlength': 17},
  37. 'CA_TYPE': {'type': 'string', 'maxlength': 10, 'empty': False, 'allowed': ['AERIEN', 'IMMEUBLE', 'FACADE', 'MIXTE', 'SOUTERRAIN']},
  38. 'CA_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
  39. 'CA_LONG': {'validator': is_float},
  40. 'CA_EQ_A': {'type': 'string', 'maxlength': 18},
  41. 'CA_EQ_B': {'type': 'string', 'maxlength': 18},
  42. 'CA_DIAMETR': {'empty': False, 'validator': is_float},
  43. 'CA_COULEUR': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['NOIR', 'BLEU', 'BLANC']},
  44. 'CA_TECHNOL': {'type': 'string', 'maxlength': 17, 'empty': False, 'allowed': ['G657A2_M6', 'G657A2_M12']},
  45. 'CA_NB_FO': {'validator': is_int},
  46. 'CA_NB_FO_U': {'empty': False, 'validator': is_int},
  47. 'CA_NB_FO_D': {'empty': False, 'validator': is_int},
  48. 'CA_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']},
  49. 'CA_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE FIBRE']},
  50. 'CA_DATE_IN': {'empty': False, 'validator': is_french_date},
  51. 'CA_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
  52. 'CA_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
  53. class Equipement(BaseGeoModel):
  54. filename = "equipement_passif.shp"
  55. schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))},
  56. 'EQ_NOM': {'type': 'string', 'maxlength': 10},
  57. 'EQ_NOM_NOE': {'type': 'string', 'maxlength': 14},
  58. 'EQ_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
  59. 'EQ_OCCP': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']},
  60. 'EQ_TYPE': {'type': 'string', 'empty': False, 'allowed': ['PBO', 'PBOE', 'BPE', 'BAI']},
  61. 'EQ_TYPE_LQ': {'type': 'string', 'maxlength': 6, 'empty': False, 'allowed': ['PBO', 'BPE JB', 'BPE JD', 'BAIDC', 'BAIOP']},
  62. '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']},
  63. 'EQ_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
  64. 'EQ_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
  65. 'EQ_HAUT': {'empty': False, 'validator': is_float},
  66. 'EQ_DATE_IN': {'empty': False, 'validator': is_french_date},
  67. 'EQ_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
  68. 'EQ_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
  69. class Noeud(BaseGeoModel):
  70. filename = "noeud_geo.shp"
  71. schema = {'geom': {'geometry': (gis.POINT, (XMIN, YMIN, XMAX, YMAX))},
  72. 'NO_NOM': {'type': 'string', 'maxlength': 20},
  73. 'NO_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES},
  74. 'NO_VOIE': {'type': 'string', 'maxlength': 100},
  75. 'NO_ETAT': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['0', '1', '2', '3', '4']},
  76. 'NO_OCCP': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']},
  77. 'NO_TYPE': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['CHA', 'POT', 'LTE', 'SEM', 'FAC', 'OUV', 'IMM']},
  78. 'NO_TYPE_LQ': {'type': 'string', 'maxlength': 10, 'empty': False, 'allowed': ['CHTIR', 'CHRACC', 'POT', 'NRO', 'PM', 'MIMO', 'FAC', 'OUV', 'IMM']},
  79. 'NO_TYPE_PH': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['CHAMBRE', 'POTEAU', 'ARMOIRE', 'SHELTER', 'BATIMENT', 'SITE MIMO', 'FACADE', 'OUVRAGE', 'IMMEUBLE']},
  80. 'NO_CODE_PH': {'type': 'string', 'maxlength': 20},
  81. 'NO_TECH_PS': {'type': 'string', 'maxlength': 4, 'empty': False, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']},
  82. 'NO_AMO': {'type': 'string', 'maxlength': 20},
  83. 'NO_PLINOX': {'type': 'string', 'maxlength': 3, 'empty': False, 'allowed': ['OUI', 'NON']},
  84. 'NO_X': {'empty': False, 'validator': is_float},
  85. 'NO_Y': {'empty': False, 'validator': is_float},
  86. 'NO_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
  87. 'NO_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'MANCHE FIBRE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']},
  88. 'NO_HAUT': {'empty': False, 'validator': is_float},
  89. 'NO_DATE_IN': {'empty': False, 'validator': is_french_date},
  90. 'NO_REF_PLA': {'type': 'string', 'maxlength': 100},
  91. 'NO_SRC_GEO': {'type': 'string', 'maxlength': 50},
  92. 'NO_QLT_GEO': {'type': 'string', 'maxlength': 1, 'empty': False, 'allowed': ['A', 'B', 'C']},
  93. 'NO_PRO_MD': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE']},
  94. 'NO_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
  95. 'NO_STATUT': {'type': 'string', 'maxlength': 14, 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
  96. class Tranchee(BaseGeoModel):
  97. filename = "tranchee_geo.shp"
  98. schema = {'geom': {'geometry': (gis.POLYLINE, (XMIN, YMIN, XMAX, YMAX))},
  99. 'TR_ID_INSE': {'type': 'string', 'empty': False, 'allowed': INSEE_VALIDES},
  100. 'TR_VOIE': {'type': 'string', 'maxlength': 200},
  101. 'TR_TYP_IMP': {'type': 'string', 'empty': False, 'allowed': ['ACCOTEMENT STABILISE', 'ACCOTEMENT NON STABILISE', 'CHAUSSEE LOURDE', 'CHAUSSEE LEGERE', 'FOSSE', 'TROTTOIR', 'ESPACE VERT', 'ENCORBELLEMENT']},
  102. 'TR_MOD_POS': {'type': 'string', 'empty': False, 'allowed': ['TRADITIONNEL', 'MICRO TRANCHEE', 'FONCAGE 60', 'FONCAGE 90', 'FONCAGE 120', 'TRANCHEUSE', 'FORAGE URBAIN', 'FORAGE RURAL', 'ENCORBELLEMENT']},
  103. 'TR_LONG': {'empty': False, 'validator': is_float},
  104. 'TR_LARG': {'empty': False, 'validator': is_float},
  105. 'TR_REVET': {'type': 'string', 'empty': False, 'allowed': ['SABLE', 'BICOUCHE', 'ENROBE', 'BETON', 'PAVE', 'TERRAIN NATUREL']},
  106. 'TR_CHARGE': {'empty': False, 'validator': is_float},
  107. 'TR_GRILLAG': {'empty': False, 'validator': is_float},
  108. 'TR_REMBLAI': {'type': 'string'},
  109. 'TR_PLYNOX': {'type': 'string', 'empty': False, 'allowed': ['OUI', 'NON']},
  110. 'TR_PRO_VOI': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']},
  111. 'TR_GEST_VO': {'type': 'string', 'empty': False, 'allowed': ['COMMUNE', 'COMMUNAUTE DE COMMUNES', 'DEPARTEMENT', 'ETAT', 'PRIVE']},
  112. 'TR_SCHEMA': {'maxlength': 100, 'type': 'string'},
  113. 'TR_DATE_IN': {'empty': False, 'validator': is_french_date},
  114. 'TR_SRC_GEO': {'type': 'string', 'maxlength': 50},
  115. 'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']},
  116. 'TR_PRO_MD': {'type': 'string', 'maxlength': 20},
  117. 'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True},
  118. 'TR_STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
  119. class Zapbo(BaseGeoModel):
  120. filename = "zapbo_geo.shp"
  121. schema = {'geom': {'geometry': (gis.POLYGON, (XMIN, YMIN, XMAX, YMAX))},
  122. 'ID_ZAPBO': {'type': 'string', 'maxlength': 30},
  123. 'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True},
  124. 'STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}