Skip to content

Commit

Permalink
analyse merge sirene
Browse files Browse the repository at this point in the history
only keep those who are missing from OSM
  • Loading branch information
nlehuby committed Oct 3, 2018
1 parent f84d038 commit 30f25cb
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions analysers/analyser_merge_shop_FR.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ def __init__(self, config, logger = None):
class SubAnalyser_Merge_Shop_FR(SubAnalyser_Merge_Dynamic):
def __init__(self, config, error_file, logger, items, classs, level, title, selectTags, generateTags):
classss = int(classs.replace('.', '0')[:-1]) * 100 + ord(classs[-1]) - 65
self.missing_official = {"item": items[0], "class": classss+1, "level": level, "tag": ["merge"], "desc": T_(u"%s not integrated", title) }
self.missing_osm = {"item": items[1], "class": classss+2, "level": level, "tag": ["merge"], "desc": T_(u"%s without ref:FR:SIRET or invalid", title) }
self.possible_merge = {"item": items[0][0:-1]+"1", "class": classss+3, "level": level, "tag": ["merge"], "desc": T_(u"%s, integration suggestion", title) }
self.update_official = {"item": items[0][0:-1]+"2", "class": classss+4, "level": level, "tag": ["merge"], "desc": T_(u"%s update", title) }
self.missing_official = {"item": items[0], "class": classss+1, "level": level, "tag": ["merge"], "desc": T_(u"%s may be missing", title) }
#self.missing_osm = {"item": items[1], "class": classss+2, "level": level, "tag": ["merge"], "desc": T_(u"%s without ref:FR:SIRET or invalid", title) }
#self.possible_merge = {"item": items[0][0:-1]+"1", "class": classss+3, "level": level, "tag": ["merge"], "desc": T_(u"%s, integration suggestion", title) }
#self.update_official = {"item": items[0][0:-1]+"2", "class": classss+4, "level": level, "tag": ["merge"], "desc": T_(u"%s update", title) }

SubAnalyser_Merge_Dynamic.__init__(self, config, error_file, logger,
"http://www.sirene.fr/sirene/public/static/open-data",
u"Sirene",
Expand All @@ -64,17 +65,17 @@ def __init__(self, config, error_file, logger, items, classs, level, title, sele
select = Select(
types = ['nodes', 'ways'],
tags = selectTags),
conflationDistance = 80,
conflationDistance = 200,
generate = Generate(
static1 = generateTags,
static2 = {"source": self.source},
mapping1 = {
"ref:FR:SIRET": lambda fields: fields["SIREN"] + fields["NIC"],
"ref:FR:RNA": "RNA",
# "ref:FR:SIRET": lambda fields: fields["SIREN"] + fields["NIC"],
# "ref:FR:RNA": "RNA",
"name": lambda fields: fields["ENSEIGNE"] or (fields["NOMEN_LONG"] if fields["NJ"] else None),
"short_name": "SIGLE",
"start_date": lambda fields:
"-".join([fields["DDEBACT"][0:4], fields["DDEBACT"][4:6], fields["DDEBACT"][6:8]]) if fields["DDEBACT"] != "19000101" else
"-".join([fields["DCRET"][0:4], fields["DCRET"][4:6], fields["DCRET"][6:8]]) if fields["DCRET"] != "19000101" else
None},
"short_name": "SIGLE"},
# "start_date": lambda fields:
# "-".join([fields["DDEBACT"][0:4], fields["DDEBACT"][4:6], fields["DDEBACT"][6:8]]) if fields["DDEBACT"] != "19000101" else
# "-".join([fields["DCRET"][0:4], fields["DCRET"][4:6], fields["DCRET"][6:8]]) if fields["DCRET"] != "19000101" else
# None},
text = lambda tags, fields: {"en": ', '.join(filter(lambda f: f and f != 'None', [fields["ENSEIGNE"] or (fields["NOMEN_LONG"] if fields["NJ"] else None)] + map(lambda k: fields[k], ["L1_DECLAREE", "L2_DECLAREE" ,"L3_DECLAREE", "L4_DECLAREE", "L5_DECLAREE", "L6_DECLAREE", "L7_DECLAREE"])))} )))

0 comments on commit 30f25cb

Please sign in to comment.