Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,41 +81,19 @@ st.markdown("""
|
|
| 81 |
<li>Analysis</li>
|
| 82 |
<li>Structuring</li>
|
| 83 |
</ul>""",unsafe_allow_html=True)
|
| 84 |
-
st.title("Drug Trial Analysis")
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
total_participants = st.number_input("Total Participants:", min_value=100, max_value=10000, value=1000)
|
| 88 |
-
|
| 89 |
-
# Input for number of participants in drug and placebo groups
|
| 90 |
-
drug_group_size = st.number_input("Size of Drug Group:", min_value=1, max_value=total_participants - 1, value=500)
|
| 91 |
-
placebo_group_size = total_participants - drug_group_size
|
| 92 |
-
|
| 93 |
# Input for side effects
|
| 94 |
-
|
| 95 |
-
|
| 96 |
|
| 97 |
# Calculate probabilities
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
# Calculate Risk Difference and Relative Risk
|
| 102 |
-
risk_difference = p_side_effects_drug - p_side_effects_placebo
|
| 103 |
-
relative_risk = p_side_effects_drug / p_side_effects_placebo if p_side_effects_placebo > 0 else np.nan
|
| 104 |
|
| 105 |
# Display results
|
| 106 |
st.subheader("Results:")
|
| 107 |
-
st.write(f"Probability of Side Effects in Drug Group: {
|
| 108 |
-
st.write(f"Probability of Side Effects in Placebo Group: {
|
| 109 |
-
st.write(f"Risk Difference: {risk_difference:.2%}")
|
| 110 |
-
st.write(f"Relative Risk: {relative_risk:.2f}" if not np.isnan(relative_risk) else "Relative Risk: Undefined (Placebo group has no side effects)")
|
| 111 |
-
|
| 112 |
-
# Visualization
|
| 113 |
-
st.subheader("Visualization")
|
| 114 |
-
labels = ['Drug Group', 'Placebo Group']
|
| 115 |
-
sizes = [p_side_effects_drug, p_side_effects_placebo]
|
| 116 |
-
colors = ['lightblue', 'lightgreen']
|
| 117 |
|
| 118 |
-
fig, ax = plt.subplots()
|
| 119 |
-
ax.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=90)
|
| 120 |
-
ax.axis('equal') # Equal aspect ratio ensures that pie chart is circular.
|
| 121 |
-
st.pyplot(fig)
|
|
|
|
| 81 |
<li>Analysis</li>
|
| 82 |
<li>Structuring</li>
|
| 83 |
</ul>""",unsafe_allow_html=True)
|
| 84 |
+
st.title("Drug Trial Analysis Between Covaxine and Covishiled")
|
| 85 |
+
total_participants = st.number_input("Total Participants For Covaxine:", min_value=100, max_value=10000, value=1000)
|
| 86 |
+
total_participants_1 = st.number_input("Total Participants For Covishield:", min_value=100, max_value=1000, value=1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
# Input for side effects
|
| 88 |
+
side_effects_drug_1 = st.number_input("Number of Side Effects in Covaxine:", min_value=0, max_value=10000, value=100)
|
| 89 |
+
side_effects_drug_2 = st.number_input("Number of Side Effects in Covishield:", min_value=0, max_value=10000, value=20)
|
| 90 |
|
| 91 |
# Calculate probabilities
|
| 92 |
+
p_side_effects_drug_1 = (side_effects_drug_1 / total_participants)*100
|
| 93 |
+
p_side_effects_drug_2 = (side_effects_drug_2 / total_participants_1)*100
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Display results
|
| 96 |
st.subheader("Results:")
|
| 97 |
+
st.write(f"Probability of Side Effects in Drug Group: {p_side_effects_drug_1:%}")
|
| 98 |
+
st.write(f"Probability of Side Effects in Placebo Group: {p_side_effects_drug_2:%}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|