Skip to content

Commit

Permalink
Merge pull request #725 from communitiesuk/RFP-453_validation-constan…
Browse files Browse the repository at this point in the history
…ts-shared-vs-round-specific

RFP-453 - Precursor - Separating shared and round-specific validation constants
  • Loading branch information
wjrm500 authored Sep 20, 2024
2 parents d883293 + d417036 commit 0f6e493
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 66 deletions.
2 changes: 1 addition & 1 deletion data_store/table_extraction/config/pf_r1_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
the data.
"""

from data_store.validation.pathfinders.r1_consts import PFEnums
from data_store.validation.pathfinders.schema_validation import checks
from data_store.validation.pathfinders.schema_validation.columns import (
datetime_column,
float_column,
int_column,
string_column,
)
from data_store.validation.pathfinders.schema_validation.consts import PFEnums

PF_TABLE_CONFIG: dict[str, dict[str, dict]] = {
"Reporting period": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,6 @@ class PFRegex:
)


class PFEnums:
"""
Lists of allowed values used for validation of dropdown fields in Pathfinders reporting template.
"""

ACTUAL_FORECAST = ["Actual", "Forecast", "Cancelled"]
INTERVENTION_THEMES = [
"Employment & Education",
"Enhancing subregional and regional connectivity",
"Improving the quality of life of residents",
"Strengthening the visitor and local service economy",
"Unlocking and enabling industrial, commercial, and residential development",
"Unlocking and enabling industrial and commercial development",
]
RAGS = ["Green", "Amber/Green", "Amber", "Amber/Red", "Red"]
REPORTING_PERIOD = [
"Q4 2023/24: Jan 2024 - Mar 2024",
"Q1 2024/25: Apr 2024 - Jun 2024",
"Q2 2024/25: Jul 2024 - Sep 2024",
"Q3 2024/25: Oct 2024 - Dec 2024",
"Q4 2024/25: Jan 2025 - Mar 2025",
"Q1 2025/26: Apr 2025 - Jun 2025",
"Q2 2025/26: Jul 2025 - Sep 2025",
"Q3 2025/26: Oct 2025 - Dec 2025",
"Q4 2025/26: Jan 2026 - Mar 2026",
]
RISK_CATEGORIES = [
"Arm’s length body risks",
"Commercial or procurement risks",
"Delivery Partner",
"Financial flexibility",
"Financial risks",
"Governance risks",
"Legal, regulatory or compliance risks",
"Local government risks",
"Operational process or control risks",
"People risks",
"Planning Permission / other consents",
"Political sensitivity",
"Procurement / contracting",
"Programme or project delivery risks",
"Reputational Risk",
"Resilience risks",
"Resource & Expertise",
"Security risks",
"Slippage",
"Strategy risks",
"Subsidy Control",
"System or IT infrastructure risks",
"Other",
]
RISK_SCORES = ["1 - Very Low", "2 - Low", "3 - Medium", "4 - High", "5 - Very High"]
SPEND_TYPE = [
"How much of your forecast is contractually committed?",
"How much of your forecast is not contractually committed?",
"Freedom and flexibilities spend",
"Total DLUHC spend (inc. F&F)",
"Secured match funding spend",
"Unsecured match funding",
"Total match",
]


class PFErrors:
"""
Error messages for Pathfinders reporting template validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from data_store.messaging import Message
from data_store.transformation.pathfinders.consts import PF_REPORTING_PERIOD_TO_DATES_PFCS
from data_store.validation.pathfinders.consts import PFErrors
from data_store.validation.pathfinders.cross_table_validation import common
from data_store.validation.pathfinders.schema_validation.consts import PFErrors


def cross_table_validate(extracted_table_dfs: dict[str, pd.DataFrame]) -> list[Message]:
Expand Down
61 changes: 61 additions & 0 deletions data_store/validation/pathfinders/r1_consts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
class PFEnums:
"""
Lists of allowed values used for validation of dropdown fields in Pathfinders R1 reporting template.
"""

ACTUAL_FORECAST = ["Actual", "Forecast", "Cancelled"]
INTERVENTION_THEMES = [
"Employment & Education",
"Enhancing subregional and regional connectivity",
"Improving the quality of life of residents",
"Strengthening the visitor and local service economy",
"Unlocking and enabling industrial, commercial, and residential development",
"Unlocking and enabling industrial and commercial development",
]
RAGS = ["Green", "Amber/Green", "Amber", "Amber/Red", "Red"]
REPORTING_PERIOD = [
"Q4 2023/24: Jan 2024 - Mar 2024",
"Q1 2024/25: Apr 2024 - Jun 2024",
"Q2 2024/25: Jul 2024 - Sep 2024",
"Q3 2024/25: Oct 2024 - Dec 2024",
"Q4 2024/25: Jan 2025 - Mar 2025",
"Q1 2025/26: Apr 2025 - Jun 2025",
"Q2 2025/26: Jul 2025 - Sep 2025",
"Q3 2025/26: Oct 2025 - Dec 2025",
"Q4 2025/26: Jan 2026 - Mar 2026",
]
RISK_CATEGORIES = [
"Arm’s length body risks",
"Commercial or procurement risks",
"Delivery Partner",
"Financial flexibility",
"Financial risks",
"Governance risks",
"Legal, regulatory or compliance risks",
"Local government risks",
"Operational process or control risks",
"People risks",
"Planning Permission / other consents",
"Political sensitivity",
"Procurement / contracting",
"Programme or project delivery risks",
"Reputational Risk",
"Resilience risks",
"Resource & Expertise",
"Security risks",
"Slippage",
"Strategy risks",
"Subsidy Control",
"System or IT infrastructure risks",
"Other",
]
RISK_SCORES = ["1 - Very Low", "2 - Low", "3 - Medium", "4 - High", "5 - Very High"]
SPEND_TYPE = [
"How much of your forecast is contractually committed?",
"How much of your forecast is not contractually committed?",
"Freedom and flexibilities spend",
"Total DLUHC spend (inc. F&F)",
"Secured match funding spend",
"Unsecured match funding",
"Total match",
]
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import pandera as pa

from data_store.transformation.utils import POSTCODE_REGEX
from data_store.validation.pathfinders.schema_validation.consts import PFErrors, PFRegex
from data_store.validation.pathfinders.consts import PFErrors, PFRegex


def _should_fail_check_because_element_is_nan(element) -> Literal[True] | None:
Expand Down

0 comments on commit 0f6e493

Please sign in to comment.