Spaces:
Sleeping
Sleeping
Merge remote-tracking branch 'origin/ui'
Browse files
app.py
CHANGED
|
@@ -147,39 +147,36 @@ with st.container():
|
|
| 147 |
# TODO replace mock data
|
| 148 |
with open("mock_trial.json") as f:
|
| 149 |
d = json.load(f)
|
| 150 |
-
for i in range(0,
|
| 151 |
trials.append(d)
|
| 152 |
|
| 153 |
-
for trial in trials
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
st.table(design_module)
|
| 184 |
-
|
| 185 |
-
# TODO more modules?
|
|
|
|
| 147 |
# TODO replace mock data
|
| 148 |
with open("mock_trial.json") as f:
|
| 149 |
d = json.load(f)
|
| 150 |
+
for i in range(0, 8):
|
| 151 |
trials.append(d)
|
| 152 |
|
| 153 |
+
tab_titles = [f"{trial['protocolSection']['identificationModule']['nctId']}" for trial in trials]
|
| 154 |
+
|
| 155 |
+
def render_tab(trial: dict) -> None:
|
| 156 |
+
official_title = trial["protocolSection"]["identificationModule"]["officialTitle"]
|
| 157 |
+
st.write(f"##### {official_title}")
|
| 158 |
+
|
| 159 |
+
brief_summary = trial["protocolSection"]["descriptionModule"]["briefSummary"]
|
| 160 |
+
st.write(brief_summary)
|
| 161 |
+
|
| 162 |
+
status_module = {
|
| 163 |
+
"Status": trial["protocolSection"]["statusModule"]["overallStatus"],
|
| 164 |
+
"Status Date": trial["protocolSection"]["statusModule"]["statusVerifiedDate"],
|
| 165 |
+
}
|
| 166 |
+
st.write("###### Status")
|
| 167 |
+
st.table(status_module)
|
| 168 |
+
|
| 169 |
+
design_module = {
|
| 170 |
+
"Study Type": trial["protocolSection"]["designModule"]["studyType"],
|
| 171 |
+
# "Phases": trial["protocolSection"]["designModule"]["phases"], # breaks formatting because it is an array
|
| 172 |
+
"Allocation": trial["protocolSection"]["designModule"]["designInfo"]["allocation"],
|
| 173 |
+
"Participants": trial["protocolSection"]["designModule"]["enrollmentInfo"]["count"],
|
| 174 |
+
}
|
| 175 |
+
st.write("###### Design")
|
| 176 |
+
st.table(design_module)
|
| 177 |
+
|
| 178 |
+
tabs = st.tabs(tab_titles)
|
| 179 |
+
|
| 180 |
+
for i in range(0, len(tabs)):
|
| 181 |
+
with tabs[i]:
|
| 182 |
+
render_tab(trials[i])
|
|
|
|
|
|
|
|
|