diff --git a/src/DP_epidemiology/__pycache__/contact_matrix.cpython-310.pyc b/src/DP_epidemiology/__pycache__/contact_matrix.cpython-310.pyc index a4cff0f..b83eb4b 100644 Binary files a/src/DP_epidemiology/__pycache__/contact_matrix.cpython-310.pyc and b/src/DP_epidemiology/__pycache__/contact_matrix.cpython-310.pyc differ diff --git a/src/DP_epidemiology/__pycache__/viz.cpython-310.pyc b/src/DP_epidemiology/__pycache__/viz.cpython-310.pyc index 6abeff4..17f1812 100644 Binary files a/src/DP_epidemiology/__pycache__/viz.cpython-310.pyc and b/src/DP_epidemiology/__pycache__/viz.cpython-310.pyc differ diff --git a/src/DP_epidemiology/contact_matrix.py b/src/DP_epidemiology/contact_matrix.py index 1bc8efc..f266f39 100644 --- a/src/DP_epidemiology/contact_matrix.py +++ b/src/DP_epidemiology/contact_matrix.py @@ -23,9 +23,9 @@ UPPER_BOUND = 600 -def validate_input_data(df, age_groups, consumption_distribution, start_date: datetime, end_date: datetime, city: str): +def validate_input_data(df, city_zipcode_map, age_groups, consumption_distribution, start_date: datetime, end_date: datetime, city: str, default_city:str): # check city exists in the data - df = make_preprocess_location()(df) + df = make_preprocess_location(city_zipcode_map,default_city)(df) df[time_col] = pd.to_datetime(df[time_col]) if city not in df[city_col].unique(): raise ValueError("City does not exist in the data") @@ -41,9 +41,9 @@ def validate_input_data(df, age_groups, consumption_distribution, start_date: da raise ValueError(f"Category {category} does not exist in the data") -def get_private_counts(df, categories, start_date: datetime, end_date: datetime, city: str, epsilon: float = 1.0): +def get_private_counts(df, city_zipcode_map:pd.DataFrame, categories, start_date: datetime, end_date: datetime, city: str, default_city:str, epsilon: float = 1.0): t_pre = ( - make_preprocess_location() + make_preprocess_location(city_zipcode_map, default_city) >> make_truncate_time(start_date, end_date, time_col=time_col) >> make_filter_rows(txn_channel_col, "OFFLINE") >> make_filter_rows(city_col, city) @@ -75,13 +75,13 @@ def get_private_counts(df, categories, start_date: datetime, end_date: datetime, return nb_transactions_avg_count_map -def get_age_group_count_map(df, age_groups, consumption_distribution, start_date: datetime, end_date: datetime, city: str, epsilon: float = 1.0): +def get_age_group_count_map(df,city_zipcode_map, age_groups, consumption_distribution, start_date: datetime, end_date: datetime, city: str, default_city:str, epsilon: float = 1.0): validate_input_data( - df, age_groups, consumption_distribution, start_date, end_date, city) + df, city_zipcode_map, age_groups, consumption_distribution, start_date, end_date, city, default_city) nb_transactions_avg_count_map = get_private_counts( - df, consumption_distribution.keys(), start_date, end_date, city, epsilon) + df, city_zipcode_map, consumption_distribution.keys(), start_date, end_date, city, default_city, epsilon) # calculate age group to avg count of members from that age group age_group_count_map = {} diff --git a/src/DP_epidemiology/hotspot_analyzer.py b/src/DP_epidemiology/hotspot_analyzer.py index 4804d76..2e8e2d0 100644 --- a/src/DP_epidemiology/hotspot_analyzer.py +++ b/src/DP_epidemiology/hotspot_analyzer.py @@ -10,7 +10,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from DP_epidemiology.utilities import * -def hotspot_analyzer(df:pd.DataFrame, start_date:datetime,end_date:datetime,city:str,epsilon:float): +def hotspot_analyzer(df:pd.DataFrame,city_zipcode_map:pd.DataFrame, start_date:datetime,end_date:datetime,city:str, default_city:str, epsilon:float): """final function to predict hotspots""" bounds = (0, 600) upper_bound=600 @@ -31,7 +31,7 @@ def hotspot_analyzer(df:pd.DataFrame, start_date:datetime,end_date:datetime,city hotspot_predictor=( - make_preprocess_location() + make_preprocess_location(city_zipcode_map, default_city) >>make_filter(transaction_type_col,transaction_type_filter) >>make_filter(city_col,city) >>make_truncate_time(start_date, end_date, time_col) @@ -43,9 +43,12 @@ def hotspot_analyzer(df:pd.DataFrame, start_date:datetime,end_date:datetime,city if __name__ == "__main__": import sys path=sys.argv[1] - start_date=datetime(sys.argv[2]) - end_date=datetime(sys.argv[3]) - city=sys.argv[4] - epsilon=sys.argv[5] + path_city_zipcode_map=sys.argv[2] + start_date=datetime(sys.argv[3]) + end_date=datetime(sys.argv[4]) + city=sys.argv[5] + default_city=sys.argv[6] + epsilon=sys.argv[7] df = pd.read_csv(path) - print(hotspot_analyzer(df,start_date,end_date,city,epsilon)) \ No newline at end of file + city_zipcode_map = pd.read_csv(path_city_zipcode_map) + print(hotspot_analyzer(df,city_zipcode_map, start_date,end_date,city,default_city, epsilon)) \ No newline at end of file diff --git a/src/DP_epidemiology/mobility_analyzer.py b/src/DP_epidemiology/mobility_analyzer.py index e59144a..09e15f6 100644 --- a/src/DP_epidemiology/mobility_analyzer.py +++ b/src/DP_epidemiology/mobility_analyzer.py @@ -13,7 +13,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from DP_epidemiology.utilities import * -def mobility_analyzer_airline(df:pd.DataFrame,start_date:datetime,end_date:datetime,city: str, epsilon:float): +def mobility_analyzer_airline(df:pd.DataFrame,city_zipcode_map:pd.DataFrame, start_date:datetime,end_date:datetime,city: str,default_city:str, epsilon:float): """final function to predict hotspots""" bounds = (0, 600) upper_bound=600 @@ -36,7 +36,7 @@ def mobility_analyzer_airline(df:pd.DataFrame,start_date:datetime,end_date:datet analyzer=( - make_preprocess_location() + make_preprocess_location(city_zipcode_map,default_city) >>make_filter(city_col,city) >>make_filter(merch_category_col,merch_filter) >>make_truncate_time(start_date, end_date, time_col) @@ -45,7 +45,7 @@ def mobility_analyzer_airline(df:pd.DataFrame,start_date:datetime,end_date:datet return analyzer(new_df) -def mobility_analyzer(df:pd.DataFrame,start_date:datetime,end_date:datetime,city: str,category:str, epsilon:float): +def mobility_analyzer(df:pd.DataFrame, city_zipcode_map:pd.DataFrame, start_date:datetime,end_date:datetime,city: str, default_city:str, category:str, epsilon:float): """final function to predict hotspots""" bounds = (0, 600) upper_bound=600 @@ -68,7 +68,7 @@ def mobility_analyzer(df:pd.DataFrame,start_date:datetime,end_date:datetime,city analyzer=( - make_preprocess_location() + make_preprocess_location(city_zipcode_map,default_city) >>make_preprocess_merchant_mobility() >>make_filter(city_col,city) >>make_filter(merch_category_col, category) @@ -78,8 +78,8 @@ def mobility_analyzer(df:pd.DataFrame,start_date:datetime,end_date:datetime,city return analyzer(new_df) -def mobility_validation_with_google_mobility(df_transactional_data:pd.DataFrame, df_google_mobility_data:pd.DataFrame, start_date:datetime, end_date:datetime, city:str, category:str, epsilon:float): - df_transactional_mobility= mobility_analyzer(df_transactional_data,start_date,end_date,city,category,epsilon) +def mobility_validation_with_google_mobility(df_transactional_data:pd.DataFrame, df_google_mobility_data:pd.DataFrame,city_zipcode_map:pd.DataFrame, start_date:datetime, end_date:datetime, city:str, default_city:str, category:str, epsilon:float): + df_transactional_mobility= mobility_analyzer(df_transactional_data,city_zipcode_map, start_date,end_date,city,default_city, category,epsilon) offset=df_transactional_mobility["date"][0] df_google_mobility = preprocess_google_mobility(df_google_mobility_data,start_date,end_date,city,category,offset) diff --git a/src/DP_epidemiology/pandemic_adherence_analyzer.py b/src/DP_epidemiology/pandemic_adherence_analyzer.py index 64507c0..75e72ae 100644 --- a/src/DP_epidemiology/pandemic_adherence_analyzer.py +++ b/src/DP_epidemiology/pandemic_adherence_analyzer.py @@ -10,7 +10,7 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from DP_epidemiology.utilities import * -def pandemic_adherence_analyzer(df:pd.DataFrame,start_date:datetime,end_date:datetime,city: str,essential_or_luxury:str, epsilon:float): +def pandemic_adherence_analyzer(df:pd.DataFrame,city_zipcode_map:pd.DataFrame, start_date:datetime,end_date:datetime,city: str,default_city:str, essential_or_luxury:str, epsilon:float): """final function to predict hotspots""" bounds = (0, 600) upper_bound=600 @@ -32,7 +32,7 @@ def pandemic_adherence_analyzer(df:pd.DataFrame,start_date:datetime,end_date:dat analyzer=( - make_preprocess_location() + make_preprocess_location(city_zipcode_map, default_city) >>make_preprocess_merchant() >>make_filter(city_col,city) >>make_filter(merch_category_col,essential_or_luxury) diff --git a/src/DP_epidemiology/utilities.py b/src/DP_epidemiology/utilities.py index 6525db3..7febb09 100644 --- a/src/DP_epidemiology/utilities.py +++ b/src/DP_epidemiology/utilities.py @@ -41,27 +41,17 @@ def approx_concentrated_divergence(): """symmetric distance between the id sets""" return dp.user_distance("ApproxConcentratedDivergence()") -def make_preprocess_location(): +def make_preprocess_location(city_zipcode_map:pd.DataFrame, default_city:str="Unknown"): """Create a 1-stable transformation to bin `merch_postal_code` by city""" - - def categorize_city(code): - if code.startswith("5"): - return "Medellin" - elif code.startswith("11"): - return "Bogota" - elif code.startswith("70"): - return "Brasilia" - else: - return "Santiago" - + def location_preprocess(df): loc_df = df.copy() # Convert merchant_postal_code into str type loc_df["merch_postal_code"] = loc_df["merch_postal_code"].astype(str) - # Apply the function to create a new column - loc_df["city"] = loc_df["merch_postal_code"].apply( - categorize_city - ) + # Create a dictionary for quick lookup + zipcode_to_city = dict(zip(city_zipcode_map['merch_postal_code'].astype(str), city_zipcode_map['city'])) + # Map the city based on the zipcode + loc_df["city"] = loc_df["merch_postal_code"].map(zipcode_to_city).fillna(default_city) return loc_df return dp.t.make_user_transformation( diff --git a/src/DP_epidemiology/viz.py b/src/DP_epidemiology/viz.py index 5a1ba54..193a252 100644 --- a/src/DP_epidemiology/viz.py +++ b/src/DP_epidemiology/viz.py @@ -23,7 +23,7 @@ from DP_epidemiology.contact_matrix import get_age_group_count_map, get_contact_matrix_country -def create_hotspot_dash_app(df:pd.DataFrame): +def create_hotspot_dash_app(df:pd.DataFrame,city_zipcode_map:pd.DataFrame,default_city:str): cities = { "Medellin": (6.2476, -75.5658), "Bogota": (4.7110, -74.0721), @@ -69,7 +69,7 @@ def update_graph(start_date, end_date, epsilon, city): end_date = datetime.strptime(end_date, '%Y-%m-%d') # Filter data using hotspot_analyser - output = hotspot_analyzer(df, start_date, end_date, city, epsilon) + output = hotspot_analyzer(df, city_zipcode_map, start_date, end_date, city, default_city, epsilon) filtered_df = get_coordinates(output) # Plot using Plotly Express @@ -96,7 +96,7 @@ def update_graph(start_date, end_date, epsilon, city): return app -def create_mobility_dash_app(df: pd.DataFrame): +def create_mobility_dash_app(df: pd.DataFrame,city_zipcode_map:pd.DataFrame,default_city:str): cities = { "Medellin": (6.2476, -75.5658), "Bogota": (4.7110, -74.0721), @@ -152,7 +152,7 @@ def update_graph(start_date, end_date, city_filter, category, epsilon): end_date = datetime.strptime(end_date, '%Y-%m-%d') # Call the mobility_analyzer function - filtered_df = mobility_analyzer(df, start_date, end_date, city_filter, category, epsilon) + filtered_df = mobility_analyzer(df, city_zipcode_map, start_date, end_date, city_filter, default_city, category, epsilon) # Plot using Plotly Express fig = px.line( @@ -221,7 +221,7 @@ def update_graph(start_date, end_date, city_filter, category, epsilon): return app -def create_pandemic_adherence_dash_app(df: pd.DataFrame): +def create_pandemic_adherence_dash_app(df: pd.DataFrame,city_zipcode_map:pd.DataFrame,default_city:str): cities = { "Medellin": (6.2476, -75.5658), "Bogota": (4.7110, -74.0721), @@ -276,7 +276,7 @@ def update_graph(start_date, end_date, city_filter, essential_or_luxury, epsilon end_date = datetime.strptime(end_date, '%Y-%m-%d') # Call the pandemic_adherence_analyzer function - filtered_df = pandemic_adherence_analyzer(df, start_date, end_date, city_filter, essential_or_luxury, epsilon) + filtered_df = pandemic_adherence_analyzer(df, city_zipcode_map, start_date, end_date, city_filter, default_city, essential_or_luxury, epsilon) # Plot using Plotly Express fig = px.line( @@ -345,7 +345,7 @@ def update_graph(start_date, end_date, city_filter, essential_or_luxury, epsilon return app -def create_contact_matrix_dash_app(df:pd.DataFrame, age_groups:list=None, consumption_distribution : pd.DataFrame = None, P = None, scaling_factor = None): +def create_contact_matrix_dash_app(df:pd.DataFrame, city_zipcode_map:pd.DataFrame,default_city:str, age_groups:list=None, consumption_distribution : pd.DataFrame = None, P = None, scaling_factor = None): cities = { "Medellin": (6.2476, -75.5658), "Bogota": (4.7110, -74.0721), @@ -421,7 +421,7 @@ def update_contact_matrix(start_date, end_date, city, epsilon): # Get age group count map counts_per_city = [] for city in cities: - counts = get_age_group_count_map(df, age_groups, consumption_distribution, start_date, end_date, city) + counts = get_age_group_count_map(df, city_zipcode_map, age_groups, consumption_distribution, start_date, end_date, city, default_city) counts_per_city.append(list(counts.values())) # Hardcoded population distribution for the example @@ -448,7 +448,7 @@ def update_contact_matrix(start_date, end_date, city, epsilon): -def create_mobility_validation_dash_app(df_transactional_data: pd.DataFrame, df_google_mobility_data: pd.DataFrame): +def create_mobility_validation_dash_app(df_transactional_data: pd.DataFrame, df_google_mobility_data: pd.DataFrame,city_zipcode_map:pd.DataFrame,default_city:str): cities = { "Medellin": (6.2476, -75.5658), "Bogota": (4.7110, -74.0721), @@ -504,7 +504,7 @@ def update_graph(start_date, end_date, city_filter, category, epsilon): end_date = datetime.strptime(end_date, '%Y-%m-%d') # Call the mobility_analyzer function - filtered_df_transactional = mobility_analyzer(df_transactional_data, start_date, end_date, city_filter, category, epsilon) + filtered_df_transactional = mobility_analyzer(df_transactional_data, city_zipcode_map, start_date, end_date, city_filter, default_city, category, epsilon) # Call the preprocess_google_mobility function offset = filtered_df_transactional["date"].iloc[0] diff --git a/tests/location_data.csv b/tests/location_data.csv new file mode 100644 index 0000000..9c3bc40 --- /dev/null +++ b/tests/location_data.csv @@ -0,0 +1,304 @@ +merch_postal_code,city +8700000,Santiago +500034,Medellin +110621,Bogota +8900000,Santiago +111941,Bogota +111111,Bogota +111061,Bogota +8780000,Santiago +111321,Bogota +70675,Brasilia +9460000,Santiago +70374,Brasilia +70253,Brasilia +9080000,Santiago +110231,Bogota +70355,Brasilia +9650000,Santiago +110321,Bogota +111961,Bogota +70336,Brasilia +500030,Medellin +500020,Medellin +70354,Brasilia +110911,Bogota +9020000,Santiago +9420000,Santiago +70640,Brasilia +500008,Medellin +500042,Medellin +70345,Brasilia +9250000,Santiago +9380000,Santiago +111121,Bogota +70353,Brasilia +500031,Medellin +70710,Brasilia +111411,Bogota +110921,Bogota +9540000,Santiago +500043,Medellin +500044,Medellin +110811,Bogota +110211,Bogota +110111,Bogota +70387,Brasilia +110561,Bogota +110841,Bogota +70277,Brasilia +111071,Bogota +111921,Bogota +8420000,Santiago +110011,Bogota +111166,Bogota +9560000,Santiago +500024,Medellin +110141,Bogota +9480000,Santiago +500046,Medellin +112041,Bogota +8380000,Santiago +500007,Medellin +500013,Medellin +111621,Bogota +70070,Brasilia +111981,Bogota +500033,Medellin +70704,Brasilia +110931,Bogota +70256,Brasilia +500001,Medellin +111911,Bogota +8940000,Santiago +9630000,Santiago +110431,Bogota +111011,Bogota +70302,Brasilia +55411,Medellin +110821,Bogota +8980000,Santiago +111156,Bogota +70301,Brasilia +110881,Bogota +111221,Bogota +111151,Bogota +9200000,Santiago +8580000,Santiago +500023,Medellin +500036,Medellin +70077,Brasilia +500014,Medellin +500035,Medellin +110861,Bogota +70650,Brasilia +500010,Medellin +110311,Bogota +7910000,Santiago +500040,Medellin +70293,Brasilia +70385,Brasilia +111311,Bogota +500025,Medellin +9790000,Santiago +111831,Bogota +110851,Bogota +111631,Bogota +500012,Medellin +70313,Brasilia +111051,Bogota +500022,Medellin +110441,Bogota +9670000,Santiago +110541,Bogota +70210,Brasilia +110121,Bogota +70343,Brasilia +70670,Brasilia +111821,Bogota +111031,Bogota +70272,Brasilia +500047,Medellin +500002,Medellin +110010,Bogota +112021,Bogota +70235,Brasilia +111041,Bogota +70237,Brasilia +111511,Bogota +70383,Brasilia +70362,Brasilia +111971,Bogota +70351,Brasilia +500037,Medellin +8010000,Santiago +110521,Bogota +9500000,Santiago +112011,Bogota +70275,Brasilia +500005,Medellin +7630000,Santiago +500021,Medellin +110871,Bogota +500026,Medellin +500032,Medellin +111211,Bogota +70252,Brasilia +8320000,Santiago +111931,Bogota +500041,Medellin +500009,Medellin +70234,Brasilia +111176,Bogota +70273,Brasilia +500011,Medellin +500015,Medellin +70040,Brasilia +8050000,Santiago +110421,Bogota +110221,Bogota +70381,Brasilia +110411,Bogota +7550000,Santiago +110611,Bogota +9620000,Santiago +70071,Brasilia +110721,Bogota +9160000,Santiago +110711,Bogota +70236,Brasilia +7500000,Santiago +7750000,Santiago +111131,Bogota +70330,Brasilia +500028,Medellin +112031,Bogota +70631,Brasilia +500003,Medellin +70372,Brasilia +9580000,Santiago +70050,Brasilia +110571,Bogota +110551,Bogota +500016,Medellin +70337,Brasilia +500004,Medellin +70384,Brasilia +8460000,Santiago +110151,Bogota +110531,Bogota +111951,Bogota +70296,Brasilia +111711,Bogota +7970000,Santiago +7850000,Santiago +500027,Medellin +70310,Brasilia +8640000,Santiago +70344,Brasilia +500017,Medellin +111811,Bogota +111021,Bogota +70314,Brasilia +110001,Bogota +70200,Brasilia +9340000,Santiago +70660,Brasilia +8820000,Santiago +70294,Brasilia +70322,Brasilia +70298,Brasilia +8240000,Santiago +70232,Brasilia +70375,Brasilia +8500000,Santiago +70658,Brasilia +7071,Brasilia +8150000,Santiago +8860000,Santiago +70331,Brasilia +70295,Brasilia +70239,Brasilia +70276,Brasilia +110831,Bogota +9710000,Santiago +70312,Brasilia +70311,Brasilia +9120000,Santiago +70686,Brasilia +111141,Bogota +8540000,Santiago +70703,Brasilia +110511,Bogota +70305,Brasilia +70238,Brasilia +500006,Medellin +9810000,Santiago +70655,Brasilia +70307,Brasilia +70711,Brasilia +70258,Brasilia +110131,Bogota +111611,Bogota +70645,Brasilia +70360,Brasilia +70701,Brasilia +70680,Brasilia +70299,Brasilia +70089,Brasilia +7690000,Santiago +70633,Brasilia +70100,Brasilia +70635,Brasilia +70233,Brasilia +70304,Brasilia +70673,Brasilia +111841,Bogota +9750000,Santiago +70346,Brasilia +9660000,Santiago +70377,Brasilia +70620,Brasilia +70308,Brasilia +70390,Brasilia +70382,Brasilia +70630,Brasilia +70257,Brasilia +70278,Brasilia +70365,Brasilia +70373,Brasilia +70364,Brasilia +70306,Brasilia +70255,Brasilia +70610,Brasilia +70292,Brasilia +7810000,Santiago +70683,Brasilia +70363,Brasilia +70303,Brasilia +70702,Brasilia +70688,Brasilia +70347,Brasilia +70338,Brasilia +70648,Brasilia +70634,Brasilia +70380,Brasilia +70150,Brasilia +70315,Brasilia +70361,Brasilia +70297,Brasilia +70300,Brasilia +70350,Brasilia +70376,Brasilia +70705,Brasilia +70342,Brasilia +70632,Brasilia +70687,Brasilia +70386,Brasilia +70636,Brasilia +70274,Brasilia +70684,Brasilia +70352,Brasilia +70340,Brasilia +70316,Brasilia +70254,Brasilia diff --git a/tests/test.py b/tests/test.py index 3571952..5cd04bd 100644 --- a/tests/test.py +++ b/tests/test.py @@ -15,6 +15,10 @@ path = "tests/test_data.csv" df = pd.read_csv(path) +path = "tests/location_data.csv" +city_zipcode_map = pd.read_csv(path) +defalut_city = "Unknown" + @pytest.fixture def start_date(): @@ -30,7 +34,7 @@ def city(): def test_hotspot_analyzer(start_date, end_date, city): - result = hotspot_analyzer(df, start_date, end_date, city, epsilon=10) + result = hotspot_analyzer(df,city_zipcode_map, start_date, end_date, city,defalut_city, epsilon=10) # The output is a pandas DataFrame... assert isinstance(result, pd.DataFrame), "hotspot_analyzer did not return a DataFrame" @@ -44,7 +48,7 @@ def test_hotspot_analyzer(start_date, end_date, city): def test_mobility_analyzer(start_date, end_date, city): - result = mobility_analyzer(df, start_date, end_date, city, category="grocery_and_pharmacy", epsilon=10) + result = mobility_analyzer(df, city_zipcode_map, start_date, end_date, city, defalut_city, category="grocery_and_pharmacy", epsilon=10) # The output is a pandas DataFrame... assert isinstance(result, pd.DataFrame), "mobility_analyzer did not return a DataFrame" @@ -63,7 +67,7 @@ def test_mobility_analyzer(start_date, end_date, city): def test_pandemic_adherence_analyzer(start_date, end_date, city): - result = pandemic_adherence_analyzer(df, start_date, end_date, city, essential_or_luxury="luxury", epsilon=10) + result = pandemic_adherence_analyzer(df, city_zipcode_map, start_date, end_date, city, defalut_city, essential_or_luxury="luxury", epsilon=10) # The output is a pandas DataFrame... assert isinstance(result, pd.DataFrame), "pandemic_adherence_analyzer did not return a DataFrame" @@ -102,9 +106,10 @@ def test_contact_matrix(contact_matrix_params, start_date, end_date, city): params = contact_matrix_params result = get_age_group_count_map( df, + city_zipcode_map, contact_matrix_params["age_groups"], contact_matrix_params["consumption_distribution"], - start_date, end_date, city, + start_date, end_date, city, defalut_city, epsilon=1.0 ) diff --git a/tests/test_viz.ipynb b/tests/test_viz.ipynb index b2f2a62..bd855b9 100644 --- a/tests/test_viz.ipynb +++ b/tests/test_viz.ipynb @@ -36,16 +36,35 @@ "cell_type": "code", "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\kshub\\AppData\\Local\\Temp\\ipykernel_6032\\4236329312.py:2: DtypeWarning: Columns (3,4,5) have mixed types. Specify dtype option on import or set low_memory=False.\n", + " df_mobility = pd.read_csv(path)\n" + ] + } + ], "source": [ "path = \"C:\\\\Users\\\\kshub\\\\OneDrive\\\\Documents\\\\PET_phase_2\\\\Global_Mobility_Report (1).csv\"\n", - "df_mobility = pd.read_csv(path, low_memory=False)\n" + "df_mobility = pd.read_csv(path)\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, + "outputs": [], + "source": [ + "path=\"C:\\\\Users\\\\kshub\\\\OneDrive\\\\Documents\\\\PET_phase_2\\\\PETs_for_Public_Health_Challenge\\\\tests\\\\location_data.csv\"\n", + "city_zipcode_map=pd.read_csv(path)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, "outputs": [ { "data": { @@ -62,7 +81,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -70,13 +89,13 @@ } ], "source": [ - "app=create_hotspot_dash_app(df_tran)\n", + "app=create_hotspot_dash_app(df_tran,city_zipcode_map,\"Unknown\")\n", "app.run_server(debug=True,port=8050)" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -94,7 +113,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -102,13 +121,13 @@ } ], "source": [ - "app=create_mobility_dash_app(df_tran)\n", + "app=create_mobility_dash_app(df_tran,city_zipcode_map,\"Unknown\")\n", "app.run_server(debug=True,port=8051)" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -126,21 +145,35 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:390: SettingWithCopyWarning:\n", + "\n", + "\n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + "\n" + ] } ], "source": [ - "app= create_mobility_validation_dash_app(df_tran,df_mobility)\n", + "app= create_mobility_validation_dash_app(df_tran,df_mobility,city_zipcode_map,\"Unknown\")\n", "app.run_server(debug=True, port=8052)" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -158,7 +191,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -166,101 +199,15 @@ } ], "source": [ - "app=create_pandemic_adherence_dash_app(df_tran)\n", + "app=create_pandemic_adherence_dash_app(df_tran,city_zipcode_map,\"Unknown\")\n", "app.run_server(debug=True,port = 8053)" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n", - "c:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\utilities.py:400: SettingWithCopyWarning:\n", - "\n", - "\n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - "\n" - ] - }, { "ename": "FileNotFoundError", "evalue": "[Errno 2] No such file or directory: 'fractions_offline.csv'", @@ -268,8 +215,8 @@ "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[8], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m app\u001b[38;5;241m=\u001b[39m\u001b[43mcreate_contact_matrix_dash_app\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf_tran\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 2\u001b[0m app\u001b[38;5;241m.\u001b[39mrun_server(debug\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,port \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m8054\u001b[39m)\n", - "File \u001b[1;32mc:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\viz.py:387\u001b[0m, in \u001b[0;36mcreate_contact_matrix_dash_app\u001b[1;34m(df, age_groups, consumption_distribution, P, scaling_factor)\u001b[0m\n\u001b[0;32m 358\u001b[0m app\u001b[38;5;241m.\u001b[39mlayout \u001b[38;5;241m=\u001b[39m html\u001b[38;5;241m.\u001b[39mDiv([\n\u001b[0;32m 359\u001b[0m dcc\u001b[38;5;241m.\u001b[39mDatePickerSingle(\n\u001b[0;32m 360\u001b[0m \u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstart-date-picker\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 383\u001b[0m html\u001b[38;5;241m.\u001b[39mDiv(\u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmatrix-output\u001b[39m\u001b[38;5;124m'\u001b[39m, style\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwhiteSpace\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpre-line\u001b[39m\u001b[38;5;124m'\u001b[39m})\n\u001b[0;32m 384\u001b[0m ])\n\u001b[0;32m 386\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m scaling_factor \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 387\u001b[0m scaling_factor \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mfractions_offline.csv\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mvalues\n\u001b[0;32m 389\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m P \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 390\u001b[0m P \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marray([\u001b[38;5;241m4136344\u001b[39m, \u001b[38;5;241m4100716\u001b[39m, \u001b[38;5;241m3991988\u001b[39m, \u001b[38;5;241m3934088\u001b[39m, \u001b[38;5;241m4090149\u001b[39m, \u001b[38;5;241m4141051\u001b[39m, \u001b[38;5;241m3895117\u001b[39m, \u001b[38;5;241m3439202\u001b[39m,\n\u001b[0;32m 391\u001b[0m \u001b[38;5;241m3075077\u001b[39m, \u001b[38;5;241m3025100\u001b[39m, \u001b[38;5;241m3031855\u001b[39m, \u001b[38;5;241m2683253\u001b[39m, \u001b[38;5;241m2187561\u001b[39m, \u001b[38;5;241m1612948\u001b[39m, \u001b[38;5;241m1088448\u001b[39m, \u001b[38;5;241m1394217\u001b[39m]) \n", + "Cell \u001b[1;32mIn[13], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m app\u001b[38;5;241m=\u001b[39m\u001b[43mcreate_contact_matrix_dash_app\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf_tran\u001b[49m\u001b[43m,\u001b[49m\u001b[43mcity_zipcode_map\u001b[49m\u001b[43m,\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mUnknown\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m 2\u001b[0m app\u001b[38;5;241m.\u001b[39mrun_server(debug\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,port \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m8054\u001b[39m)\n", + "File \u001b[1;32mc:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\PETs_for_Public_Health_Challenge\\src\\DP_epidemiology\\viz.py:387\u001b[0m, in \u001b[0;36mcreate_contact_matrix_dash_app\u001b[1;34m(df, city_zipcode_map, default_city, age_groups, consumption_distribution, P, scaling_factor)\u001b[0m\n\u001b[0;32m 358\u001b[0m app\u001b[38;5;241m.\u001b[39mlayout \u001b[38;5;241m=\u001b[39m html\u001b[38;5;241m.\u001b[39mDiv([\n\u001b[0;32m 359\u001b[0m dcc\u001b[38;5;241m.\u001b[39mDatePickerSingle(\n\u001b[0;32m 360\u001b[0m \u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstart-date-picker\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 383\u001b[0m html\u001b[38;5;241m.\u001b[39mDiv(\u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmatrix-output\u001b[39m\u001b[38;5;124m'\u001b[39m, style\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwhiteSpace\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpre-line\u001b[39m\u001b[38;5;124m'\u001b[39m})\n\u001b[0;32m 384\u001b[0m ])\n\u001b[0;32m 386\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m scaling_factor \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 387\u001b[0m scaling_factor \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mfractions_offline.csv\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mvalues\n\u001b[0;32m 389\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m P \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 390\u001b[0m P \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marray([\u001b[38;5;241m4136344\u001b[39m, \u001b[38;5;241m4100716\u001b[39m, \u001b[38;5;241m3991988\u001b[39m, \u001b[38;5;241m3934088\u001b[39m, \u001b[38;5;241m4090149\u001b[39m, \u001b[38;5;241m4141051\u001b[39m, \u001b[38;5;241m3895117\u001b[39m, \u001b[38;5;241m3439202\u001b[39m,\n\u001b[0;32m 391\u001b[0m \u001b[38;5;241m3075077\u001b[39m, \u001b[38;5;241m3025100\u001b[39m, \u001b[38;5;241m3031855\u001b[39m, \u001b[38;5;241m2683253\u001b[39m, \u001b[38;5;241m2187561\u001b[39m, \u001b[38;5;241m1612948\u001b[39m, \u001b[38;5;241m1088448\u001b[39m, \u001b[38;5;241m1394217\u001b[39m]) \n", "File \u001b[1;32mc:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\.venv\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:1026\u001b[0m, in \u001b[0;36mread_csv\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m 1013\u001b[0m kwds_defaults \u001b[38;5;241m=\u001b[39m _refine_defaults_read(\n\u001b[0;32m 1014\u001b[0m dialect,\n\u001b[0;32m 1015\u001b[0m delimiter,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1022\u001b[0m dtype_backend\u001b[38;5;241m=\u001b[39mdtype_backend,\n\u001b[0;32m 1023\u001b[0m )\n\u001b[0;32m 1024\u001b[0m kwds\u001b[38;5;241m.\u001b[39mupdate(kwds_defaults)\n\u001b[1;32m-> 1026\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\.venv\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:620\u001b[0m, in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m 617\u001b[0m _validate_names(kwds\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnames\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m))\n\u001b[0;32m 619\u001b[0m \u001b[38;5;66;03m# Create the parser.\u001b[39;00m\n\u001b[1;32m--> 620\u001b[0m parser \u001b[38;5;241m=\u001b[39m TextFileReader(filepath_or_buffer, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwds)\n\u001b[0;32m 622\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m chunksize \u001b[38;5;129;01mor\u001b[39;00m iterator:\n\u001b[0;32m 623\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m parser\n", "File \u001b[1;32mc:\\Users\\kshub\\OneDrive\\Documents\\PET_phase_2\\.venv\\lib\\site-packages\\pandas\\io\\parsers\\readers.py:1620\u001b[0m, in \u001b[0;36mTextFileReader.__init__\u001b[1;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[0;32m 1617\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moptions[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m kwds[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas_index_names\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m 1619\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandles: IOHandles \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m-> 1620\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_engine \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_engine\u001b[49m\u001b[43m(\u001b[49m\u001b[43mf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mengine\u001b[49m\u001b[43m)\u001b[49m\n", @@ -280,7 +227,7 @@ } ], "source": [ - "app=create_contact_matrix_dash_app(df_tran)\n", + "app=create_contact_matrix_dash_app(df_tran,city_zipcode_map,\"Unknown\")\n", "app.run_server(debug=True,port = 8054)" ] }