Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 5, 2023
1 parent 3bb66ee commit e1d251e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
from loguru import logger as log
from osm_fieldwork import basemapper
from osm_fieldwork.json2osm import json2osm
from osm_rawdata.postgres import PostgresClient
from osm_fieldwork.OdkCentral import OdkAppUser
from osm_fieldwork.xlsforms import xlsforms_path
from osm_rawdata.postgres import PostgresClient
from shapely import wkt
from shapely.geometry import (
LineString,
Expand Down Expand Up @@ -1448,7 +1448,6 @@ def generate_appuser_files(
one = result.first()

if one:
prefix = one.project_name_prefix

# Get odk credentials from project.
odk_credentials = {
Expand Down Expand Up @@ -1478,24 +1477,29 @@ def generate_appuser_files(

else:
import osm_fieldwork as of

rootdir = of.__path__[0]

project = db.query(db_models.DbProject).filter(db_models.DbProject.id == project_id).first()
project = (
db.query(db_models.DbProject)
.filter(db_models.DbProject.id == project_id)
.first()
)
config_file_contents = project.form_config_file

project_log.info("Extracting Data from OSM")

config_path = "/tmp/config.yaml"
if config_file_contents:
with open(config_path, "w",encoding="utf-8") as config_file_handle:
with open(config_path, "w", encoding="utf-8") as config_file_handle:
config_file_handle.write(config_file_contents.decode("utf-8"))
else:
config_path = f"{rootdir}/data_models/{category}.yaml"

# # OSM Extracts for whole project
pg = PostgresClient("underpass", config_path)
outline = json.loads(one.outline)
boundary = {"type":"Feature","properties":{},"geometry":outline}
boundary = {"type": "Feature", "properties": {}, "geometry": outline}
outline_geojson = pg.execQuery(boundary)

updated_outline_geojson = {"type": "FeatureCollection", "features": []}
Expand Down

0 comments on commit e1d251e

Please sign in to comment.