Browse Source

v0.7.2 correction des schémas

omassot 6 years ago
parent
commit
1fdb10c404
4 changed files with 60 additions and 19 deletions
  1. 1 1
      core/constants.py
  2. 1 1
      metadata.txt
  3. 17 3
      schemas/mn1_rec.py
  4. 41 14
      schemas/mn2_rec.py

+ 1 - 1
core/constants.py

@@ -6,7 +6,7 @@
 '''
 from path import Path
 
-VERSION = "0.7.1"
+VERSION = "0.7.2"
 
 DEBUG = False
 

+ 1 - 1
metadata.txt

@@ -10,7 +10,7 @@
 name=MnCheck
 qgisMinimumVersion=3.0
 description=Contrôle des données FTTH format MN
-version=0.7.1
+version=0.7.2
 author=Manche Numérique 2019
 email=sig@manchenumerique.fr
 

+ 17 - 3
schemas/mn1_rec.py

@@ -38,8 +38,8 @@ class Artere(QgsModel):
               'AR_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 
               'AR_NOEUD_A': {'type': 'string', 'empty': False, 'maxlength': 30}, 
               'AR_NOEUD_B': {'type': 'string', 'empty': False, 'maxlength': 30}, 
-              'AR_NB_FOUR': {'empty': False, 'validator': is_multi_int}, 
-              'AR_FOU_DIS': {'empty': False, 'validator': is_int}, 
+              'AR_NB_FOUR': {'empty': True, 'validator': is_multi_int}, 
+              'AR_FOU_DIS': {'empty': True, 'validator': is_int}, 
               'AR_TYPE_FO': {'type': 'string', 'multiallowed': ['PVC', 'PEHD', 'SOUS-TUBAGE PEHD', 'SOUS-TUBAGE  SOUPLE', 'FACADE', 'AERIEN', 'ENCORBELLEMENT', 'AUTRE']}, 
               'AR_DIAM_FO': {'type': 'string', 'multiallowed': ['10', '14', '18', '25', '28', '32', '40', '45', '60', '80', '150', 'NUL', '']}, 
               'AR_PRO_FOU': {'type': 'string', 'multiallowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'ERDF', 'AUTRE (à préciser)']}, 
@@ -91,6 +91,7 @@ class Cable(QgsModel):
         except AttributeError:
             return f"Cable (code manquant)"
         
+        
 class Equipement(QgsModel):
     layername = "equipement_passif"
     geom_type = QgsModel.GEOM_POINT
@@ -153,7 +154,7 @@ class Tranchee(QgsModel):
               '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_strictly_positive_float}, 
               'TR_LARG': {'empty':True, 'validator': is_strictly_positive_float}, 
-              'TR_REVET': {'empty':True, 'type': 'string', 'allowed': ['SABLE', 'BICOUCHE', 'ENROBE', 'BETON', 'PAVE', 'TERRAIN NATUREL']}, 
+              'TR_REVET': {'empty':True, 'type': 'string', 'allowed': ['SABLE', 'BICOUCHE', 'ENROBE', 'GRAVIER', 'BETON', 'PAVE', 'TERRAIN NATUREL']}, 
               'TR_CHARGE': {'empty':True, 'validator': is_positive_float}, 
               'TR_GRILLAG': {'empty':True, 'validator': is_positive_float}, 
               'TR_REMBLAI': {'type': 'string', 'maxlength': 50}, 
@@ -509,6 +510,19 @@ class Mn1Checker(BaseChecker):
             if not cables_full_buffer.contains(artere.geom):
                 self.log_error("Artère ou portion d'artère sans cable", item=artere)
     
+    def test_arteres_enterrees(self):
+        """ Données des artères enterrées
+        Contrôle les données des artères enterrées ou en encorbellement  """
+        
+        for artere in self.arteres:
+            if artere.AR_TYPE_FO in ["FACADE", "AERIEN"]:
+                continue
+            for field in ["AR_NB_FOUR", "AR_FOU_DIS", "AR_DIAM_FO"]:
+                if not hasattr(artere, field):
+                    self.log_error("Le champs est obligatoire: {}".format(field), item=artere)
+                elif getattr(artere, field) == "":
+                    self.log_error("Le champs doit être renseigné: {}".format(field), item=artere)
+    
     def test_dimensions_fourreaux(self):
         """ Dimensions logiques: fourreaux
         Vérifie que les nombres de fourreaux renseignés sont cohérents """

+ 41 - 14
schemas/mn2_rec.py

@@ -32,7 +32,6 @@ COUCHE_PRISES = "FTTH_SITES_GEO_VALIDE"
 
 ##### Modeles
 
-
 class Artere(QgsModel):
     layername = "artere_geo"
     geom_type = QgsModel.GEOM_LINE
@@ -47,15 +46,15 @@ class Artere(QgsModel):
               'AR_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 
               'AR_NOEUD_A': {'type': 'string', 'empty': False, 'maxlength': 30}, 
               'AR_NOEUD_B': {'type': 'string', 'empty': False, 'maxlength':  30}, 
-              'AR_NB_FOUR': {'empty': False, 'validator': is_multi_int}, 
-              'AR_FOU_DIS': {'empty': False, 'validator': is_int}, 
+              'AR_NB_FOUR': {'empty': True, 'validator': is_multi_int}, 
+              'AR_FOU_DIS': {'empty': True, 'validator': is_int}, 
               'AR_TYPE_FO': {'type': 'string', 'empty': False, 'multiallowed': ['PVC', 'PEHD', 'SOUS-TUBAGE PEHD', 'SOUS-TUBAGE  SOUPLE', 'FACADE', 'AERIEN', 'ENCORBELLEMENT', 'AUTRE']}, 
               'AR_TYFO_AI': {'type': 'string', 'empty': False, 'multiallowed': ['PVC', 'PEH', 'TUB', 'FAC', 'ENC', 'APP']}, 
               'AR_DIAM_FO': {'type': 'string', 'multiallowed': ['10', '14', '18', '25', '28', '32', '40', '45', '60', '80', '150', 'NUL', '']}, 
               'AR_PRO_FOU': {'type': 'string', 'empty': False, 'multiallowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'ERDF', 'AUTRE (à préciser)']}, 
-              'AR_FAB': {'type': 'string', 'empty': False, 'maxlength': 100},
-              'AR_REFFAB': {'type': 'string', 'empty': False, 'maxlength': 100},
-              'AR_COULEUR': {'type': 'string', 'empty': False, 'maxlength': 20},
+              'AR_FAB': {'type': 'string', 'empty': True, 'maxlength': 100},
+              'AR_REFFAB': {'type': 'string', 'empty': True, 'maxlength': 100},
+              'AR_COULEUR': {'type': 'string', 'empty': True, 'maxlength': 20},
               'AR_AIGUIL': {'type': 'string', 'empty': True, 'maxlength': 3, 'allowed': ['OUI', 'NON']},
               'AR_NBCABL': {'empty': False, 'validator': is_positive_int},
               'AR_PRO_CAB': {'type': 'string', 'empty': False, 'allowed': ['MANCHE NUMERIQUE']}, 
@@ -112,15 +111,15 @@ class Equipement(QgsModel):
               'EQ_REF': {'type': 'string', 'empty': False, 'maxlength': 100}, 
               'EQ_EMPRISE': {'type': 'string', 'empty': False, 'maxlength': 10}, 
               'EQ_FABR': {'type': 'string', 'empty': False, 'maxlength': 100}, 
-              'EQ_CAPFO': {'empty': False, 'validator': is_strictly_positive_int}, 
-              'EQ_NBMXEQ': {'empty': False, 'validator': is_strictly_positive_int}, 
-              'EQ_NBCAB': {'empty': False, 'validator': is_strictly_positive_int}, 
-              'EQ_DIMENS': {'type': 'string', 'empty': False, 'maxlength': 50}, 
-              'EQ_TYPEQ': {'type': 'string', 'empty': False, 'maxlength': 100}, 
+              'EQ_CAPFO': {'empty': True, 'validator': is_strictly_positive_int}, 
+              'EQ_NBMXEQ': {'empty': True, 'validator': is_strictly_positive_int}, 
+              'EQ_NBCAB': {'empty': True, 'validator': is_strictly_positive_int}, 
+              'EQ_DIMENS': {'type': 'string', 'empty': True, 'maxlength': 50}, 
+              'EQ_TYPEQ': {'type': 'string', 'empty': True, 'maxlength': 100}, 
               'EQ_ETAT': {'type': 'string', 'empty': False, 'allowed': ['0', '1', '2', '3', '4']}, 
               'EQ_OCCP': {'type': 'string', 'empty': False, 'allowed': ['0', '1.1', '1.2', '2', '3', '4']}, 
               'EQ_TYPE': {'type': 'string', 'empty': False, 'allowed': ['PBO', 'BPE', 'BAI', 'PEC']},
-              'EQ_TYPSTRC': {'type': 'string', 'empty': False, 'allowed': ['CHAMBRE', 'AERIEN', 'FACADE', 'COLONNE MONTANTE', 'PIED IMMEUBLE', 'DTIO']}, 
+              'EQ_TYPSTRC': {'type': 'string', 'empty': True, 'allowed': ['CHAMBRE', 'AERIEN', 'FACADE', 'COLONNE MONTANTE', 'PIED IMMEUBLE', 'DTIO']}, 
               'EQ_TYPE_LQ': {'type': 'string', 'empty': False, 'allowed': ['PBO', 'BPE JB', 'BPE JD', 'BAIDC', 'BAIOP']}, 
               'EQ_TYPE_PH': {'type': 'string', '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', 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE (à préciser)', 'NUL']}, 
@@ -181,7 +180,7 @@ class Tranchee(QgsModel):
               'TR_MPOS_AI': {'type': 'string', 'empty': False, 'allowed': ['TRA', 'ALL', 'FONCAGE 60', 'FON', 'FOR', 'ENC']}, 
               'TR_LONG': {'empty': True, 'validator': is_strictly_positive_float}, 
               'TR_LARG': {'empty': True, 'validator': is_strictly_positive_float}, 
-              'TR_REVET': {'empty':True, 'type': 'string', 'allowed': ['SABLE', 'BICOUCHE', 'ENROBE', 'BETON', 'PAVE', 'TERRAIN NATUREL']}, 
+              'TR_REVET': {'empty':True, 'type': 'string', 'allowed': ['SABLE', 'BICOUCHE', 'GRAVIER', 'ENROBE', 'BETON', 'PAVE', 'TERRAIN NATUREL']}, 
               'TR_CHARGE': {'empty': True, 'validator': is_positive_float}, 
               'TR_GRILLAG': {'empty':True, 'validator': is_positive_float}, 
               'TR_REMBLAI': {'type': 'string', 'maxlength': 50}, 
@@ -283,7 +282,7 @@ class Mn2Checker(BaseChecker):
         """ Structure des données: Artères 
         Contrôle les données attributaires de la couche ARTERE_GEO: 
         présence, format, valeurs autorisées...
-        """
+        """       
         self._validate_structure(Artere, self.arteres)
 
     def test_structure_cables(self):
@@ -538,11 +537,39 @@ class Mn2Checker(BaseChecker):
             if not cables_full_buffer.contains(artere.geom):
                 self.log_error("Artère ou portion d'artère sans cable", item=artere)
     
+    def test_boites(self):
+        """ Données des boites
+        Contrôle les données des équipements de type BPE / PBO """
+
+        for equipement in self.equipements:
+            if equipement.EQ_TYPE == "BAI":
+                continue
+            for field in ["EQ_CAPFO", "EQ_NBMXEQ", "EQ_NBCAB", "EQ_DIMENS", "EQ_TYPEQ", "EQ_TYPSTRC"]:
+                if not hasattr(equipement, field):
+                    self.log_error("Le champs est obligatoire: {}".format(field), item=equipement)
+                elif getattr(equipement, field) == "":
+                    self.log_error("Le champs doit être renseigné: {}".format(field), item=equipement)
+    
+    def test_arteres_enterrees(self):
+        """ Données des artères enterrées
+        Contrôle les données des artères enterrées ou en encorbellement  """
+        
+        for artere in self.arteres:
+            if artere.AR_TYPE_FO in ["FACADE", "AERIEN"]:
+                continue
+            for field in ["AR_NB_FOUR", "AR_FOU_DIS", "AR_DIAM_FO", "AR_FAB", "AR_REFFAB", "AR_AIGUIL", "AR_COULEUR"]:
+                if not hasattr(artere, field):
+                    self.log_error("Le champs est obligatoire: {}".format(field), item=artere)
+                elif getattr(artere, field) == "":
+                    self.log_error("Le champs doit être renseigné: {}".format(field), item=artere)
+    
     def test_dimensions_fourreaux(self):
         """ Dimensions logiques: fourreaux
         Vérifie que les nombres de fourreaux renseignés sont cohérents """
         
         for artere in self.arteres:
+            if artere.AR_TYPE_FO in ["FACADE", "AERIEN"]:
+                continue
             try:
                 if not int(artere.AR_FOU_DIS) <= int(artere.AR_NB_FOUR):
                     self.log_error("Le nombre de fourreaux disponibles (AR_FOU_DIS) doit être inférieur au nombre total (AR_NB_FOUR)", item=artere)