File size: 1,014 Bytes
c94e7c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Run the model on an invented case report (not from MACCROBAT or any real patient).

    python example.py
"""
from cbx_clinical import ClinicalEntityExtractor

TEXT = """A 47-year-old woman presented to the emergency department with a 3-day history of fever and severe right upper quadrant pain.
She had a history of type 2 diabetes mellitus treated with metformin 500 mg twice daily.
Physical examination revealed tenderness in the right upper quadrant, and her temperature was 38.9 °C.
Laboratory tests showed an elevated white blood cell count of 15,200/µL.
Abdominal ultrasound demonstrated a distended gallbladder with a thickened wall and multiple gallstones.
She was diagnosed with acute cholecystitis and started on intravenous ceftriaxone.
Laparoscopic cholecystectomy was performed two days later, and she was discharged home on postoperative day 3."""

if __name__ == "__main__":
    ner = ClinicalEntityExtractor(".")
    for e in ner.extract(TEXT):
        print(f"{e['label']:24s} {e['text']}")