Files
Brancheneinstufung2/company-explorer/diagnose_wolfra.py
Floke e43e129771 feat: robust metric extraction with confidence score and proof snippets
- fixed Year-Prefix Bug in MetricParser
- added metric_confidence and metric_proof_text to database
- added Entity-Check and Annual-Priority to LLM prompt
- improved UI: added confidence traffic light and mouse-over proof tooltip
- restored missing API endpoints (create, bulk, wiki-override)
2026-01-23 21:16:07 +00:00

42 lines
1.4 KiB
Python

import sys
import os
import logging
# Add backend to path
sys.path.append(os.path.join(os.getcwd(), 'backend'))
from backend.database import SessionLocal, Company, Industry
from backend.services.classification import ClassificationService
# Setup basic logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def run_wolfra_reevaluation():
db = SessionLocal()
try:
# Find Wolfra
company = db.query(Company).filter(Company.name.ilike("%Wolfra%")).first()
if not company:
logger.error("Wolfra not found in DB")
return
industry = db.query(Industry).filter(Industry.name == company.industry_ai).first()
if not industry:
logger.error(f"Industry '{company.industry_ai}' for Wolfra not found.")
return
logger.info(f"Starting targeted re-evaluation for {company.name} (ID: {company.id})")
classifier = ClassificationService()
updated_company = classifier.reevaluate_wikipedia_metric(company, db, industry)
logger.info("--- Re-evaluation Result ---")
print(f"Final Calculated Metric: {updated_company.calculated_metric_value} {updated_company.calculated_metric_unit}")
finally:
db.close()
if __name__ == "__main__":
run_wolfra_reevaluation()