Skip to main content

Remaining Project Updates - Model Redesign Impact Analysis

✅ Completed Projects

  1. efcorelibraries - ✅ COMPLETE

    • HTModels: LinkProperty, NodeProperty models created
    • EN2Models: ScenarioId removed, Energy simplified, properties removed from Valve/Pump/Tank
    • EN2PostgresContext: DbSets and configurations updated
  2. epanetconsolecore/NetworkManager - ✅ COMPLETE

    • Parsers: Default filtering, specialized entity processors
    • Builders: Property filtering, default value checks
    • Services: EpanetPropertyDefaults, specialized processors

🔄 Projects Requiring Updates

Project 1: dwd-api-aspnet (ASP.NET Core API)

Priority: 🔴 HIGH - API is the data access layer for the frontend

Impact Analysis

Affected Controllers (17 controllers):

  • ✅ Controllers/EN2/EnergyController.cs
  • ✅ Controllers/EN2/ReactionController.cs
  • ✅ Controllers/EN2/QualityController.cs
  • ✅ Controllers/EN2/StatusController.cs
  • ✅ Controllers/EN2/LeakageController.cs
  • ✅ Controllers/EN2/EmitterController.cs
  • ⚠️ Controllers/EN2/PumpController.cs (references removed properties)
  • ⚠️ Controllers/EN2/ValveController.cs (references removed properties)
  • ⚠️ Controllers/EN2/TankController.cs (references removed properties)
  • ⚠️ Controllers/EN2/TimeParametersController.cs (may reference ScenarioId)
  • ⚠️ Controllers/EN2/OptionsController.cs (may reference ScenarioId)
  • ⚠️ Controllers/EN2/ReportController.cs (may reference ScenarioId)
  • Controllers/EN2/PumpHydrController.cs
  • Controllers/EN2/ValveHydrController.cs
  • Controllers/EN2/TankHydrController.cs
  • Controllers/EN2/PumpQualController.cs
  • Controllers/EN2/ValveQualController.cs
  • Controllers/EN2/TankQualController.cs

Affected DTOs (8 DTOs):

  • ✅ Models/DTOs/EnergyDto.cs - References ScenarioId, PumpId, pump properties
  • ✅ Models/DTOs/ReactionDto.cs - References ScenarioId
  • ✅ Models/DTOs/QualityDto.cs - References ScenarioId
  • ✅ Models/DTOs/StatusDto.cs - References ScenarioId
  • ✅ Models/DTOs/LeakageDto.cs
  • ✅ Models/DTOs/EmitterDto.cs
  • ⚠️ Models/DTOs/PumpDto.cs - May reference removed properties
  • ⚠️ Models/DTOs/ValveDto.cs - May reference removed properties
  • ⚠️ Models/DTOs/TankDto.cs - May reference removed properties

New DTOs/Endpoints Needed:

  • NEW: LinkPropertyDto
  • NEW: NodePropertyDto
  • NEW: Controllers/EN2/LinkPropertiesController.cs
  • NEW: Controllers/EN2/NodePropertiesController.cs

Required Changes

Phase 1: Update Existing Controllers & DTOs

  1. Remove ScenarioId from all DTOs and controller queries
  2. Update EnergyDto - remove pump-specific properties (PumpId, PumpPrice, etc.)
  3. Update PumpDto/ValveDto/TankDto - remove properties now in LinkProperty/NodeProperty
  4. Update controller queries - remove .Where(x => x.ScenarioId == scenarioId) filters
  5. Fix EnergyController - query only global Energy record

Phase 2: Create New Property Endpoints

  1. Create LinkPropertiesController
    • GET /api/en2/linkproperties?linkId={id}
    • GET /api/en2/linkproperties?linkId={id}&propertyId={propId}
    • GET /api/en2/links/{linkId}/properties
  2. Create NodePropertiesController
    • GET /api/en2/nodeproperties?nodeId={id}
    • GET /api/en2/nodeproperties?nodeId={id}&propertyId={propId}
    • GET /api/en2/nodes/{nodeId}/properties

Phase 3: Update Response Models

  1. Add property collections to asset DTOs:
    • PumpDto.Properties (List<LinkPropertyDto>)
    • ValveDto.Properties (List<LinkPropertyDto>)
    • TankDto.Properties (List<NodePropertyDto>)
  2. Use navigation properties in queries to include properties

Estimated Effort: 8-12 hours

  • 4-6 hours: Update DTOs and remove ScenarioId
  • 2-3 hours: Create new controllers and endpoints
  • 2-3 hours: Testing and validation

Project 2: dwd-frontend-react (React Frontend)

Priority: 🟡 MEDIUM - Depends on API updates

Impact Analysis

Affected Components (estimated 10-15 components):

  • Components that display Energy data
  • Components that display Reaction data
  • Components that display Quality, Status, Leakage, Emitter data
  • Components that filter by ScenarioId
  • Forms that edit pump/valve/tank properties
  • Network visualization components showing properties

Affected API Calls:

  • Any fetch() calls to /api/en2/energy
  • Any fetch() calls to /api/en2/reaction
  • Any fetch() calls to /api/en2/quality, status, leakage, emitter
  • Any queries with scenarioId parameter

Required Changes

Phase 1: Update API Calls

  1. Remove scenarioId from query parameters
  2. Update Energy API calls (no longer filtered by pump)
  3. Add calls to new LinkProperties/NodeProperties endpoints

