Update app.py
Browse files
app.py
CHANGED
@@ -50,12 +50,16 @@ xgr_logits_processor = xgr.contrib.hf.LogitsProcessor(compiled_grammar)
|
|
50 |
|
51 |
prompt = """You are a text extraction system for clinical reports.
|
52 |
Please extract relevant clinical information from the report.
|
|
|
53 |
### Instructions
|
|
|
54 |
- Use the JSON Schema given below.
|
55 |
- Return only a valid JSON object – no markdown, no comments.
|
56 |
- If no relevant facts are given for a field, set its value to "N/A".
|
57 |
- If multile relevant facts are given for a field, separate them with "; ".
|
|
|
58 |
### JSON Schema
|
|
|
59 |
{
|
60 |
'life_style': '',
|
61 |
'family_history': '',
|
@@ -73,6 +77,7 @@ Please extract relevant clinical information from the report.
|
|
73 |
'age': '',
|
74 |
'gender': '',
|
75 |
}
|
|
|
76 |
### Clinical Report
|
77 |
"""
|
78 |
|
@@ -387,33 +392,49 @@ with gr.Blocks() as demo:
|
|
387 |
)
|
388 |
|
389 |
with gr.Tab("Help"):
|
390 |
-
gr.Markdown("""
|
391 |
-
|
|
|
|
|
392 |
**Age**: Age of the patient.<br>
|
393 |
**Gender**: Gender of the patient.<br>
|
394 |
**Lifestyle**: Daily habits and activities of the patient (e.g. alcohol consumption, diet, smoking status).<br>
|
395 |
**Social Background**: Social factors of the patient (e.g. housing situation, marital status).<br>
|
|
|
396 |
### Medical History
|
|
|
397 |
**Personal**: Past medical conditions, previous surgeries or treatments of the patient.<br>
|
398 |
**Family Members**: Relevant medical conditions or genetic disorders in the patient’s family (e.g. cancer, heart disease).<br>
|
|
|
399 |
### Clinical Presentation
|
|
|
400 |
**Symptoms**: Current symptoms of the patient.<br>
|
401 |
**Comorbid Conditions**: Other medical conditions of the patient that may influence the treatment.<br>
|
|
|
402 |
### Medical Assessment
|
|
|
403 |
**Diagnostic Procedures**: Description of the diagnostic tests or procedures performed (e.g. X-rays, MRIs)<br>
|
404 |
**Laboratory Results**: Results foom laboratory test (e.g. blood counts, electrolyte levels)<br>
|
405 |
**Pathology Report**: Findings from pathological examinations (e.g. biopsy results)<br>
|
|
|
406 |
### Diagnosis
|
|
|
407 |
**Diagnosis**: All levels of diagnosis mentioned in the report.<br>
|
|
|
408 |
### Treatment
|
|
|
409 |
**Interventional Therapy**: Medications prescribed to the patient.<br>
|
410 |
**Pharmacological Therapy**: Information on surgical or non-surgical interventions performed.<br>
|
|
|
411 |
### Patient Outcome
|
|
|
412 |
**Patient Outcome**: Evaluation of the patient’s health status at the end of treatment.<br>
|
413 |
""")
|
414 |
|
415 |
with gr.Tab("About"):
|
416 |
-
gr.Markdown("""
|
|
|
|
|
417 |
|
418 |
The goal of this project is to perform structured information extraction from clinical reports, helping doctors to have more time for their patients.
|
419 |
|
|
|
50 |
|
51 |
prompt = """You are a text extraction system for clinical reports.
|
52 |
Please extract relevant clinical information from the report.
|
53 |
+
|
54 |
### Instructions
|
55 |
+
|
56 |
- Use the JSON Schema given below.
|
57 |
- Return only a valid JSON object – no markdown, no comments.
|
58 |
- If no relevant facts are given for a field, set its value to "N/A".
|
59 |
- If multile relevant facts are given for a field, separate them with "; ".
|
60 |
+
|
61 |
### JSON Schema
|
62 |
+
|
63 |
{
|
64 |
'life_style': '',
|
65 |
'family_history': '',
|
|
|
77 |
'age': '',
|
78 |
'gender': '',
|
79 |
}
|
80 |
+
|
81 |
### Clinical Report
|
82 |
"""
|
83 |
|
|
|
392 |
)
|
393 |
|
394 |
with gr.Tab("Help"):
|
395 |
+
gr.Markdown("""## Help
|
396 |
+
|
397 |
+
### Personal Information
|
398 |
+
|
399 |
**Age**: Age of the patient.<br>
|
400 |
**Gender**: Gender of the patient.<br>
|
401 |
**Lifestyle**: Daily habits and activities of the patient (e.g. alcohol consumption, diet, smoking status).<br>
|
402 |
**Social Background**: Social factors of the patient (e.g. housing situation, marital status).<br>
|
403 |
+
|
404 |
### Medical History
|
405 |
+
|
406 |
**Personal**: Past medical conditions, previous surgeries or treatments of the patient.<br>
|
407 |
**Family Members**: Relevant medical conditions or genetic disorders in the patient’s family (e.g. cancer, heart disease).<br>
|
408 |
+
|
409 |
### Clinical Presentation
|
410 |
+
|
411 |
**Symptoms**: Current symptoms of the patient.<br>
|
412 |
**Comorbid Conditions**: Other medical conditions of the patient that may influence the treatment.<br>
|
413 |
+
|
414 |
### Medical Assessment
|
415 |
+
|
416 |
**Diagnostic Procedures**: Description of the diagnostic tests or procedures performed (e.g. X-rays, MRIs)<br>
|
417 |
**Laboratory Results**: Results foom laboratory test (e.g. blood counts, electrolyte levels)<br>
|
418 |
**Pathology Report**: Findings from pathological examinations (e.g. biopsy results)<br>
|
419 |
+
|
420 |
### Diagnosis
|
421 |
+
|
422 |
**Diagnosis**: All levels of diagnosis mentioned in the report.<br>
|
423 |
+
|
424 |
### Treatment
|
425 |
+
|
426 |
**Interventional Therapy**: Medications prescribed to the patient.<br>
|
427 |
**Pharmacological Therapy**: Information on surgical or non-surgical interventions performed.<br>
|
428 |
+
|
429 |
### Patient Outcome
|
430 |
+
|
431 |
**Patient Outcome**: Evaluation of the patient’s health status at the end of treatment.<br>
|
432 |
""")
|
433 |
|
434 |
with gr.Tab("About"):
|
435 |
+
gr.Markdown("""## About
|
436 |
+
|
437 |
+
LlamaMD is a project developed as part of the "NLP for Social Good" course at TU Berlin.
|
438 |
|
439 |
The goal of this project is to perform structured information extraction from clinical reports, helping doctors to have more time for their patients.
|
440 |
|