How nxthanh01/ecometric-ios works
EcoMetric is an iOS application backed by a FastAPI service for operational energy measurement, analysis, recommendations, and action tracking. The principal journey is to enter electricity measurements, persist them by organization, run deterministic time-series analysis, optionally obtain Gemini interpretation, then review recommendations and remeasure results. The graph includes the documented account, reporting, and workflow capabilities. Some connections are based on README architecture documentation; unsampled implementations are represented only at their supported directory or module path.
Main entry points: main.py FastAPI routes · AppAnalysisStore.swift Analysis state · OperationalDataAPIService.swift Operational API · auth_service.py Auth and roles
Components 25
iOS application
- Data input
EcoMetric/EcoMetric/Views/Data/DataInputView.swift - Input state
EcoMetric/EcoMetric/ViewModels/DataInputViewModel.swift - Analysis state
EcoMetric/EcoMetric/ViewModels/AppAnalysisStore.swift - Dashboard
EcoMetric/EcoMetric/Views/Dashboard/DashboardView.swift - Operational API
EcoMetric/EcoMetric/Services/OperationalDataAPIService.swift - Account session
EcoMetric/EcoMetric/ViewModels/AccountSession.swift - Account API
EcoMetric/EcoMetric/Services/AccountAPIService.swift - Authentication
EcoMetric/EcoMetric/Views/Profile/AuthenticationView.swift - AI workspace
EcoMetric/EcoMetric/Views/AI/AIWorkspaceView.swift - Energy reports
EcoMetric/EcoMetric/Views/Reports/ReportsView.swift - PDF export
EcoMetric/EcoMetric/Services/EnergyReportPDFService.swift - Remeasure results
EcoMetric/EcoMetric/Views/Reports/OperationalWorkflowView.swift
Backend API and accounts
- FastAPI routes
ECOMETRIC BACKEND/ecometric-backend/main.py - Auth and roles
ECOMETRIC BACKEND/ecometric-backend/services/auth_service.py - Email delivery
ECOMETRIC BACKEND/ecometric-backend/services/email_service.py
Measurement and analysis
- Dataset storage
ECOMETRIC BACKEND/ecometric-backend/services/data_store_service.py - Database models
ECOMETRIC BACKEND/ecometric-backend/db_models.py - Time-series engine
ECOMETRIC BACKEND/ecometric-backend/services/time_series_service.py
Insights and action
- Gemini insights
ECOMETRIC BACKEND/ecometric-backend/services/gemini_insight_service.py - Recommendations
ECOMETRIC BACKEND/ecometric-backend/services/recommendation_service.py - Knowledge service
ECOMETRIC BACKEND/ecometric-backend/services/knowledge_service.py - Action workflow
ECOMETRIC BACKEND/ecometric-backend/services/workflow_service.py
Other components
- Business user
- PostgreSQL
- Gemini API
Connections 28
- Business user → Data input: enters readings
README.md - Data input → Input state: updates input
EcoMetric/EcoMetric/Views/Data/DataInputView.swift - Input state → Operational API: submits dataset
EcoMetric/EcoMetric/ViewModels/DataInputViewModel.swift - Operational API → FastAPI routes: sends REST requests
EcoMetric/EcoMetric/Services/OperationalDataAPIService.swift - FastAPI routes → Dataset storage: stores datasets
README.md - Dataset storage → Database models: uses ORM models
ECOMETRIC BACKEND/ecometric-backend/services/data_store_service.py - Database models → PostgreSQL: persists records
- FastAPI routes → Time-series engine: runs analysis
README.md - Time-series engine → Gemini insights: provides validated data
README.md - Gemini insights → Gemini API: requests interpretation
README.md - Operational API → Analysis state: returns analysis
EcoMetric/EcoMetric/ViewModels/AppAnalysisStore.swift - Analysis state → Dashboard: feeds dashboard
EcoMetric/EcoMetric/Views/Dashboard/DashboardView.swift - FastAPI routes → Recommendations: routes recommendation requests
ECOMETRIC BACKEND/ecometric-backend/main.py - Recommendations → Knowledge service: uses knowledge records
ECOMETRIC BACKEND/ecometric-backend/services/recommendation_service.py - Analysis state → AI workspace: supplies analysis
- Business user → AI workspace: reviews insights
README.md - FastAPI routes → Action workflow: manages action work
README.md - Business user → Energy reports: reviews reports
README.md - Energy reports → PDF export: exports PDF
README.md - Analysis state → Remeasure results: supplies baseline
EcoMetric/EcoMetric/Views/Reports/RemeasureView.swift - Business user → Remeasure results: compares periods
README.md - Business user → Authentication: signs in
README.md - Authentication → Account session: updates session
EcoMetric/EcoMetric/Views/Profile/AuthenticationView.swift - Account session → Account API: calls account API
EcoMetric/EcoMetric/ViewModels/AccountSession.swift - Account API → FastAPI routes: sends account requests
- FastAPI routes → Auth and roles: handles authentication
ECOMETRIC BACKEND/ecometric-backend/main.py - Auth and roles → Email delivery: sends invitations
ECOMETRIC BACKEND/ecometric-backend/services/auth_service.py - Auth and roles → PostgreSQL: stores sessions