Phase 2: Update Components

  1. Remove ScenarioId dropdown filters (if any)
  2. Update property displays:
    • Pump properties: fetch from LinkProperties endpoint
    • Valve properties: fetch from LinkProperties endpoint
    • Tank properties: fetch from NodeProperties endpoint
  3. Update forms/editors for properties

Phase 3: Update Data Models/Types

  1. Update TypeScript interfaces (if using TypeScript)
  2. Remove ScenarioId from model interfaces
  3. Add LinkProperty/NodeProperty interfaces

Estimated Effort: 6-10 hours

  • 2-3 hours: Update API service layer
  • 3-5 hours: Update components and displays
  • 1-2 hours: Testing

Project 3: aquaqcore2019 (Legacy Quality Core)

Priority: 🟢 LOW - Legacy system, may not need updates

Impact Analysis

Likely Not Affected:

  • Uses older NetworkModel with different structure
  • May not interact with new EN2Models directly
  • Self-contained simulation engine

Required Changes

Assessment Needed:

  1. Check if aquaqcore2019 references EN2Models
  2. Check if it queries Energy, Reaction, Quality models
  3. Determine if it needs to be updated or can remain unchanged

Estimated Effort: 1-2 hours assessment, 0-4 hours updates (if needed)


Project 4: dwd-worker-function (Azure Function Worker)

Priority: 🟢 LOW - Background worker

Impact Analysis

Possible Impact:

  • If worker processes network data, may reference models
  • If worker queries Energy/Reaction data, needs updates

Required Changes

Assessment Needed:

  1. Check if worker function uses EN2PostgresContext
  2. Check for ScenarioId references
  3. Update queries if needed

Estimated Effort: 1-2 hours assessment, 0-2 hours updates (if needed)


Project 5: Other Utilities (htsx, htex, htutility, httl)

Priority: 🟢 VERY LOW - Utilities, likely not affected

Impact Analysis

Likely Not Affected:

  • These appear to be standalone utilities
  • May not reference EN2Models

Required Changes

Assessment Needed:

  1. Quick scan for EN2Models references
  2. Update only if actively used

Estimated Effort: 1 hour assessment, 0-1 hours updates (if needed)


📊 Priority Summary

Immediate Priority (Next Sprint)

ProjectPriorityEffortDependencies
dwd-api-aspnet🔴 HIGH8-12 hrsNone - Start immediately
dwd-frontend-react🟡 MEDIUM6-10 hrsRequires API updates first

Later/Optional

ProjectPriorityEffortDependencies
dwd-worker-function🟢 LOW0-2 hrsAssessment needed
aquaqcore2019🟢 LOW0-4 hrsAssessment needed
Other utilities🟢 VERY LOW0-1 hrsAssessment needed

Week 1: API Updates

  1. Day 1-2: Update DTOs, remove ScenarioId
  2. Day 3: Create LinkPropertiesController, NodePropertiesController
  3. Day 4: Update existing controllers (Energy, Pump, Valve, Tank)
  4. Day 5: Testing and validation

Week 2: Frontend Updates

  1. Day 1: Update API service layer
  2. Day 2-3: Update components that display properties
  3. Day 4: Update forms/editors
  4. Day 5: Testing and validation

Week 3: Optional Updates

  1. Day 1: Assess worker function
  2. Day 2: Assess legacy systems
  3. Day 3-5: Updates if needed, otherwise move to next feature

🔍 Assessment Checklist

Before starting each project, verify:

  • Does it reference EN2PostgresContext?
  • Does it query Energy, Reaction, Quality, Status models?
  • Does it filter by ScenarioId?
  • Does it access pump/valve/tank properties?
  • Is it actively used in production?

📝 Testing Strategy

API Testing

  • Verify all controllers compile
  • Test Energy endpoint (returns single global record)
  • Test LinkProperties endpoint
  • Test NodeProperties endpoint
  • Verify ScenarioId removal doesn't break queries
  • Test pump/valve/tank endpoints with new structure

Frontend Testing

  • Verify all API calls work
  • Test property displays (pumps, valves, tanks)
  • Test forms/editors
  • Verify no ScenarioId references remain
  • Test network visualization

Integration Testing

  • End-to-end: Import INP → Query API → Display in Frontend
  • Verify default filtering works
  • Verify property updates work
  • Verify no duplicate keys

🚀 Next Steps

  1. Create API Update Plan

    • Document specific controller changes
    • Create DTO change list
    • Design new endpoints
  2. Create Frontend Update Plan

    • List affected components
    • Document API call changes
    • Plan property display updates
  3. Schedule Work

    • Allocate developer time
    • Set milestones
    • Plan testing windows
  4. Execute Updates

    • Start with API (high priority)
    • Move to Frontend (depends on API)
    • Assess legacy systems (optional)

✅ Success Criteria

API Updates Complete When:

  • All controllers compile
  • All DTOs reflect new model structure
  • New property endpoints exist and work
  • No ScenarioId references remain
  • All tests pass

Frontend Updates Complete When:

  • All components display data correctly
  • Property values show properly
  • Forms/editors work
  • No console errors
  • User experience unchanged

Project Complete When:

  • API and Frontend working
  • Legacy systems assessed
  • Documentation updated
  • Production deployment successful

Status: READY FOR PLANNING 📋

Next action: Begin API update planning and DTO redesign.