Spaces:
Sleeping
Sleeping
File size: 1,562 Bytes
cf30ded | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """
scripts/seed_sqlite.py — Seed the SQLite database with insurance plan data.
Run:
uv run python scripts/seed_sqlite.py
"""
import sqlite3
from pathlib import Path
from src.config import settings
DB_PATH = Path(settings.sqlite_db_path)
DB_PATH.parent.mkdir(parents=True, exist_ok=True)
PLANS = [
("Plan A", "Basic", "Individual", 180.00, 2500, 30, 60),
("Plan A", "Basic", "Family", 340.00, 5000, 30, 60),
("Plan B", "Standard", "Individual", 260.00, 1500, 25, 45),
("Plan B", "Standard", "Family", 490.00, 3000, 25, 45),
("Plan C", "Premium", "Individual", 390.00, 500, 15, 30),
("Plan C", "Premium", "Family", 720.00, 1000, 15, 30),
]
with sqlite3.connect(DB_PATH) as conn:
conn.execute("DROP TABLE IF EXISTS plans")
conn.execute("""
CREATE TABLE plans (
id INTEGER PRIMARY KEY AUTOINCREMENT,
plan_name TEXT NOT NULL,
tier TEXT NOT NULL,
coverage_type TEXT NOT NULL,
monthly_premium REAL NOT NULL,
deductible INTEGER NOT NULL,
copay_primary INTEGER NOT NULL,
copay_specialist INTEGER NOT NULL
)
""")
conn.executemany(
"INSERT INTO plans (plan_name, tier, coverage_type, monthly_premium, deductible, copay_primary, copay_specialist) VALUES (?,?,?,?,?,?,?)",
PLANS,
)
conn.commit()
count = conn.execute("SELECT COUNT(*) FROM plans").fetchone()[0]
print(f"✅ Seeded {count} insurance plans into {DB_PATH}")
|