ACMCMC commited on
Commit
398d84b
2 Parent(s): ee05396 796a53b

Merge remote-tracking branch 'origin/ui'

Browse files
Files changed (1) hide show
  1. app.py +31 -34
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, 5):
151
  trials.append(d)
152
 
153
- for trial in trials:
154
- with st.expander(f"{trial['protocolSection']['identificationModule']['nctId']}"):
155
- official_title = trial["protocolSection"]["identificationModule"][
156
- "officialTitle"
157
- ]
158
- st.write(f"##### {official_title}")
159
-
160
- brief_summary = trial["protocolSection"]["descriptionModule"]["briefSummary"]
161
- st.write(brief_summary)
162
-
163
- status_module = {
164
- "Status": trial["protocolSection"]["statusModule"]["overallStatus"],
165
- "Status Date": trial["protocolSection"]["statusModule"][
166
- "statusVerifiedDate"
167
- ],
168
- }
169
- st.write("###### Status")
170
- st.table(status_module)
171
-
172
- design_module = {
173
- "Study Type": trial["protocolSection"]["designModule"]["studyType"],
174
- # "Phases": trial["protocolSection"]["designModule"]["phases"], # breaks formatting because it is an array
175
- "Allocation": trial["protocolSection"]["designModule"]["designInfo"][
176
- "allocation"
177
- ],
178
- "Participants": trial["protocolSection"]["designModule"]["enrollmentInfo"][
179
- "count"
180
- ],
181
- }
182
- st.write("###### Design")
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])