Core Purpose
- Data Transformation: Convert external data formats into form-compatible values
- Multi-Site Support: Process data for multiple sites in a single import
- Type Preservation: Support numeric, string, and boolean output values
- Period Handling: Map data to YEARLY, MONTHLY, or QUARTERLY periods
Definition Structure
Input Schema
Defines the expected columns from the source file:string: Text valuesnumber: Numeric values (auto-converted from strings)boolean: True/false (accepts “true”, “1”, “yes”)
site_identifier: Used to match rows to sites in grouped outputs
Output Schema
Defines the fields produced by the transformation:YEARLY: Single value per year (default)MONTHLY: Values for periods 1-12QUARTERLY: Values for periods 1-4
Processor Code
JavaScript code that transforms input rows into output values:inputValues: Array of input row objects$year: The target year for the import
Value Type Support
The import system preserves all output types: Numeric values:Import Execution Flow
1. Column Detection: System matches file columns to input schema 2. Column Mapping: User confirms or adjusts column assignments 3. Preview: Processor runs on sample data to show expected results 4. Output Mapping: User maps output fields to form elements 5. Execution: System processes all rows and creates submissions 6. Results: ImportResult records track what was importedMulti-Site Imports
For files containing data for multiple sites: Input file:Access Control
- Imports respect site access permissions
- Users can only import to sites they have access to
- Groups for inaccessible sites are silently skipped
Import Records
Each import execution creates: Import: Parent record with status and row count ImportResult: Per-site results with:- Processed data snapshot
- Field mappings with values inserted
- Period metadata
Real-World Examples
Utility Bill Import:- Input: Monthly utility bills in CSV
- Output: Monthly energy consumption per site
- Mapping: Consumption field → Energy form element
- Input: Supplier emissions spreadsheet
- Output: Scope 1, 2, 3 values with category labels
- Mapping: Multiple outputs → Assessment form
- Input: Financial reports with quarterly figures
- Output: Revenue and cost by quarter
- Mapping: Q1-Q4 values → Financial form elements

