Spaces:
Sleeping
Sleeping
eaglelandsonce
commited on
Commit
•
8f89163
1
Parent(s):
95a0a03
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def generate_members(num_members):
|
|
29 |
primary_keys = [f"PPK_{i+1:05d}" for i in range(num_members)]
|
30 |
members_data = {
|
31 |
"MEM_ETHNICITY": np.random.choice(["Hispanic", "Non-Hispanic", None], num_members),
|
32 |
-
"MEM_GENDER": ["F"] * num_members,
|
33 |
"MEM_MSA_NAME": np.random.choice(["DETROIT", "HONOLULU", "LOS ANGELES"], num_members),
|
34 |
"MEM_RACE": np.random.choice(["White", "Black", "Asian", None], num_members),
|
35 |
"MEM_STATE": np.random.choice(["MI", "HI", "CA"], num_members),
|
@@ -70,8 +70,10 @@ def generate_services(num_services, primary_keys):
|
|
70 |
return pd.DataFrame(services_data)
|
71 |
|
72 |
# Function to generate synthetic BreastCancer data
|
73 |
-
def generate_breast_cancer_data(num_patients):
|
74 |
-
|
|
|
|
|
75 |
breast_cancer_data = {
|
76 |
"Patient ID": patient_ids,
|
77 |
"Age": np.random.randint(30, 80, num_patients),
|
@@ -102,13 +104,14 @@ num_services = st.slider("Number of Services to Generate", 10, 2000, 500)
|
|
102 |
num_patients = st.slider("Number of Breast Cancer Patients to Generate", 10, 500, 100)
|
103 |
|
104 |
if st.button("Generate Data"):
|
|
|
105 |
enrollments_df = generate_enrollments(num_members)
|
106 |
members_df = generate_members(num_members)
|
107 |
providers_df = generate_providers(num_providers)
|
108 |
services_df = generate_services(num_services, enrollments_df["PRIMARY_PERSON_KEY"].tolist())
|
109 |
-
breast_cancer_df = generate_breast_cancer_data(num_patients)
|
110 |
|
111 |
-
# Display data
|
112 |
st.subheader("Enrollments Data")
|
113 |
st.dataframe(enrollments_df.head())
|
114 |
st.download_button("Download Enrollments", enrollments_df.to_csv(index=False), "enrollments.csv")
|
|
|
29 |
primary_keys = [f"PPK_{i+1:05d}" for i in range(num_members)]
|
30 |
members_data = {
|
31 |
"MEM_ETHNICITY": np.random.choice(["Hispanic", "Non-Hispanic", None], num_members),
|
32 |
+
"MEM_GENDER": ["F"] * num_members, # All members are female
|
33 |
"MEM_MSA_NAME": np.random.choice(["DETROIT", "HONOLULU", "LOS ANGELES"], num_members),
|
34 |
"MEM_RACE": np.random.choice(["White", "Black", "Asian", None], num_members),
|
35 |
"MEM_STATE": np.random.choice(["MI", "HI", "CA"], num_members),
|
|
|
70 |
return pd.DataFrame(services_data)
|
71 |
|
72 |
# Function to generate synthetic BreastCancer data
|
73 |
+
def generate_breast_cancer_data(members_df, num_patients):
|
74 |
+
# Randomly sample from PRIMARY_PERSON_KEY in Members
|
75 |
+
patient_ids = np.random.choice(members_df["PRIMARY_PERSON_KEY"], num_patients, replace=False)
|
76 |
+
|
77 |
breast_cancer_data = {
|
78 |
"Patient ID": patient_ids,
|
79 |
"Age": np.random.randint(30, 80, num_patients),
|
|
|
104 |
num_patients = st.slider("Number of Breast Cancer Patients to Generate", 10, 500, 100)
|
105 |
|
106 |
if st.button("Generate Data"):
|
107 |
+
# Generate data
|
108 |
enrollments_df = generate_enrollments(num_members)
|
109 |
members_df = generate_members(num_members)
|
110 |
providers_df = generate_providers(num_providers)
|
111 |
services_df = generate_services(num_services, enrollments_df["PRIMARY_PERSON_KEY"].tolist())
|
112 |
+
breast_cancer_df = generate_breast_cancer_data(members_df, num_patients)
|
113 |
|
114 |
+
# Display and download data
|
115 |
st.subheader("Enrollments Data")
|
116 |
st.dataframe(enrollments_df.head())
|
117 |
st.download_button("Download Enrollments", enrollments_df.to_csv(index=False), "enrollments.csv")
|