Skip to content

Commit

Permalink
Revert "Add is_omitted column to column mapping profiles (#46)"
Browse files Browse the repository at this point in the history
This reverts commit 9224cb6.
  • Loading branch information
kflemin authored Sep 23, 2024
1 parent 9224cb6 commit 457ccd9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
8 changes: 3 additions & 5 deletions pyseed/seed_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,6 @@ def create_or_update_column_mapping_profile(
"from_units": null,
"to_table_name": "PropertyState"
"to_field": "address_line_1",
"is_omitted": False
},
{
"from_field": "address1",
Expand All @@ -935,7 +934,6 @@ def create_or_update_column_mapping_profile(
...
]
The is_omitted mapping may be absent - it is treated as False if it is not present.
Returns:
dict: {
'id': 1
Expand Down Expand Up @@ -974,9 +972,9 @@ def create_or_update_column_mapping_profile_from_file(
) -> dict:
"""creates or updates a mapping profile. The format of the mapping file is a CSV with the following format:
Raw Columns, units, SEED Table, SEED Columns, Omit\n
PM Property ID, , PropertyState, pm_property_id, False\n
Building ID, , PropertyState, custom_id_1, False\n
Raw Columns, units, SEED Table, SEED Columns\n
PM Property ID, , PropertyState, pm_property_id\n
Building ID, , PropertyState, custom_id_1\n
...\n
This only works for 'Normal' column mapping profiles, that is, it does not work for
Expand Down
21 changes: 9 additions & 12 deletions pyseed/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,15 @@ def read_map_file(mapfile_path):

# Open the mapping file and fill list
maplist = list()

for rowitem in map_reader:
data = {
"from_field": rowitem[0],
"from_units": rowitem[1],
"to_table_name": rowitem[2],
"to_field": rowitem[3],
}
try:
data["is_omitted"] = True if rowitem[4].lower().strip() == "true" else False
except IndexError:
data["is_omitted"] = False

maplist.append(data)
maplist.append(
{
'from_field': rowitem[0],
'from_units': rowitem[1],
'to_table_name': rowitem[2],
'to_field': rowitem[3],
}
)

return maplist
1 change: 0 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ def test_mapping_file(self):
"from_units": "ft**2",
"to_field": "gross_floor_area",
"to_table_name": "PropertyState",
"is_omitted": False
}
assert mappings[5] == expected

0 comments on commit 457ccd9

Please sign in to comment.