civics-cdf-validator 1.56.dev1__tar.gz → 1.56.dev3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {civics_cdf_validator-1.56.dev1/civics_cdf_validator.egg-info → civics_cdf_validator-1.56.dev3}/PKG-INFO +1 -1
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/rules.py +44 -15
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/version.py +1 -1
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/README.md +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/__init__.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/base.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/loggers.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/office_utils.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/setup.cfg +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/setup.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/stats.py +0 -0
- {civics_cdf_validator-1.56.dev1 → civics_cdf_validator-1.56.dev3}/validator.py +0 -0
|
@@ -633,18 +633,6 @@ class GpUnitOcdId(base.BaseRule):
|
|
|
633
633
|
)
|
|
634
634
|
|
|
635
635
|
|
|
636
|
-
# TODO(b/337001513): Remove this once the new rule is rolled out everywhere and
|
|
637
|
-
# no feeds have this in their disabled rules anymore.
|
|
638
|
-
class ElectoralDistrictOcdId(base.BaseRule):
|
|
639
|
-
"""All GpUnits MUST have a valid OCD ID."""
|
|
640
|
-
|
|
641
|
-
def elements(self):
|
|
642
|
-
return ["ReportingUnit"]
|
|
643
|
-
|
|
644
|
-
def check(self, element):
|
|
645
|
-
pass
|
|
646
|
-
|
|
647
|
-
|
|
648
636
|
class DuplicatedGpUnitOcdId(base.BaseRule):
|
|
649
637
|
"""2 GpUnits should not have same OCD ID."""
|
|
650
638
|
|
|
@@ -4341,7 +4329,7 @@ class SourceDirPathMustBeSetAfterInitialDeliveryDate(base.BaseRule):
|
|
|
4341
4329
|
)
|
|
4342
4330
|
|
|
4343
4331
|
|
|
4344
|
-
class
|
|
4332
|
+
class OfficeholderSubFeedDatesAreSequential(base.DateRule):
|
|
4345
4333
|
"""Dates in an OfficeHolderSubFeed element should be sequential."""
|
|
4346
4334
|
|
|
4347
4335
|
def elements(self):
|
|
@@ -4732,6 +4720,47 @@ class NoExtraElectionReportCollections(base.BaseRule):
|
|
|
4732
4720
|
)
|
|
4733
4721
|
|
|
4734
4722
|
|
|
4723
|
+
class FeedElementsShouldHaveSubElementsBasedOnType(base.BaseRule):
|
|
4724
|
+
"""Feeds should have certain elements based on feed type.
|
|
4725
|
+
|
|
4726
|
+
For example, Feeds of type officeHolder should have an OfficeHolderSubFeed,
|
|
4727
|
+
similarly pre-election and election-results feeds should have an
|
|
4728
|
+
ElectionEventCollection. In the case of an ElectionEventCollection, at least
|
|
4729
|
+
one ElectionEvent element should be present.
|
|
4730
|
+
"""
|
|
4731
|
+
|
|
4732
|
+
def elements(self):
|
|
4733
|
+
return ["Feed"]
|
|
4734
|
+
|
|
4735
|
+
def check(self, element):
|
|
4736
|
+
feed_type = element.find("FeedType")
|
|
4737
|
+
feed_id = element.find("FeedId").text
|
|
4738
|
+
|
|
4739
|
+
if not element_has_text(feed_type):
|
|
4740
|
+
return
|
|
4741
|
+
|
|
4742
|
+
feed_type = feed_type.text
|
|
4743
|
+
if feed_type == "officeholder":
|
|
4744
|
+
if element.find("OfficeholderSubFeed") is None:
|
|
4745
|
+
raise loggers.ElectionError.from_message(
|
|
4746
|
+
"OfficeholderSubFeed should exist for %s feed %s."
|
|
4747
|
+
% (feed_type, feed_id)
|
|
4748
|
+
)
|
|
4749
|
+
elif feed_type == "pre-election" or feed_type == "election-results":
|
|
4750
|
+
if element.find("ElectionEventCollection") is None:
|
|
4751
|
+
raise loggers.ElectionError.from_message(
|
|
4752
|
+
"ElectionEventCollection should exist for %s feed %s."
|
|
4753
|
+
% (feed_type, feed_id)
|
|
4754
|
+
)
|
|
4755
|
+
if not element.find("ElectionEventCollection").findall(
|
|
4756
|
+
"ElectionEvent"
|
|
4757
|
+
):
|
|
4758
|
+
raise loggers.ElectionError.from_message(
|
|
4759
|
+
"ElectionEventCollection should have at least one ElectionEvent"
|
|
4760
|
+
" for %s feed %s." % (feed_type, feed_id)
|
|
4761
|
+
)
|
|
4762
|
+
|
|
4763
|
+
|
|
4735
4764
|
class RuleSet(enum.Enum):
|
|
4736
4765
|
"""Names for sets of rules used to validate a particular feed type."""
|
|
4737
4766
|
|
|
@@ -4826,7 +4855,6 @@ ELECTION_RULES = COMMON_RULES + (
|
|
|
4826
4855
|
ElectionStartDates,
|
|
4827
4856
|
ElectionTypesAndCandidateContestTypesAreCompatible,
|
|
4828
4857
|
ElectionTypesAreCompatible,
|
|
4829
|
-
ElectoralDistrictOcdId,
|
|
4830
4858
|
FullTextMaxLength,
|
|
4831
4859
|
FullTextOrBallotText,
|
|
4832
4860
|
GpUnitsHaveSingleRoot,
|
|
@@ -4888,12 +4916,13 @@ METADATA_RULES = (
|
|
|
4888
4916
|
# go/keep-sorted start
|
|
4889
4917
|
ElectionEventDatesAreSequential,
|
|
4890
4918
|
Encoding,
|
|
4919
|
+
FeedElementsShouldHaveSubElementsBasedOnType,
|
|
4891
4920
|
FeedHasValidCountryCode,
|
|
4892
4921
|
FeedIdsAreUnique,
|
|
4893
4922
|
FeedInactiveDateIsLatestDate,
|
|
4894
4923
|
FeedInactiveDateSetForNonEvergreenFeed,
|
|
4895
4924
|
FeedTypeHasValidFeedLongevity,
|
|
4896
|
-
|
|
4925
|
+
OfficeholderSubFeedDatesAreSequential,
|
|
4897
4926
|
OptionalAndEmpty,
|
|
4898
4927
|
Schema,
|
|
4899
4928
|
SourceDirPathMustBeSetAfterInitialDeliveryDate,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|