Spaces:
Sleeping
Sleeping
File size: 1,334 Bytes
e48117a | 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 | import random
from typing import List, Dict
def generate_mock_note() -> Dict:
"""
Generates a mock clinical note with realistic PHI for testing.
"""
names = ["John Doe", "Alice Smith", "Robert Johnson", "Maria Garcia"]
dates = ["01/01/2023", "2022-12-15", "March 4th, 2024"]
phones = ["(555) 123-4567", "555-987-6543", "123.456.7890"]
ids = ["12345678", "MRN987654", "SSN: 000-00-0000"]
name = random.choice(names)
date = random.choice(dates)
phone = random.choice(phones)
mrn = random.choice(ids)
note = f"""
Discharge Summary
Patient Name: {name}
Date of Birth: {date}
Contact: {phone}
Medical Record Number: {mrn}
The patient was admitted on {date} for acute chest pain.
Follow up with Dr. {random.choice(names)} at the main clinic.
"""
# Simple "Gold Standard" extraction for mock eval
phi = [
{"text": name, "label": "PATIENT"},
{"text": date, "label": "DATE"},
{"text": phone, "label": "PHONE"},
{"text": mrn, "label": "MRN"}
]
return {"text": note, "phi": phi}
if __name__ == "__main__":
sample = generate_mock_note()
print("Mock Note:")
print(sample["text"])
print("\nGold PHI:")
for p in sample["phi"]:
print(f"- {p['label']}: {p['text']}")
|