diff --git a/frontend/App.vue b/frontend/App.vue
index 89661ae..66fab57 100644
--- a/frontend/App.vue
+++ b/frontend/App.vue
@@ -321,6 +321,11 @@
{{wd_item.street_address[0]}}
+
+
closed
+
{{wd_item.closed.join('; ')}}
+
+
diff --git a/matcher/model.py b/matcher/model.py
index 546abc2..403ff70 100644
--- a/matcher/model.py
+++ b/matcher/model.py
@@ -145,18 +145,21 @@ class Item(Base):
return dict(d) or None
def get_isa_qids(self):
- return {v["id"] for v in self.get_claim("P31") if v}
+ return [v["id"] for v in self.get_claim("P31") if v]
def is_street(self):
street_items = {
'Q79007', # street
'Q21000333', # shopping street
}
- return bool(street_items & self.get_isa_qids())
+ return bool(street_items & set(self.get_isa_qids()))
def is_tram_stop(self):
return 'Q2175765' in self.get_isa_qids()
+ def closed(self):
+ return [utils.format_wikibase_time(v) for v in self.get_claim("P3999") if v]
+
# class Claim(Base):
# __tablename__ = "claim"
# item_id = Column(Integer, primary_key=True)
diff --git a/matcher/utils.py b/matcher/utils.py
index b9d50ec..9581ea4 100644
--- a/matcher/utils.py
+++ b/matcher/utils.py
@@ -6,6 +6,7 @@ import math
import user_agents
import re
import pattern.en
+from datetime import date
metres_per_mile = 1609.344
feet_per_metre = 3.28084
@@ -168,3 +169,17 @@ def pluralize_label(label):
return "mines"
return pattern.en.pluralize(text)
+
+
+def format_wikibase_time(v):
+ p = v["precision"]
+ t = v["time"]
+
+ assert p in (9, 10, 11)
+
+ if p == 11:
+ return date.fromisoformat(t[1:11]).strftime("%d %B %Y")
+ if p == 10:
+ return date.fromisoformat(t[1:8] + "-01").strftime("%B %Y")
+ if p == 9:
+ return t[1:5]