Spaces:
Running
Running
Commit
·
1a1c17c
1
Parent(s):
ab3a660
update
Browse files- README.md +1 -0
- app.py +4 -1
- app_logic.py +8 -8
- app_ui.py +3 -1
- dev.json +0 -0
- mockedReports.json +93 -0
- nen.py +0 -0
- train.json +0 -0
README.md
CHANGED
@@ -82,6 +82,7 @@ streamlit run app.py
|
|
82 |
}
|
83 |
}
|
84 |
```
|
|
|
85 |
|
86 |
2. **Selection Object**
|
87 |
```python
|
|
|
82 |
}
|
83 |
}
|
84 |
```
|
85 |
+
index start from 0.
|
86 |
|
87 |
2. **Selection Object**
|
88 |
```python
|
app.py
CHANGED
@@ -12,7 +12,10 @@ from app_ui import (
|
|
12 |
def initialize_session_state():
|
13 |
"""Initialize session state variables"""
|
14 |
if 'reports_json' not in st.session_state:
|
15 |
-
|
|
|
|
|
|
|
16 |
if 'selected_entity' not in st.session_state:
|
17 |
st.session_state.selected_entity = None
|
18 |
|
|
|
12 |
def initialize_session_state():
|
13 |
"""Initialize session state variables"""
|
14 |
if 'reports_json' not in st.session_state:
|
15 |
+
|
16 |
+
file_path = 'mockedReports.json'
|
17 |
+
|
18 |
+
st.session_state.reports_json = load_data(file_path)
|
19 |
if 'selected_entity' not in st.session_state:
|
20 |
st.session_state.selected_entity = None
|
21 |
|
app_logic.py
CHANGED
@@ -8,23 +8,23 @@ class Relation:
|
|
8 |
target: Selection
|
9 |
label: str
|
10 |
|
11 |
-
def load_data():
|
12 |
"""Load data from dev.json"""
|
13 |
-
with open('
|
14 |
return json.load(f)
|
15 |
|
16 |
-
def save_data(data):
|
17 |
"""Save data to dev.json"""
|
18 |
-
with open('
|
19 |
json.dump(data, f, indent=4)
|
20 |
|
21 |
def get_label_color(label):
|
22 |
"""Return color based on label type"""
|
23 |
color_map = {
|
24 |
-
'OBS-DP': '#FF6B6B',
|
25 |
-
'ANAT-DP': '#4ECDC4',
|
26 |
-
'OBS-U': '#FFD93D',
|
27 |
-
'OBS-DA': '#95A5A6',
|
28 |
}
|
29 |
return color_map.get(label, '#666666')
|
30 |
|
|
|
8 |
target: Selection
|
9 |
label: str
|
10 |
|
11 |
+
def load_data(file_path: str):
|
12 |
"""Load data from dev.json"""
|
13 |
+
with open(file_path, 'r', encoding='utf-8') as f:
|
14 |
return json.load(f)
|
15 |
|
16 |
+
def save_data(file_path: str, data):
|
17 |
"""Save data to dev.json"""
|
18 |
+
with open(file_path, 'w', encoding='utf-8') as f:
|
19 |
json.dump(data, f, indent=4)
|
20 |
|
21 |
def get_label_color(label):
|
22 |
"""Return color based on label type"""
|
23 |
color_map = {
|
24 |
+
'OBS-DP': '#FF6B6B',
|
25 |
+
'ANAT-DP': '#4ECDC4',
|
26 |
+
'OBS-U': '#FFD93D',
|
27 |
+
'OBS-DA': '#95A5A6',
|
28 |
}
|
29 |
return color_map.get(label, '#666666')
|
30 |
|
app_ui.py
CHANGED
@@ -137,7 +137,9 @@ def handle_review_submission(selected_report, selections, entities_data):
|
|
137 |
'entities': updated_entities
|
138 |
}
|
139 |
|
140 |
-
|
|
|
|
|
141 |
st.success("Review status saved!")
|
142 |
st.rerun()
|
143 |
|
|
|
137 |
'entities': updated_entities
|
138 |
}
|
139 |
|
140 |
+
|
141 |
+
file_path = 'mockedReports.json'
|
142 |
+
save_data(file_path, st.session_state.reports_json)
|
143 |
st.success("Review status saved!")
|
144 |
st.rerun()
|
145 |
|
dev.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|
mockedReports.json
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"p1/mock001/s00001.txt": {
|
3 |
+
"text": "FINAL REPORT EXAMINATION : Mild cardiomegaly with no evidence of pulmonary edema . No focal consolidation , pleural effusion , or pneumothorax .",
|
4 |
+
"entities": {
|
5 |
+
"1": {
|
6 |
+
"tokens": "cardiomegaly",
|
7 |
+
"label": "OBS-DP",
|
8 |
+
"start_ix": 5,
|
9 |
+
"end_ix": 5,
|
10 |
+
"relations": []
|
11 |
+
},
|
12 |
+
"2": {
|
13 |
+
"tokens": "pulmonary edema",
|
14 |
+
"label": "OBS-DA",
|
15 |
+
"start_ix": 10,
|
16 |
+
"end_ix": 11,
|
17 |
+
"relations": []
|
18 |
+
},
|
19 |
+
"3": {
|
20 |
+
"tokens": "focal consolidation",
|
21 |
+
"label": "OBS-DA",
|
22 |
+
"start_ix": 14,
|
23 |
+
"end_ix": 15,
|
24 |
+
"relations": []
|
25 |
+
},
|
26 |
+
"4": {
|
27 |
+
"tokens": "pleural effusion",
|
28 |
+
"label": "OBS-DA",
|
29 |
+
"start_ix": 17,
|
30 |
+
"end_ix": 18,
|
31 |
+
"relations": []
|
32 |
+
},
|
33 |
+
"5": {
|
34 |
+
"tokens": "pneumothorax",
|
35 |
+
"label": "OBS-DA",
|
36 |
+
"start_ix": 20,
|
37 |
+
"end_ix": 20,
|
38 |
+
"relations": []
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"data_source": "mock",
|
42 |
+
"data_split": "-"
|
43 |
+
},
|
44 |
+
"p2/mock002/s00002.txt": {
|
45 |
+
"text": "FINAL REPORT EXAMINATION : Right lower lobe consolidation consistent with pneumonia . Mild right-sided pleural effusion noted . Heart size within normal limits .",
|
46 |
+
"entities": {
|
47 |
+
"1": {
|
48 |
+
"tokens": "Right lower lobe",
|
49 |
+
"label": "ANAT-DP",
|
50 |
+
"start_ix": 4,
|
51 |
+
"end_ix": 6,
|
52 |
+
"relations": []
|
53 |
+
},
|
54 |
+
"2": {
|
55 |
+
"tokens": "consolidation",
|
56 |
+
"label": "OBS-DP",
|
57 |
+
"start_ix": 7,
|
58 |
+
"end_ix": 7,
|
59 |
+
"relations": []
|
60 |
+
},
|
61 |
+
"3": {
|
62 |
+
"tokens": "pneumonia",
|
63 |
+
"label": "OBS-DP",
|
64 |
+
"start_ix": 10,
|
65 |
+
"end_ix": 10,
|
66 |
+
"relations": []
|
67 |
+
},
|
68 |
+
"4": {
|
69 |
+
"tokens": "right-sided",
|
70 |
+
"label": "ANAT-DP",
|
71 |
+
"start_ix": 12,
|
72 |
+
"end_ix": 12,
|
73 |
+
"relations": []
|
74 |
+
},
|
75 |
+
"5": {
|
76 |
+
"tokens": "pleural effusion",
|
77 |
+
"label": "OBS-DP",
|
78 |
+
"start_ix": 13,
|
79 |
+
"end_ix": 14,
|
80 |
+
"relations": []
|
81 |
+
},
|
82 |
+
"6": {
|
83 |
+
"tokens": "Heart",
|
84 |
+
"label": "ANAT-DP",
|
85 |
+
"start_ix": 17,
|
86 |
+
"end_ix": 17,
|
87 |
+
"relations": []
|
88 |
+
}
|
89 |
+
},
|
90 |
+
"data_source": "mock",
|
91 |
+
"data_split": "-"
|
92 |
+
}
|
93 |
+
}
|
nen.py
DELETED
File without changes
|
train.json
DELETED
The diff for this file is too large to render.
See raw diff
|
|