# backend/scripts/migrate_hardcoded_templates.py from __future__ import annotations import json from pathlib import Path from typing import Any, Dict, List TEMPLATES_DIR = Path(__file__).resolve().parents[1] / "templates" TEMPLATES_DIR.mkdir(parents=True, exist_ok=True) KNOWN_TEMPLATES: List[Dict[str, Any]] = [ { "template_id": "T1_IFACTOR_DELIVERED_ORDER", "name": "I-FACTOR Delivered Order Form", "status": "active", "version": 1, "match": { "keywords_all": ["delivered order form"], "keywords_any": ["i-factor", "cerapedics", "product information", "stickers", "bill to", "delivered to"], }, "schema": {}, }, { "template_id": "T2_SEASPINE_DELIVERED_GOODS_FORM", "name": "SeaSpine Delivered Goods Form", "status": "active", "version": 1, "match": { "keywords_all": ["delivered goods form"], "keywords_any": ["seaspine", "isotis", "handling fee", "sales order", "invoice"], }, "schema": {}, }, { "template_id": "T3_ASTURA_SALES_ORDER_FORM", "name": "Astura Sales Order Form", "status": "active", "version": 1, "match": { "keywords_all": [], "keywords_any": ["astura", "dc141", "ca200", "cbba", "sales order"], }, "schema": {}, }, { "template_id": "T4_MEDICAL_ESTIMATION_OF_CHARGES", "name": "Medical Estimation of Charges", "status": "active", "version": 1, "match": { "keywords_all": [], "keywords_any": ["estimation of charges", "good faith estimate", "patient responsibility", "insurance"], }, "schema": {}, }, { "template_id": "T5_CLINICAL_PROGRESS_NOTE_POSTOP", "name": "Clinical Progress Note Postop", "status": "active", "version": 1, "match": { "keywords_all": [], "keywords_any": ["clinical progress note", "progress note", "post-op", "assessment", "plan"], }, "schema": {}, }, { "template_id": "T6_CUSTOMER_CHARGE_SHEET_SPINE", "name": "Customer Charge Sheet Spine", "status": "active", "version": 1, "match": { "keywords_all": [], "keywords_any": ["customer charge sheet", "charge sheet", "spine", "qty", "unit price", "total"], }, "schema": {}, }, { "template_id": "T7_SALES_ORDER_ZIMMER", "name": "Zimmer Sales Order", "status": "active", "version": 1, "match": { "keywords_all": [], "keywords_any": ["zimmer", "zimmer biomet", "biomet", "sales order", "purchase order", "po number"], }, "schema": {}, }, ] def main() -> None: for t in KNOWN_TEMPLATES: out_path = TEMPLATES_DIR / f"{t['template_id']}.json" out_path.write_text(json.dumps(t, indent=2), encoding="utf-8") print(f"wrote {out_path}") if __name__ == "__main__": main()