turash/bugulma/backend/internal/financial/config.go
Damir Mukimov 000eab4740
Major repository reorganization and missing backend endpoints implementation
Repository Structure:
- Move files from cluttered root directory into organized structure
- Create archive/ for archived data and scraper results
- Create bugulma/ for the complete application (frontend + backend)
- Create data/ for sample datasets and reference materials
- Create docs/ for comprehensive documentation structure
- Create scripts/ for utility scripts and API tools

Backend Implementation:
- Implement 3 missing backend endpoints identified in gap analysis:
  * GET /api/v1/organizations/{id}/matching/direct - Direct symbiosis matches
  * GET /api/v1/users/me/organizations - User organizations
  * POST /api/v1/proposals/{id}/status - Update proposal status
- Add complete proposal domain model, repository, and service layers
- Create database migration for proposals table
- Fix CLI server command registration issue

API Documentation:
- Add comprehensive proposals.md API documentation
- Update README.md with Users and Proposals API sections
- Document all request/response formats, error codes, and business rules

Code Quality:
- Follow existing Go backend architecture patterns
- Add proper error handling and validation
- Match frontend expected response schemas
- Maintain clean separation of concerns (handler -> service -> repository)
2025-11-25 06:01:16 +01:00

88 lines
2.2 KiB
Go

package financial
// Config holds all financial calculation configuration
type Config struct {
// NPV/IRR parameters
DefaultDiscountRate float64 `json:"default_discount_rate"`
DefaultProjectLife int `json:"default_project_life"`
// CAPEX estimation parameters (€/km)
CapexPerKm map[string]float64 `json:"capex_per_km"`
// Transport cost rates (€/km/unit)
TransportRates map[string]float64 `json:"transport_rates"`
// CO2 calculation parameters
GridEmissionFactor float64 `json:"grid_emission_factor"` // t CO₂/MWh
HeatEfficiency float64 `json:"heat_efficiency"`
UtilizationRate float64 `json:"utilization_rate"`
WaterTreatmentKwh float64 `json:"water_treatment_kwh"` // kWh/m³
WasteDiversionCo2 float64 `json:"waste_diversion_co2"` // t CO₂/tonne
CompostCarbonSeq float64 `json:"compost_carbon_seq"` // t CO₂/tonne compost
// OPEX parameters
OpexPctOfCapex float64 `json:"opex_pct_of_capex"`
// Sensitivity analysis parameters
SensitivityVariations []float64 `json:"sensitivity_variations"`
// Risk assessment parameters
RiskThresholds RiskThresholds `json:"risk_thresholds"`
}
// RiskThresholds defines risk level boundaries
type RiskThresholds struct {
Low float64 `json:"low"`
Medium float64 `json:"medium"`
High float64 `json:"high"`
}
// DefaultConfig returns the default configuration
func DefaultConfig() *Config {
return &Config{
DefaultDiscountRate: 0.08, // 8%
DefaultProjectLife: 10,
CapexPerKm: map[string]float64{
"heat": 50000,
"water": 30000,
"steam": 60000,
"CO2": 10000,
"biowaste": 5000,
"cooling": 50000,
"materials": 5000,
"logistics": 1000,
"service": 0,
},
TransportRates: map[string]float64{
"heat": 0.0005,
"water": 0.001,
"steam": 0.0005,
"CO2": 0.002,
"biowaste": 0.003,
"cooling": 0.0005,
"materials": 0.002,
"logistics": 0.001,
"service": 0.0,
},
GridEmissionFactor: 0.3,
HeatEfficiency: 0.9,
UtilizationRate: 0.7,
WaterTreatmentKwh: 1.0,
WasteDiversionCo2: 0.5,
CompostCarbonSeq: 0.1,
OpexPctOfCapex: 0.03,
SensitivityVariations: []float64{-0.2, -0.1, 0.1, 0.2},
RiskThresholds: RiskThresholds{
Low: 0.3,
Medium: 0.6,
High: 0.8,
},
}
}