A Node.js project that processes energy contract pricing data from CSV files and generates structured JSON output for use in Gladys Assistant.
This project processes energy contract pricing data from any energy providers and converts it into a standardized JSON format. It supports multiple contract types with different pricing structures.
- contract: Contract type identifier
- price_type: Always "consumption" for energy consumption pricing
- currency: "euro", "usd"
- start_date: Start date of the pricing period (ISO format YYYY-MM-DD)
- end_date: End date of the pricing period (ISO format YYYY-MM-DD, null for open-ended)
- price: Price in currency (multiplied by 10000 for integer precision)
- hour_slots: Time slots when the price applies (contract-specific format)
- day_type: Day classification for Tempo contracts ("blue", "white", "red")
# Clone the repository
git clone <repository-url>
cd gladys-energy-contracts
# Install dependencies
npm install# Generate contracts.json file
npm run build# Run validation tests
npm testThe project uses a modular structure where each contract type has its own convert.js file that processes the corresponding CSV data. The main process.js script automatically discovers and executes all converter functions.
To add a new contract type:
- Create a new directory under
contracts/ - Add your CSV data file
- Create a
convert.jsfile that exports a function returning the processed data - The main process will automatically include it
- Fork the repository
- Create a feature branch
- Make your changes
- Run build:
npm run build - Ensure tests pass:
npm test - Submit a pull request
The CI/CD pipeline will automatically validate your changes before they can be merged.