Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
OpenBuildingMap
rabotnik-obm
Commits
fd6102da
Commit
fd6102da
authored
Feb 18, 2022
by
Marius Kriegerowski
Browse files
rebase and adapt to new celery implementation
parent
01df5344
Pipeline
#38935
failed with stage
in 2 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rabotnikobm/rules/gem_occupancy/get_building_occupancy.py
View file @
fd6102da
...
...
@@ -106,6 +106,7 @@ class RulesOneUniqueSubGroup:
)
@
Rule
.
app
.
task
(
bind
=
True
,
base
=
Rule
)
class
GetBuildingOccupancy
(
Rule
):
"""A rule to map OSM tags to building occupancies."""
...
...
@@ -123,16 +124,15 @@ class GetBuildingOccupancy(Rule):
RulesOneUniqueSubGroup
,
]
async
def
evaluate
(
self
,
payload
:
dict
)
->
GEMTag
:
building_id
=
payload
[
"building_id"
]
def
evaluate
(
self
,
building_id
:
int
)
->
GEMTag
|
None
:
logger
.
debug
(
"Processing building: %s"
,
building_id
)
tags
=
await
self
.
storage
.
expect_one
(
tags
=
self
.
storage
.
expect_one
(
f
"SELECT tags FROM osm_building_relations WHERE osm_id=
{
building_id
}
AND index=0"
)
logger
.
debug
(
f
"working on tags:
{
tags
}
"
)
if
not
tags
:
return
return
# Mapping to GEM taxonomy strings
occupancies
=
[]
...
...
@@ -147,7 +147,3 @@ class GetBuildingOccupancy(Rule):
logger
.
debug
(
"occupancies %s: %s"
,
building_id
,
occupancy
)
return
occupancy
async
def
apply_mappings
(
self
,
tags
):
for
rule
in
self
.
candidates
:
rule
.
apply
(
tags
)
rabotnikobm/rules/get_building.py
View file @
fd6102da
...
...
@@ -37,7 +37,7 @@ class GetBuilding(Rule):
"""A rule to copy a building entry from a source database to a destination database."""
@
Rule
.
app
.
task
(
bind
=
True
,
base
=
Rule
)
def
evaluate
(
self
,
building_id
):
def
evaluate
(
self
,
building_id
:
int
):
logger
.
info
(
"called building task"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment