How policyengine/policyengine-uk works
Main modules
• Input/Pre-processing Layer: Represent the collection and fusion of microdata (e.g. the Family Resources Survey and other datasets), including the reweighting process.
• Parameters Module: This is where all system rates, thresholds, and other static elements reside. The “parameters” subfolder (with its extensive substructure for different government departments such as gov, hmrc, dwp, etc.) is a key component.
• Variables Module: Contains all formulas, rules, and calculations that relate the parameters, economic factors, and household data. This folder encapsulates the core computation logic that transforms inputs into outputs.
• Reforms Module: Captures alternative policy scenarios. This module defines how reforms are integrated and run alongside baseline calculations.
• Core Simulation Engine: Located in the “policyengine_uk” folder and through scripts in system.py or repo.py, this engine orchestrates the simulation run. It interacts with the input data, loads parameters and variables, and applies reforms.
Relationships and interactions
• Data Input feeds into a Data Pre-processing Unit that cleans and fuses the microdata.
• The Pre-processed data is then passed to the Simulation Engine.
• The Engine retrieves system parameters from the “parameters” module and computation formulas from the “variables” module.
• Reform options (from the “reforms” module) can override or alter default behavior in the simulation.
• Final outputs (simulation results, policy outcome metrics) are produced after processing the data through the calculation engine.
• The testing framework validates behaviors at each step.
Architectural patterns
• Separation of concerns is evident: one set of modules solely defines static policy parameters, another encapsulates formula computations, and another handles reforms.
Technologies and frameworks
• That the project leverages the PolicyEngine Core framework and is based on OpenFisca—this may be indicated externally.
Final advice
• Since the project is a full-fledged microsimulation tool, emphasize the separation between configuration (parameters/variables), simulation logic, and data input/output.