jer164 commited on
Commit
dd7aa55
·
1 Parent(s): b265125

added support for dallas

Browse files
app.py CHANGED
@@ -100,6 +100,7 @@ app_ui = ui.page_fluid(
100
  "ATL": "Atlanta",
101
  "ATX": "Austin, TX",
102
  "CLB": "Columbus, OH",
 
103
  "DEN": "Denver",
104
  "DET": "Detroit",
105
  "LA_C": "Los Angeles",
 
100
  "ATL": "Atlanta",
101
  "ATX": "Austin, TX",
102
  "CLB": "Columbus, OH",
103
+ "DTX": "Dallas, TX",
104
  "DEN": "Denver",
105
  "DET": "Detroit",
106
  "LA_C": "Los Angeles",
src/constants.py CHANGED
@@ -119,7 +119,10 @@ COLUMN_KEY_DICTIONARY = {
119
  "address": "full_address",
120
  "city_state_zip_code": "city",
121
  "payment_amount": "donation_amount",
122
- "payment_received_date": "donation_date"
 
 
 
123
  }
124
 
125
  PREFERRED_HEADERS = [
 
119
  "address": "full_address",
120
  "city_state_zip_code": "city",
121
  "payment_amount": "donation_amount",
122
+ "payment_received_date": "donation_date",
123
+ "name_": "full_name",
124
+ "transaction_date_": "donation_date",
125
+ "amount_": "donation_amount"
126
  }
127
 
128
  PREFERRED_HEADERS = [
src/tranformers/state_transforms.py CHANGED
@@ -700,6 +700,16 @@ class CLB(StateTransformer):
700
  input_df['city'] = input_df['city'].str.split(",", expand=True)[0]
701
  input_df['donation_date'] = input_df['donation_date'].str.extract(pat=r"(\d\d\/\d\d\/\d\d\d\d)")
702
  return input_df
 
 
 
 
 
 
 
 
 
 
703
 
704
  class WayneCo(StateTransformer):
705
  def format_data(self, input_df: pd.DataFrame, **kwargs) -> pd.DataFrame:
 
700
  input_df['city'] = input_df['city'].str.split(",", expand=True)[0]
701
  input_df['donation_date'] = input_df['donation_date'].str.extract(pat=r"(\d\d\/\d\d\/\d\d\d\d)")
702
  return input_df
703
+
704
+ class DTX(StateTransformer):
705
+ def format_data(self, input_df: pd.DataFrame, **kwargs) -> pd.DataFrame:
706
+ input_df[["full_name", "addr1", "city_state_zip"]] = input_df["full_name"].str.split("\n", expand=True)
707
+ input_df = input_df[input_df["full_name"].str.contains(",")]
708
+ input_df["full_name"] = input_df["full_name"].apply(lambda x: " ".join(x.split(", ")[::-1]))
709
+ input_df["city"] = input_df["city_state_zip"].str.split(",", expand=True)[0]
710
+ input_df["state"] = input_df["city_state_zip"].str.extract(r"([A-Z]{2})", expand=True)
711
+ input_df["zip"] = input_df["city_state_zip"].str.extract(r"(\d{5})-*",expand=True)
712
+ return input_df
713
 
714
  class WayneCo(StateTransformer):
715
  def format_data(self, input_df: pd.DataFrame, **kwargs) -> pd.DataFrame:
src/tranformers/transformers.py CHANGED
@@ -14,6 +14,7 @@ from src.tranformers.state_transforms import (
14
  DC_NEW,
15
  DE,
16
  DEN,
 
17
  FEC,
18
  FL,
19
  GA,
@@ -147,4 +148,5 @@ selector.register_geo("WY", WY)
147
  selector.register_geo("WAYNE_CO", WayneCo)
148
  selector.register_geo("MNSTP", MNSTP)
149
  selector.register_geo("MNSTP_OLD", OldMNSTP)
150
- selector.register_geo("CLB", CLB)
 
 
14
  DC_NEW,
15
  DE,
16
  DEN,
17
+ DTX,
18
  FEC,
19
  FL,
20
  GA,
 
148
  selector.register_geo("WAYNE_CO", WayneCo)
149
  selector.register_geo("MNSTP", MNSTP)
150
  selector.register_geo("MNSTP_OLD", OldMNSTP)
151
+ selector.register_geo("CLB", CLB)
152
+ selector.register_geo("DTX", DTX)