fix(classification): restore service logic and standardization formula

- Restored missing method implementations in ClassificationService (classify, extract_metrics)
- Fixed Standardization Logic not being applied in metric cascade
- Bumped version to v0.7.4 in config.py
- Removed duplicate API endpoint in app.py
- Updated MIGRATION_PLAN.md
This commit is contained in:
2026-01-24 13:34:04 +00:00
parent 2fec632e79
commit a9bc8b1ab1
4 changed files with 140 additions and 55 deletions

View File

@@ -342,47 +342,6 @@ def override_impressum(company_id: int, url: str, background_tasks: BackgroundTa
db.commit()
return {"status": "updated"}
@app.get("/api/companies/export")
def export_companies_csv(db: Session = Depends(get_db)):
"""
Exports a CSV of all companies with their key metrics.
"""
import io
import csv
from fastapi.responses import StreamingResponse
output = io.StringIO()
writer = csv.writer(output)
# Header
writer.writerow([
"ID", "Name", "Website", "City", "Country", "AI Industry",
"Metric Name", "Metric Value", "Metric Unit", "Standardized Value (m2)",
"Source", "Source URL", "Confidence", "Proof Text"
])
companies = db.query(Company).order_by(Company.name.asc()).all()
for c in companies:
writer.writerow([
c.id, c.name, c.website, c.city, c.country, c.industry_ai,
c.calculated_metric_name,
c.calculated_metric_value,
c.calculated_metric_unit,
c.standardized_metric_value,
c.metric_source,
c.metric_source_url,
c.metric_confidence,
c.metric_proof_text
])
output.seek(0)
return StreamingResponse(
output,
media_type="text/csv",
headers={"Content-Disposition": f"attachment; filename=company_export_{datetime.utcnow().strftime('%Y-%m-%d')}.csv"}
)
def run_wikipedia_reevaluation_task(company_id: int):