Skip to content

Commit

Permalink
update owner types to include public
Browse files Browse the repository at this point in the history
  • Loading branch information
nlebovits committed Oct 10, 2024
1 parent c9b9d1b commit 2a7b130
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
16 changes: 0 additions & 16 deletions data/src/data_utils/llc_owner.py

This file was deleted.

37 changes: 37 additions & 0 deletions data/src/data_utils/owner_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pandas as pd
from classes.featurelayer import FeatureLayer

def owner_type(primary_featurelayer: FeatureLayer) -> FeatureLayer:
"""
Determines the ownership type for each property in the primary feature layer based on
the 'owner_1', 'owner_2', and 'city_owner_agency' columns. The ownership type is set as:
- "Public" if 'city_owner_agency' is not NA.
- "Business (LLC)" if 'city_owner_agency' is NA and "LLC" is found in 'owner_1' or 'owner_2'.
- "Individual" if 'city_owner_agency' is NA and "LLC" is not found in 'owner_1' or 'owner_2'.
Args:
primary_featurelayer (FeatureLayer): The feature layer containing property ownership data.
Returns:
FeatureLayer: The updated feature layer with the 'owner_type' column added.
"""
owner_types = []

for _, row in primary_featurelayer.gdf.iterrows():
# Extract owner1, owner2, and city_owner_agency
owner1 = str(row["owner_1"]).lower()
owner2 = str(row["owner_2"]).lower()
city_owner_agency = row["city_owner_agency"]

# Determine ownership type based on the conditions
if pd.notna(city_owner_agency):
owner_types.append("Public")
elif " llc" in owner1 or " llc" in owner2:
owner_types.append("Business (LLC)")
else:
owner_types.append("Individual")

# Add the 'owner_type' column to the GeoDataFrame
primary_featurelayer.gdf["owner_type"] = owner_types

return primary_featurelayer
4 changes: 2 additions & 2 deletions data/src/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from data_utils.gun_crimes import gun_crimes
from data_utils.imm_dang_buildings import imm_dang_buildings
from data_utils.l_and_i import l_and_i
from data_utils.llc_owner import llc_owner
from data_utils.owner_type import owner_type
from data_utils.nbhoods import nbhoods
from data_utils.negligent_devs import negligent_devs
from data_utils.opa_properties import opa_properties
Expand Down Expand Up @@ -50,7 +50,7 @@
imm_dang_buildings,
tactical_urbanism,
conservatorship,
llc_owner,
owner_type,
community_gardens,
park_priority,
ppr_properties,
Expand Down
4 changes: 2 additions & 2 deletions src/components/FilterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ const filters = [
type: 'buttonGroup',
},
{
property: 'llc_owner',
property: 'owner_type',
display: 'Owner',
options: ['Yes', 'No'],
options: ['Public', 'Business (LLC)', 'Individual'],
type: 'buttonGroup',
},
];
Expand Down
7 changes: 4 additions & 3 deletions src/components/Filters/DimensionFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ type OptionDisplayMapping = {
};

const optionsDisplayMapping: OptionDisplayMapping = {
llc_owner: {
Yes: 'Business',
No: 'Individual',
owner_type: {
Public: 'Public',
'Business (LLC)': 'Business (LLC)',
Individual: 'Individual',
},
};

Expand Down

0 comments on commit 2a7b130

Please sign in to comment.