Remaining Project Updates - Model Redesign Impact Analysis
✅ Completed Projects
efcorelibraries - ✅ COMPLETE
- HTModels: LinkProperty, NodeProperty models created
- EN2Models: ScenarioId removed, Energy simplified, properties removed from Valve/Pump/Tank
- EN2PostgresContext: DbSets and configurations updated
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
- Remove ScenarioId from all DTOs and controller queries
- Update EnergyDto - remove pump-specific properties (PumpId, PumpPrice, etc.)
- Update PumpDto/ValveDto/TankDto - remove properties now in LinkProperty/NodeProperty
- Update controller queries - remove
.Where(x => x.ScenarioId == scenarioId)filters - Fix EnergyController - query only global Energy record
Phase 2: Create New Property Endpoints
- Create LinkPropertiesController
- GET /api/en2/linkproperties?linkId={id}
- GET /api/en2/linkproperties?linkId={id}&propertyId={propId}
- GET /api/en2/links/{linkId}/properties
- 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
- Add property collections to asset DTOs:
- PumpDto.Properties (
List<LinkPropertyDto>) - ValveDto.Properties (
List<LinkPropertyDto>) - TankDto.Properties (
List<NodePropertyDto>)
- PumpDto.Properties (
- 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
- Remove
scenarioIdfrom query parameters - Update Energy API calls (no longer filtered by pump)
- Add calls to new LinkProperties/NodeProperties endpoints
Phase 2: Update Components
- Remove ScenarioId dropdown filters (if any)
- Update property displays:
- Pump properties: fetch from LinkProperties endpoint
- Valve properties: fetch from LinkProperties endpoint
- Tank properties: fetch from NodeProperties endpoint
- Update forms/editors for properties
Phase 3: Update Data Models/Types
- Update TypeScript interfaces (if using TypeScript)
- Remove ScenarioId from model interfaces
- 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:
- Check if aquaqcore2019 references EN2Models
- Check if it queries Energy, Reaction, Quality models
- 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:
- Check if worker function uses EN2PostgresContext
- Check for ScenarioId references
- 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:
- Quick scan for EN2Models references
- Update only if actively used
Estimated Effort: 1 hour assessment, 0-1 hours updates (if needed)
📊 Priority Summary
Immediate Priority (Next Sprint)
| Project | Priority | Effort | Dependencies |
|---|---|---|---|
| dwd-api-aspnet | 🔴 HIGH | 8-12 hrs | None - Start immediately |
| dwd-frontend-react | 🟡 MEDIUM | 6-10 hrs | Requires API updates first |
Later/Optional
| Project | Priority | Effort | Dependencies |
|---|---|---|---|
| dwd-worker-function | 🟢 LOW | 0-2 hrs | Assessment needed |
| aquaqcore2019 | 🟢 LOW | 0-4 hrs | Assessment needed |
| Other utilities | 🟢 VERY LOW | 0-1 hrs | Assessment needed |
🎯 Recommended Approach
Week 1: API Updates
- Day 1-2: Update DTOs, remove ScenarioId
- Day 3: Create LinkPropertiesController, NodePropertiesController
- Day 4: Update existing controllers (Energy, Pump, Valve, Tank)
- Day 5: Testing and validation
Week 2: Frontend Updates
- Day 1: Update API service layer
- Day 2-3: Update components that display properties
- Day 4: Update forms/editors
- Day 5: Testing and validation
Week 3: Optional Updates
- Day 1: Assess worker function
- Day 2: Assess legacy systems
- 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
Create API Update Plan
- Document specific controller changes
- Create DTO change list
- Design new endpoints
Create Frontend Update Plan
- List affected components
- Document API call changes
- Plan property display updates
Schedule Work
- Allocate developer time
- Set milestones
- Plan testing windows
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.