JanviMl's picture
Update app.py
afefc6c verified
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
st.title("MFP Model Evaluator")
st.write("Compare the Direct Discount Model and Rebate Model for MFP effectuation based on your inputs.")
st.header("Input Parameters")
wac = st.number_input("Wholesale Acquisition Cost (WAC) per unit ($)", min_value=0.0, value=100.0)
aac = st.number_input("Average Acquisition Cost (AAC) per unit ($)", min_value=0.0, value=80.0)
dispense_days = st.slider("Days to Dispense Product", min_value=1, max_value=30, value=7)
payment_window = st.slider("Desired Payment Window (days)", min_value=1, max_value=30, value=14)
mfp_discount = wac * 0.7 # Assume MFP is 70% of WAC for simplicity
refund_amount = aac - mfp_discount
data = {
"Criteria": ["User-Friendliness", "Technological Capability", "Payment Speed (days)", "Cross-Program Compatibility", "Cash Flow Impact"],
"Direct Discount Model": [8, 7, payment_window - dispense_days, 9, "Positive (Quick Payment)"],
"Rebate Model": [6, 6, payment_window + 5, 7, "Delayed (Post-Invoice)"]
}
df = pd.DataFrame(data)
st.header("Model Comparison")
st.table(df)
st.header("Cash Flow Timeline")
days = range(0, 31)
direct_cash_flow = [0] * dispense_days + [refund_amount] * (31 - dispense_days)
rebate_cash_flow = [0] * (dispense_days + 5) + [refund_amount] * (31 - dispense_days - 5)
fig, ax = plt.subplots()
ax.plot(days, direct_cash_flow, label="Direct Discount Model", color="green")
ax.plot(days, rebate_cash_flow, label="Rebate Model", color="orange")
ax.set_xlabel("Days")
ax.set_ylabel("Cash Flow ($)")
ax.legend()
st.pyplot(fig)
st.header("Summary")
if payment_window <= 14:
st.write("Based on your inputs, the **Direct Discount Model** is recommended due to its quick payment capability within the 14-day window and positive cash flow impact.")
else:
st.write("The **Rebate Model** may suffice if payment speed is not a priority, but it delays cash flow compared to the Direct Discount Model.")
st.write("Note: This is a simplified tool. For detailed analysis, consult the full MFP guidelines and data.")