Spaces:
Sleeping
Sleeping
File size: 3,100 Bytes
4a5269c | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # 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() |