Skip to content

Commit

Permalink
fix: Drop extraneous parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Oct 9, 2023
2 parents 6efea0d + 68c6f0a commit d3b1b3b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
24 changes: 13 additions & 11 deletions osm_fieldwork/data_models/buildings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ where:
- join_or:
- { building: not null, amenity: not null, tourism: not null }
keep:
- building
- building:levels
- building:material
- roof:material
- roof:shape
- roof:levels
- cusine
- amenity
- convenience
- diesel
- version
- building
- building:levels
- building:material
- roof:material
- roof:shape
- roof:levels
- cusine
- amenity
- convenience
- diesel
- version
- name
- name:en
18 changes: 12 additions & 6 deletions osm_fieldwork/filter_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,27 @@ def cleanData(
for feature in indata["features"]:
log.debug(f"FIXME0: {feature}")
properties = dict()
for key, value in feature["properties"].items():
log.debug(f"FIXME1: {key} = {value}")
if key in self.qc["keep"]:
if key == "tags":
for key, value in feature['properties'].items():
# log.debug(f"{key} = {value}")
# FIXME: this is a hack!
if True:
if key == 'tags':
for k, v in value.items():
if k[:4] == "name":
properties["title"] = value[k]
properties["label"] = value[k]
else:
properties[k] = v
else:
if key == "osm_id":
properties["id"] = value
if key == 'osm_id':
properties['id'] = value
properties['title'] = value
properties['label'] = value
else:
properties[key] = value
if key[:4] == "name":
properties['title'] = value
properties['label'] = value
else:
log.debug(f"FIXME2: {key} = {value}")
if key in keep:
Expand Down
9 changes: 2 additions & 7 deletions osm_fieldwork/make_data_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,12 @@ def __init__(
(MakeExtract): An instance of this object
"""
self.db = PostgresClient(uri, f"{rootdir}/data_models/{config}")
# path = Path(config)
# if path.suffix == '.yaml':
# self.qc.parseYaml(f"{rootdir}/data_models/{config}")
# else:
# self.qc.parseJson(f"{rootdir}/data_models/{config}")

# Read in the XLSFile
if "/" in xlsfile:
file = open(xlsfile, "rb")
else:
file = open(f"{rootdir}/{xlsfile}", "rb")
file = open(f"{rootdir}/xlsforms/{xlsfile}", 'rb')
self.xls = BytesIO(file.read())

def getFeatures(
Expand Down Expand Up @@ -134,7 +129,7 @@ def cleanFeatures(
"""
log.debug("Cleaning features")
cleaned = FilterData()
cleaned.parse(self.xls, self.db.qc.config)
cleaned.parse(self.xls)
new = cleaned.cleanData(collection)
# jsonfile = open(filespec, "w")
# dump(new, jsonfile)
Expand Down

0 comments on commit d3b1b3b

Please sign in to comment.