feat: initial implementation taller-wox.fitlabs.dev

Portal FastAPI + 5 endpoints REST para Bootcamp Agentic AI con
watsonx Orchestrate (FactorIT). Single container, Coolify-ready.

- Landing brandeado FIT con formulario de registro (honeypot anti-bot)
- Tokens itsdangerous para descargas (24h expiry)
- 5 endpoints API: historical/available procedures, member-insights,
  schedule, generate-report (Jinja2 + Plotly)
- SQLite con upsert-on-email para leads + log de descargas
- Admin endpoints (HTTP Basic): leads.json, leads.csv, stats
- 23 tests pytest pasando
- Dockerfile listo para Coolify con volúmenes persistentes
  (/app/leads.db, /app/app/data/reports_output, /app/material)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-13 03:01:44 +00:00
commit a062b45c51
57 changed files with 8035 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
def test_member_insights_returns_static_object(client):
response = client.get("/api/member-insights")
assert response.status_code == 200
body = response.json()
assert body["result"]["member"]["name"] == "Charlie Smith"
assert body["result"]["member"]["plan"] == "Gold PPO"
assert len(body["result"]["overdue_procedures"]) == 4
def test_schedule_returns_text_wrapped(client):
response = client.get("/api/schedule")
assert response.status_code == 200
body = response.json()
assert "agendar una cita" in body["result"].lower()
assert "1-800-FIT-CARE" in body["result"]
def test_historical_procedures_no_filter_returns_all(client):
response = client.post(
"/api/historical-procedures",
json={"filters": "[]", "group_by": "[]"},
)
assert response.status_code == 200
assert len(response.json()["result"]) == 50
def test_historical_procedures_filter_equals(client):
response = client.post(
"/api/historical-procedures",
json={
"filters": '[{"column": "member_name", "operator": "equals", "value": "Charlie Smith"}]',
"group_by": "[]",
},
)
rows = response.json()["result"]
assert len(rows) == 5
assert all(r["member_name"] == "Charlie Smith" for r in rows)
def test_historical_procedures_filter_contains(client):
response = client.post(
"/api/historical-procedures",
json={
"filters": '[{"column": "procedure", "operator": "contains", "value": "mri"}]',
"group_by": "[]",
},
)
rows = response.json()["result"]
assert len(rows) > 0
assert all("MRI" in r["procedure"] for r in rows)
def test_historical_procedures_filter_gt(client):
response = client.post(
"/api/historical-procedures",
json={
"filters": '[{"column": "total_cost", "operator": "gt", "value": 5000}]',
"group_by": "[]",
},
)
rows = response.json()["result"]
assert len(rows) > 0
assert all(r["total_cost"] > 5000 for r in rows)
def test_available_procedures_no_filter(client):
response = client.post(
"/api/available-procedures",
json={"filters": "[]", "group_by": "[]"},
)
rows = response.json()["result"]
assert len(rows) == 28
def test_available_procedures_filter_mri(client):
response = client.post(
"/api/available-procedures",
json={
"filters": '[{"column": "procedure", "operator": "contains", "value": "MRI"}]',
"group_by": "[]",
},
)
rows = response.json()["result"]
assert len(rows) >= 3
assert all(r["procedure"] == "MRI" for r in rows)