Browse Source

v0.8.0 Corrections schémas

omassot 6 years ago
parent
commit
23b77bcc0a
6 changed files with 37 additions and 29 deletions
  1. 1 1
      core/constants.py
  2. 1 1
      metadata.txt
  3. 12 8
      schemas/mn1_rec.py
  4. 7 3
      schemas/mn2_rec.py
  5. 8 8
      test/test_mn1_rec.py
  6. 8 8
      test/test_mn2_rec.py

+ 1 - 1
core/constants.py

@@ -6,7 +6,7 @@
 '''
 from path import Path
 
-VERSION = "0.7.9"
+VERSION = "0.8.0"
 
 MAIN = Path(__file__).parent.parent.abspath()
 

+ 1 - 1
metadata.txt

@@ -3,7 +3,7 @@
 name = MnCheck
 qgisminimumversion = 3.4
 description = Contrôle des données FTTH format MN
-version = 0.7.7
+version = 0.8.0
 author = Manche Numérique 2019
 email = sig@manchenumerique.fr
 about = Auto-contrôle des livrables FTTH aux formats Manche Numérique

+ 12 - 8
schemas/mn1_rec.py

@@ -48,7 +48,7 @@ class Artere(QgsModel):
               'AR_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
               'AR_DATE_RE': {'empty': True, 'validator': is_modern_french_date}, 
               'AR_REF_PLA': {'type': 'string', 'maxlength': 100}, 
-              'AR_SRC_GEO': {'type': 'string', 'empty': False, 'maxlength': 50}, 
+              'AR_SRC_GEO': {'type': 'string', 'empty': True, '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}, 
@@ -80,7 +80,7 @@ class Cable(QgsModel):
               'CA_NB_FO_D': {'empty': False, 'validator': is_positive_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_DATE_IN': {'empty': True, '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']}}
 
@@ -106,7 +106,7 @@ class Equipement(QgsModel):
               'EQ_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'PRIVE', 'AUTRE', 'NUL']}, 
               'EQ_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'MANCHE FIBRE', 'PRIVE', 'AUTRE', 'NUL']}, 
               'EQ_HAUT': {'empty': True, 'validator': is_float}, 
-              'EQ_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 
+              'EQ_DATE_IN': {'empty': True, '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']}}
         
@@ -125,7 +125,7 @@ class Noeud(QgsModel):
               '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, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']}, 
+              'NO_TECH_PS': {'type': 'string', 'maxlength': 20, 'empty': True, 'multiallowed': ['COAX', 'CUT', 'ECL', 'ELEC', 'VP', 'OPT', 'NC']}, 
               'NO_AMO': {'type': 'string', 'maxlength': 30}, 
               'NO_PLINOX': {'required': False, 'type': 'string', 'maxlength': 3, 'allowed': ['OUI', 'NON']}, 
               'NO_X': {'empty': True, 'validator': is_float}, 
@@ -133,9 +133,9 @@ class Noeud(QgsModel):
               'NO_PRO': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'PRIVE', 'ENEDIS', 'AUTRE', 'NUL']}, 
               'NO_GEST': {'type': 'string', 'maxlength': 20, 'empty': False, 'allowed': ['MANCHE NUMERIQUE', 'MANCHE TELECOM', 'COLLECTIVITE', 'ORANGE', 'ERDF', 'ENEDIS', 'MANCHE FIBRE', 'PRIVE', 'AUTRE', 'NUL']}, 
               'NO_HAUT': {'empty': True, 'validator': is_float}, 
-              'NO_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 
+              'NO_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
               'NO_REF_PLA': {'type': 'string', 'maxlength': 100}, 
-              'NO_SRC_GEO': {'type': 'string', 'empty': False, 'maxlength': 50}, 
+              'NO_SRC_GEO': {'type': 'string', 'empty': True, '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}, 
@@ -160,8 +160,8 @@ class Tranchee(QgsModel):
               '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, 'empty': False, 'type': 'string'}, 
-              'TR_DATE_IN': {'empty': False, 'validator': is_modern_french_date}, 
-              'TR_SRC_GEO': {'type': 'string', 'empty': False, 'maxlength': 50}, 
+              'TR_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
+              'TR_SRC_GEO': {'type': 'string', 'empty': True, 'maxlength': 50}, 
               'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']}, 
               'TR_PRO_MD': {'type': 'string', 'empty': False, 'maxlength': 20, 'allowed': ['MANCHE NUMERIQUE']}, 
               'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 
@@ -544,6 +544,10 @@ class Mn1Checker(BaseChecker):
             if cable.CA_STATUT == "REC" and not cable.CA_DATE_IN:
                 self.log_error("Date d'installation (CA_DATE_IN) manquante", item=cable)
                 
+        for tranchee in self.tranchees:
+            if tranchee.TR_STATUT == "REC" and not tranchee.TR_DATE_IN:
+                self.log_error("Date d'installation (TR_DATE_IN) manquante", item=tranchee)
+                
     def test_dimensions_fourreaux(self):
         """ Dimensions logiques: fourreaux
         Vérifie que les nombres de fourreaux renseignés sont cohérents """

+ 7 - 3
schemas/mn2_rec.py

@@ -156,7 +156,7 @@ class Noeud(QgsModel):
               'NO_HAUT': {'empty': True, 'validator': is_float}, 
               'NO_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
               'NO_REF_PLA': {'type': 'string', 'maxlength': 100}, 
-              'NO_SRC_GEO': {'type': 'string', 'maxlength': 50}, 
+              'NO_SRC_GEO': {'type': 'string', 'empty': True, '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}, 
@@ -186,8 +186,8 @@ class Tranchee(QgsModel):
               '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_DATE_IN': {'empty': True, 'validator': is_modern_french_date}, 
+              'TR_SRC_GEO': {'type': 'string', 'empty': True, 'maxlength': 50}, 
               'TR_QLT_GEO': {'type': 'string', 'empty': False, 'allowed': ['A', 'B', 'C']}, 
               'TR_PRO_MD': {'type': 'string', 'empty': False, 'maxlength': 20, 'allowed': ['MANCHE NUMERIQUE']}, 
               'TR_COMMENT': {'type': 'string', 'maxlength': 300, 'empty': True}, 
@@ -686,6 +686,10 @@ class Mn2Checker(BaseChecker):
         for cable in self.cables:
             if cable.CA_STATUT == "EN SERVICE" and not cable.CA_DATE_IN:
                 self.log_error("Date d'installation (CA_DATE_IN) manquante", item=cable)
+                
+        for tranchee in self.tranchees:
+            if tranchee.TR_STATUT == "EN SERVICE" and not tranchee.TR_DATE_IN:
+                self.log_error("Date d'installation (TR_DATE_IN) manquante", item=tranchee)
                     
     def _za_for_pbo(self, pbo):
         # retourne la ZAPBO correspondant à la PBO en parametre, None si aucune

+ 8 - 8
test/test_mn1_rec.py

@@ -438,21 +438,21 @@ class Test(SchemaTest):
         self.assertSuccess(r)
         self.assertEqual(len(r.errors), 0)
         
-        # equipement hors zapbo
-        _ini_geom = self.checker.equipements[0]._feature.geometry()
-        self.checker.equipements[0]._feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0,0)))
+        # noms equipement / zapbo incoherents
+        eq = next(e for e in self.checker.equipements if e.EQ_TYPE == "PBO")
         
+        eq.EQ_NOM = "%__#123456789#__%"
         r = self.run_test("test_pbos", True)
         self.assertFailure(r)
-        self.assertErrorLogged(r, "Le PBO n'est contenu dans aucune ZAPBO")
+        self.assertErrorLogged(r, "Le nom du PBO ne coincide avec le nom d'aucune des ZAPBO qui le contiennent")
         
-        self.checker.equipements[0]._feature.setGeometry(_ini_geom)
+        # equipement hors zapbo
+        _ini_geom = eq.noeud._feature.geometry()
+        eq.noeud._feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0,0)))
         
-        # noms equipement / zapbo incoherents
-        self.checker.equipements[0].EQ_NOM = "%__#123456789#__%"
         r = self.run_test("test_pbos", True)
         self.assertFailure(r)
-        self.assertErrorLogged(r, "Le nom du PBO ne coincide avec le nom d'aucune des ZAPBO qui le contiennent")
+        self.assertErrorLogged(r, "Le PBO n'est contenu dans aucune ZAPBO")
         
     def test_zapbos_prises(self):
         

+ 8 - 8
test/test_mn2_rec.py

@@ -424,21 +424,21 @@ class Test(SchemaTest):
         self.assertSuccess(r)
         self.assertEqual(len(r.errors), 0)
         
-        # equipement hors zapbo
-        _ini_geom = self.checker.equipements[0]._feature.geometry()
-        self.checker.equipements[0]._feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0,0)))
+        # noms equipement / zapbo incoherents
+        eq = next(e for e in self.checker.equipements if e.EQ_TYPE == "PBO")
         
+        eq.EQ_CODE = "%__#123456789#__%"
         r = self.run_test("test_pbos", True)
         self.assertFailure(r)
-        self.assertErrorLogged(r, "Le PBO n'est contenu dans aucune ZAPBO")
+        self.assertErrorLogged(r, "Le nom du PBO ne coincide avec le nom d'aucune des ZAPBO qui le contiennent")
         
-        self.checker.equipements[0]._feature.setGeometry(_ini_geom)
+        # equipement hors zapbo
+        _ini_geom = eq.noeud._feature.geometry()
+        eq.noeud._feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(0,0)))
         
-        # noms equipement / zapbo incoherents
-        self.checker.equipements[0].EQ_CODE = "%__#123456789#__%"
         r = self.run_test("test_pbos", True)
         self.assertFailure(r)
-        self.assertErrorLogged(r, "Le nom du PBO ne coincide avec le nom d'aucune des ZAPBO qui le contiennent")
+        self.assertErrorLogged(r, "Le PBO n'est contenu dans aucune ZAPBO")
         
     def test_zapbos_prises(self):