Commit 22d5b50b authored by Dorian's avatar Dorian
Browse files

reperage de cas interessant

parent 50a1c27c
This diff is collapsed.
......@@ -42,7 +42,7 @@ MUNICIPALITIES = {
}
CLUSTER_THRESHOLD = 4
CODE = 1050
CODE = 1190
DB_PATH = '../data/potelets.db'
GEOJSON_PATH = '../data/potelets_clustered.geojson'
......
import json
import geojson
import operator
import datetime
URL = 'http://fixmystreet.brussels/'
def format_date(date_str):
# %Y-%m-%dT%H:%M:%S
date = {}
date_split = date_str.split("T")
date["day"] = ".".join(date_split[0].split("-")[::-1])
......@@ -38,16 +40,24 @@ def formatingPotelet(potelet):
potelet["updatedDate"] = format_date(potelet["updatedDate"])
potelet["creationDate"] = format_date(potelet["creationDate"])
# interesting case?
creationDate = datetime.datetime.strptime(potelet["creationDate"]["day"], '%d.%m.%Y')
updatedDate = datetime.datetime.strptime(potelet["updatedDate"]["day"], '%d.%m.%Y')
year = (updatedDate - creationDate).days
if year >= 365:
if len(potelet["attachments"])>4:
print(potelet["id"], year)
# add link to the original website
potelet["url"] = URL + str(potelet["id"])
potelet["actor"] = format_actor("", potelet["responsibleOrganisation"], potelet["responsibleDepartment"])
has_img_or_txt = False
for attachment in potelet["attachments"]:
attachment["date"] = format_date(attachment["date"])
attachment["actor"] = format_actor(attachment["actor_type"], attachment["organisation"], attachment["department"])
type = attachment["type"]
if type == "COMMENT" or type == "PICTURE":
has_img_or_txt = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment