---
type: "Source File"
title: "\"\"\"Import all policy data from policy_dump.json into the database.\"\"\""
description: "\"\"\"Import all policy data from policy_dump.json into the database.\"\"\" import sys, os, json sys.path.insert(0, os.path.dirname(__file__)) import db def main(): dump_file = os.path.join(os.path.dirname(__file__)."
resource: "https://policy.copecheck.com"
tags: ["copecheck", "policy", "source-file", "py"]
timestamp: "2026-04-30T09:43:01Z"
site: "policy"
source_path: "copecheck-policy/import_data.py"
---

# """Import all policy data from policy_dump.json into the database."""

Source path: `copecheck-policy/import_data.py`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-04-30T09:43:01Z`

```py
"""Import all policy data from policy_dump.json into the database."""
import sys, os, json
sys.path.insert(0, os.path.dirname(__file__))
import db

def main():
    dump_file = os.path.join(os.path.dirname(__file__), "policy_dump.json")
    with open(dump_file) as f:
        policies = json.load(f)
    print(f"Importing {len(policies)} policies...")
    for p in policies:
        db.upsert_policy(
            slug=p["slug"], name=p["name"], domain=p["domain"],
            summary=p.get("summary", ""), description=p.get("description", ""),
            challenge=p.get("challenge", ""),
            source=p.get("source", "windfall-trust"),
            source_url=p.get("source_url", ""),
        )
        if p.get("overall_cope_score") is not None:
            db.set_policy_scores(p["slug"], {
                "overall_cope_score": p["overall_cope_score"],
                "unit_cost_score": p.get("unit_cost_score"),
                "interface_collapse_score": p.get("interface_collapse_score"),
                "propagation_score": p.get("propagation_score"),
                "coordination_score": p.get("coordination_score"),
                "verdict": p.get("verdict"), "analysis": p.get("analysis"),
                "unit_cost_analysis": p.get("unit_cost_analysis"),
                "interface_analysis": p.get("interface_analysis"),
                "propagation_analysis": p.get("propagation_analysis"),
                "coordination_analysis": p.get("coordination_analysis"),
                "model": p.get("model", "claude-sonnet-4-5"),
            })
        print(f"  {p['name']}: {p.get('overall_cope_score', 'unscored')}")
    db.upsert_think_tank(slug="windfall-trust", name="Windfall Trust",
        url="https://windfalltrust.org",
        description="Open-access atlas of 48 AI economic policy proposals across 5 domains.",
        country="UK", tier=1)
    scored = [p for p in policies if p.get("overall_cope_score") is not None]
    if scored:
        avg = sum(p["overall_cope_score"] for p in scored) / len(scored)
        c = db._conn()
        c.execute("UPDATE think_tanks SET paper_count=?, avg_cope_score=?, overall_cope_score=? WHERE slug=?",
                  (len(scored), round(avg, 1), round(avg, 1), "windfall-trust"))
        c.commit(); c.close()
    survivors = db.get_surviving_policies()
    print(f"\nDone! {len(policies)} policies imported, {len(survivors)} survivors.")

if __name__ == "__main__":
    main()
```
