A MuleSoft RAML-based API for generating simulated utilities data for testing, development, and demonstration purposes.
The Utilities Generator API provides realistic simulated data for utility companies and related systems without exposing real customer information. This API is designed to support development, testing, integration, and demo environments with consistent, controlled datasets covering meter readings, power consumption, outages, and fault events.
- Meter Readings Generation: Create realistic meter reading data for specified time periods
- Power Consumption Analytics: Generate hourly or daily consumption patterns
- Outage Event Simulation: Simulate power outage events with duration tracking
- Fault Event Generation: Create equipment failure and maintenance events
- Configurable Time Ranges: Generate data for any specified date range
- Location-based Data: Support for location-specific data generation
- RESTful API Design: Clean, intuitive endpoint structure
- RAML 1.0 Specification: Complete API documentation and contracts
/utilities/generate
{
"timestamp": "2024-03-20T10:00:00Z",
"value": 1234.56
}
{
"timestamp": "2024-03-20T10:00:00Z",
"consumption": 750.25
}
{
"start_time": "2024-03-20T14:30:00Z",
"end_time": "2024-03-20T16:45:00Z",
"duration": "2h 15m"
}
{
"timestamp": "2024-03-20T09:15:00Z",
"type": "transformer_overload",
"severity": "high"
}
Generate simulated meter readings for a specific meter and time period.
GET /utilities/generate/meter-readings
Required Parameters:
start_date
(string): Start date (format: YYYY-MM-DD)end_date
(string): End date (format: YYYY-MM-DD)meter_id
(string): Unique meter identifier
Example Request:
GET /utilities/generate/meter-readings?start_date=2024-01-01&end_date=2024-01-31&meter_id=MTR-001
Example Response:
{
"meter_id": "MTR-001",
"readings": [
{
"timestamp": "2024-01-01T00:00:00Z",
"value": 15234.67
},
{
"timestamp": "2024-01-01T01:00:00Z",
"value": 15237.23
}
]
}
Generate simulated power consumption data with configurable intervals.
GET /utilities/generate/power-consumption
Required Parameters:
start_date
(string): Start date (format: YYYY-MM-DD)end_date
(string): End date (format: YYYY-MM-DD)interval
(string): Data interval ("hourly" or "daily")
Optional Parameters:
location
(string): Location identifier
Example Request:
GET /utilities/generate/power-consumption?start_date=2024-01-01&end_date=2024-01-07&interval=hourly&location=LOC-001
Example Response:
{
"location": "LOC-001",
"consumption_data": [
{
"timestamp": "2024-01-01T00:00:00Z",
"consumption": 850.45
},
{
"timestamp": "2024-01-01T01:00:00Z",
"consumption": 723.12
}
]
}
Generate simulated power outage events for analysis and testing.
GET /utilities/generate/outage-data
Required Parameters:
start_date
(string): Start date (format: YYYY-MM-DD)end_date
(string): End date (format: YYYY-MM-DD)
Optional Parameters:
location
(string): Location identifier
Example Request:
GET /utilities/generate/outage-data?start_date=2024-01-01&end_date=2024-01-31&location=LOC-001
Example Response:
{
"location": "LOC-001",
"outages": [
{
"start_time": "2024-01-15T14:30:00Z",
"end_time": "2024-01-15T16:45:00Z",
"duration": "2h 15m"
},
{
"start_time": "2024-01-22T08:15:00Z",
"end_time": "2024-01-22T08:45:00Z",
"duration": "30m"
}
]
}
Generate simulated equipment fault and failure events.
GET /utilities/generate/fault-events
Required Parameters:
start_date
(string): Start date (format: YYYY-MM-DD)end_date
(string): End date (format: YYYY-MM-DD)
Optional Parameters:
location
(string): Location identifier
Example Request:
GET /utilities/generate/fault-events?start_date=2024-01-01&end_date=2024-01-31&location=LOC-001
Example Response:
{
"location": "LOC-001",
"fault_events": [
{
"timestamp": "2024-01-10T09:15:00Z",
"type": "transformer_overload",
"severity": "high"
},
{
"timestamp": "2024-01-18T13:22:00Z",
"type": "line_fault",
"severity": "medium"
}
]
}
- Unit Testing: Generate consistent test data for utility management systems
- Integration Testing: Test system integrations with realistic data patterns
- Load Testing: Generate large volumes of data for performance testing
- End-to-End Testing: Support complete workflow testing without real customer data
- Product Demonstrations: Showcase utility management features with realistic data
- Training Environments: Provide safe, controlled data for user training
- Proof of Concepts: Support pilot projects and prototypes
- Algorithm Testing: Test analytics and machine learning algorithms
- Reporting Validation: Validate reporting systems with known data patterns
- Dashboard Development: Populate dashboards and visualizations during development
- API Specification: RAML 1.0
- Platform: MuleSoft Anypoint Platform
- Exchange Integration: Deployable to MuleSoft Exchange
- Response Format: JSON
/
├── utilities-generator-api.raml # Main API specification
├── exchange.json # MuleSoft Exchange metadata
├── Utilities Generator API.code-workspace # VS Code workspace
├── .mvn/ # Maven configuration
├── .exchange_modules_tmp/ # Build artifacts
└── .vscode/ # VS Code settings
- MuleSoft Anypoint Studio or Design Center
- Access to MuleSoft Anypoint Platform
- Maven (for local builds)
- Clone the repository:
git clone https://github.com/msaleme/Utilities-Generator-API.git
cd Utilities-Generator-API
-
Open in Anypoint Studio:
- Import the project into Anypoint Studio
- The RAML specification will be automatically recognized
-
Design Center Alternative:
- Upload the
utilities-generator-api.raml
file to Design Center - Use the visual editor for modifications
- Upload the
- Publish to Exchange:
mvn clean deploy
- Exchange Configuration:
- Group ID:
7e6f8241-36d8-45cf-abb7-2048a629ae51
- Asset ID:
utilities-generator-api
- Version:
1.0.0
- Group ID:
- Create a Mule application implementing the RAML specification
- Deploy to CloudHub or on-premises Mule runtime
- Use DataWeave for data generation logic
- Use as a contract-first approach for API development
- Implement the backend with any technology stack
- Ensure compliance with the RAML specification
The RAML specification provides interactive documentation that includes:
- Complete endpoint descriptions
- Request/response examples
- Data type definitions
- Parameter validation rules
- MuleSoft Exchange: View published documentation
- API Console: Use RAML console for interactive testing
- Anypoint Studio: Built-in documentation viewer
The API is designed to generate realistic utility data patterns:
- Meter Readings: Progressive incremental values
- Power Consumption: Daily and seasonal usage patterns
- Outages: Random but realistic outage durations
- Fault Events: Various equipment failure types and severities
- Time Ranges: Any date range for historical or future data
- Intervals: Hourly, daily, or custom intervals
- Locations: Multi-location support for complex scenarios
- Volume: Scalable data generation for different testing needs
The API follows standard HTTP status codes:
200 OK
: Successful data generation400 Bad Request
: Invalid parameters or date ranges404 Not Found
: Invalid endpoint500 Internal Server Error
: Data generation failure
Example error response:
{
"error": {
"code": "INVALID_DATE_RANGE",
"message": "End date must be after start date",
"details": {
"start_date": "2024-01-31",
"end_date": "2024-01-01"
}
}
}
- No Real Data: All generated data is simulated and contains no real customer information
- Rate Limiting: Implement appropriate rate limiting for production use
- Authentication: Add authentication layers as needed for your environment
- Data Retention: Generated data should not be persisted beyond testing needs
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Update the RAML specification as needed
- Test your changes in Anypoint Studio or Design Center
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This API follows RAML 1.0 best practices:
- Clear data type definitions
- Consistent naming conventions
- Comprehensive documentation
- Proper parameter validation
- Example requests and responses
This project is licensed under the terms specified in the project documentation.
For questions, issues, or contributions:
- Open an issue on GitHub
- Check MuleSoft community forums for RAML-specific questions
- Review MuleSoft documentation for platform-specific guidance
Future enhancements may include:
- Additional utility data types (gas, water, solar)
- More sophisticated data generation algorithms
- WebSocket support for real-time data streaming
- GraphQL API specification
- Advanced filtering and aggregation options
- Custom data pattern templates
Mike Saleme - GitHub