Spaces:
Sleeping
Sleeping
eaglelandsonce
commited on
Commit
•
4f0bf15
1
Parent(s):
da3de0a
Update app.py
Browse files
app.py
CHANGED
@@ -166,18 +166,31 @@ def generate_services(num_services, primary_keys):
|
|
166 |
"RELATION": np.random.choice(["SUBSCRIBER", "DEPENDENT"], num_services),
|
167 |
})
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
# Main Streamlit App
|
170 |
st.title("Synthetic Medical Data Generator")
|
171 |
|
172 |
# Sliders
|
173 |
num_patients = st.slider("Number of Breast Cancer Patients to Generate", 10, 1000, 100)
|
174 |
num_services = st.slider("Number of Services to Generate", 10, 2000, 500)
|
|
|
175 |
|
176 |
if st.button("Generate Data"):
|
177 |
breast_cancer_df = generate_breast_cancer_data(num_patients)
|
178 |
members_df = generate_members_from_breast_cancer(breast_cancer_df)
|
179 |
enrollments_df = generate_enrollments_from_breast_cancer(breast_cancer_df)
|
180 |
services_df = generate_services(num_services, breast_cancer_df["PRIMARY_PERSON_KEY"].tolist())
|
|
|
181 |
|
182 |
# Display and download data
|
183 |
st.subheader("Breast Cancer Data")
|
@@ -195,3 +208,7 @@ if st.button("Generate Data"):
|
|
195 |
st.subheader("Services Data")
|
196 |
st.dataframe(services_df.head())
|
197 |
st.download_button("Download Services Data", services_df.to_csv(index=False), "services.csv")
|
|
|
|
|
|
|
|
|
|
166 |
"RELATION": np.random.choice(["SUBSCRIBER", "DEPENDENT"], num_services),
|
167 |
})
|
168 |
|
169 |
+
# Function to generate Providers
|
170 |
+
def generate_providers(num_providers):
|
171 |
+
return pd.DataFrame({
|
172 |
+
"PROVIDER_ID": [f"PROV_{i+1:05d}" for i in range(num_providers)],
|
173 |
+
"PROV_NAME": np.random.choice(["Clinic A", "Clinic B", "Clinic C"], num_providers),
|
174 |
+
"PROV_STATE": np.random.choice(["MI", "HI", "CA"], num_providers),
|
175 |
+
"PROV_ZIP": np.random.randint(10000, 99999, num_providers),
|
176 |
+
"PROV_SPECIALTY": np.random.choice(["Oncology", "Radiology", "Surgery"], num_providers),
|
177 |
+
"PROV_TAXONOMY": np.random.choice(["208100000X", "207RE0101X"], num_providers),
|
178 |
+
})
|
179 |
+
|
180 |
# Main Streamlit App
|
181 |
st.title("Synthetic Medical Data Generator")
|
182 |
|
183 |
# Sliders
|
184 |
num_patients = st.slider("Number of Breast Cancer Patients to Generate", 10, 1000, 100)
|
185 |
num_services = st.slider("Number of Services to Generate", 10, 2000, 500)
|
186 |
+
num_providers = st.slider("Number of Providers to Generate", 10, 500, 100)
|
187 |
|
188 |
if st.button("Generate Data"):
|
189 |
breast_cancer_df = generate_breast_cancer_data(num_patients)
|
190 |
members_df = generate_members_from_breast_cancer(breast_cancer_df)
|
191 |
enrollments_df = generate_enrollments_from_breast_cancer(breast_cancer_df)
|
192 |
services_df = generate_services(num_services, breast_cancer_df["PRIMARY_PERSON_KEY"].tolist())
|
193 |
+
providers_df = generate_providers(num_providers)
|
194 |
|
195 |
# Display and download data
|
196 |
st.subheader("Breast Cancer Data")
|
|
|
208 |
st.subheader("Services Data")
|
209 |
st.dataframe(services_df.head())
|
210 |
st.download_button("Download Services Data", services_df.to_csv(index=False), "services.csv")
|
211 |
+
|
212 |
+
st.subheader("Providers Data")
|
213 |
+
st.dataframe(providers_df.head())
|
214 |
+
st.download_button("Download Providers Data", providers_df.to_csv(index=False), "providers.csv")
|