Skip to content

Conversation

@dfcoffin
Copy link
Contributor

Summary

Phase 12 of the ESPI 4.0 schema compliance effort. This PR aligns the ElectricPowerQualitySummaryEntity field order with the ESPI 4.0 XSD schema specification (espi.xsd).

Changes

Entity Updates

  • ElectricPowerQualitySummaryEntity: Moved summaryInterval field from end of field declarations to correct position between shortInterruptions and supplyVoltageDips to match XSD element sequence

Database Migration Updates

  • V3__Create_additiional_Base_Tables.sql: Updated electric_power_quality_summaries table column order to match XSD schema:
    • Moved summary_interval_start and summary_interval_duration columns to position after short_interruptions and before supply_voltage_dips

Verified Components (No Changes Needed)

  • ElectricPowerQualitySummaryDto: Already compliant with XSD @XmlType propOrder
  • ElectricPowerQualitySummaryMapper: Uses MapStruct default field-to-field mapping (correct as-is)
  • ElectricPowerQualitySummaryRepository: All queries preserved (used by tests)
  • ElectricPowerQualitySummaryService: No field order dependencies

ESPI 4.0 XSD Schema Element Sequence

Per espi.xsd ElectricPowerQualitySummary complexType:

  1. flickerPlt (Int48, optional)
  2. flickerPst (Int48, optional)
  3. harmonicVoltage (Int48, optional)
  4. longInterruptions (Int48, optional)
  5. mainsVoltage (Int48, optional)
  6. measurementProtocol (UInt8, optional)
  7. powerFrequency (Int48, optional)
  8. rapidVoltageChanges (Int48, optional)
  9. shortInterruptions (Int48, optional)
  10. summaryInterval (DateTimeInterval, REQUIRED)
  11. supplyVoltageDips (Int48, optional)
  12. supplyVoltageImbalance (Int48, optional)
  13. supplyVoltageVariations (Int48, optional)
  14. tempOvervoltage (Int48, optional)

Testing

All 533 tests passing

Unit Tests

  • H2 in-memory database tests: PASSED

Integration Tests (TestContainers)

  • PostgreSQL 18.1 integration tests: PASSED
  • MySQL 8.0 integration tests: PASSED

Test Coverage

  • ElectricPowerQualitySummaryEntity field validation
  • ElectricPowerQualitySummaryRepository CRUD operations
  • Flyway migration verification (V1, V2, V3)
  • Complex relationship integrity tests
  • Multi-database compatibility (H2, PostgreSQL, MySQL)

Related Work

Checklist

  • Entity field order matches XSD element sequence
  • DTO @XmlType propOrder verified correct
  • Database migration updated to match schema order
  • All 533 tests passing (unit + integration)
  • Flyway migrations verified on H2, MySQL, PostgreSQL
  • No breaking changes to existing APIs
  • Follows existing code patterns from previous phases

🤖 Generated with Claude Code

Aligned ElectricPowerQualitySummaryEntity field order with ESPI 4.0 XSD schema
specification (espi.xsd). Moved summaryInterval field to correct position
between shortInterruptions and supplyVoltageDips to match schema sequence.

Changes:
- ElectricPowerQualitySummaryEntity: Reordered summaryInterval field to match
  XSD element sequence (lines 121-139)
- V3__Create_additiional_Base_Tables.sql: Updated table column order to match
  XSD schema (summary_interval columns now between short_interruptions and
  supply_voltage_dips)

Validation:
- ElectricPowerQualitySummaryDto already compliant with XSD propOrder
- ElectricPowerQualitySummaryMapper uses default MapStruct field mapping
- All repository queries preserved for test usage
- All 533 tests passing (unit + integration with H2, MySQL, PostgreSQL)

Schema Element Order (ESPI 4.0 espi.xsd):
1. flickerPlt
2. flickerPst
3. harmonicVoltage
4. longInterruptions
5. mainsVoltage
6. measurementProtocol
7. powerFrequency
8. rapidVoltageChanges
9. shortInterruptions
10. summaryInterval (DateTimeInterval - REQUIRED)
11. supplyVoltageDips
12. supplyVoltageImbalance
13. supplyVoltageVariations
14. tempOvervoltage

References:
- ESPI 4.0 XSD: espi.xsd ElectricPowerQualitySummary complexType
- Phase plan: Issue #28 Phase 12
- Related: Phase 11 (UsageSummary)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dfcoffin dfcoffin merged commit f2361a9 into main Jan 14, 2026
5 checks passed
@dfcoffin dfcoffin deleted the feature/schema-compliance-phase-12-electric-power-quality-summary branch January 14, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants