Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Museum integration in France with Muséofile database #618

Closed
Olyon opened this issue Sep 18, 2019 · 11 comments
Closed

Museum integration in France with Muséofile database #618

Olyon opened this issue Sep 18, 2019 · 11 comments

Comments

@Olyon
Copy link
Contributor

Olyon commented Sep 18, 2019

ici : https://www.data.gouv.fr/fr/datasets/musees-de-france-base-museofile/
on trouve les musées en France bénéficiant de l'appellation « musée de France ».
Je propose cette analyse pour intégrer ces musées avec la réference "ref:FR:muséofile" de cette base de donnée.

#!/usr/bin/env python
#-*- coding: utf-8 -*-

from .Analyser_Merge import Analyser_Merge, Source, CSV, Load, Mapping, Select, Generate
import re

class Analyser_Merge_Museum_FR(Analyser_Merge):
    def __init__(self, config, logger = None):

        self.missing_official = {"item":"8010", "class": 31, "level": 3, "tag": ["merge"], "desc": T_(u"Museum not integrated") }
        self.possible_merge   = {"item":"8011", "class": 33, "level": 3, "tag": ["merge"], "desc": T_(u"Museum, integration suggestion") }
        self.update_official  = {"item":"8012", "class": 34, "level": 3, "tag": ["merge"], "desc": T_(u"Museum update") }

        Analyser_Merge.__init__(self, config, logger,
            u"https://www.data.gouv.fr/fr/datasets/musees-de-france-base-museofile/",
            u"Musées de France : base Muséofile",
            CSV(Source(attribution = u"Ministère de la Culture - Muséofile", millesime = "09/2019",
                    fileUrl = u"https://www.data.gouv.fr/fr/datasets/r/5ccd6238-4fb0-4b2c-b14a-581909489320"),
                separator = u';'),
            Load("geolocalisation", "geolocalisation",
                 where = lambda row: row["geolocalisation"],
                 xFunction = lambda x: x and x.split(',')[1],
                 yFunction = lambda y: y and y.split(',')[0]
                 ),
            Mapping(
                select = Select(
                    types = ["nodes", "ways"],
                    tags = {"tourism": "museum"}),
                conflationDistance = 50,
                osmRef = u"ref:FR:muséofile",
                generate = Generate(
                    static1 = {"tourism": "museum"},
                    static2 = {"source": self.source},
                    mapping1 = {u"ref:FR:muséofile": "Identifiant"},
                    mapping2 = {"website": "URL",
                                "phone": u"Téléphone",
                                "phone": lambda res: "+33 " + res["Téléphone"][1:] if re.match(r"^0[0-9] [0-9]{2} [0-9]{2} [0-9]{2} [0-9]{2}", res["Téléphone"]) else res["Téléphone"],
                                "name": lambda res: res["Nom usage"] if res["Nom usage"] else res["Nom officiel"][0].upper() + res["Nom officiel"][1:],
                                "official_name" : lambda res: res["Nom officiel"][0].upper() + res["Nom officiel"][1:] if res["Nom usage"] and res["Nom officiel"].lower() != res["Nom usage"].lower() else None,
                                },
                    text = lambda tags, fields: {"en": ' '.join(filter(lambda x: x, [fields["Adresse"], fields["Code Postal"], fields["Ville"]]))})))
@frodrigo
Copy link
Member

Please can you submit it as pull request.

@frodrigo
Copy link
Member

frodrigo commented Oct 3, 2019

@frodrigo
Copy link
Member

frodrigo commented Oct 7, 2019

Still missing France Métropole.

@frodrigo
Copy link
Member

@Olyon
Run on métropole fails with:

2019-10-14 14:11:44   run osmosis all analyser Analyser_Merge_Museum_FR
2019-10-14 14:11:44   Analyser_Merge.py:865 sql
2019-10-14 14:11:44   Analyser_Merge.py:620 sql
2019-10-14 14:11:44   Load source into database
2019-10-14 14:11:44   Analyser_Merge.py:628 sql
2019-10-14 14:11:44   Analyser_Merge.py:636 sql
2019-10-14 14:11:44   Analyser_Merge.py:638 sql
2019-10-14 14:11:44   Analyser_Merge.py:640 sql
2019-10-14 14:11:44   Analyser_Merge.py:641 sql
2019-10-14 14:11:45   Convert data to tags
2019-10-14 14:11:45   Analyser_Merge.py:660 sql
2019-10-14 14:11:45   Analyser_Merge.py:661 sql
2019-10-14 14:11:46   error: res=[u'50.059654,4.10348', u'50.059654,4.10348', u'M1136', u'rue Clavon', None, u"Le site verrier de Tr\xe9lon est exceptionnel par son patrimoine technique et industriel, r\xe9v\xe9lateur d'une importante activit\xe9 \xe9conomique aux XIXe et XXe si\xe8cles. A cet endroit se sont succ\xe9d\xe9s deux types de production verri\xe8re : d'abord une verrerie \xe0 bouteilles, puis une verrerie de flaconnage. L'atelier-mus\xe9e du verre offre donc, dans le cadre de l'ancien b\xe2timent des fours, les t\xe9moignages de plusieurs si\xe8cles d'industrie du verre. On y voit notamment les fours Boetius (1850) et Stein (1920), les arches \xe0 recuire \xe0 ferrasse et \xe0 tapis, un ensemble de machines semi-automatiques de flaconnage", u'Mus\xe9e de site : Usine', u'59132', u'Ethnologie;Technique et industrie', u'Nord', None, u"Les collections de l'\xe9comus\xe9e de la r\xe9gion Fourmies-Tr\xe9lon ont \xe9t\xe9 principalement constitu\xe9es gr\xe2ce aux dons de particuliers ou d'industriels. Au total, plus de 50 000 objets et machines concernant les principales activit\xe9s du territoire de l'\xe9comus\xe9e ont \xe9t\xe9 rassembl\xe9s : industries, agriculture, artisanat, ethnographie r\xe9gionale.", u"Install\xe9 au milieu d'un site industriel du d\xe9but du XIXe si\xe8cle (grande halle de 1823)", None, None, None, None, None, u'Parc naturel r\xe9gional', u'Hauts-de-France', u'03 27 60 66 11', u'Arts d\xe9coratifs : Verrerie;Archives papier, Archives sonores, Fonds ancien d imprim\xe9s, Image anim\xe9e, Photographie;Ethnologie : M\xe9tiers et Outils;Histoire : Histoire locale et r\xe9gionale;Sciences et techniques : Industrie', u'www.ecomusee-avesnois.fr/Frameset.aspx?page=musees/Trelon/default.aspx', u'Tr\xe9lon', u'50.059654,4.10348']
2019-10-14 14:11:46   error: ret=None
2019-10-14 14:11:46   error: error on analyse merge_museum_FR...
2019-10-14 14:11:46     Traceback (most recent call last):
2019-10-14 14:11:46       File "./osmose_run.py", line 228, in execc
2019-10-14 14:11:46         analyser_obj.analyser()
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Osmosis.py", line 192, in analyser
2019-10-14 14:11:46         self.analyser_osmosis_common()
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Merge.py", line 866, in analyser_osmosis_common
2019-10-14 14:11:46         table = self.load.run(self, self.parser, self.mapping, self.config.db_user, self.__class__.__name__.lower()[15:], self.analyser_version())
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Merge.py", line 707, in run
2019-10-14 14:11:46         osmosis.run0((sql01_ref if mapping.osmRef != "NULL" else sql01_geo) % {"table":table, "x":self.x, "y":self.y, "where":self.formatCSVSelect(), "distinct": distinct, "order_by": order_by}, insertOfficial)
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Osmosis.py", line 420, in run0
2019-10-14 14:11:46         ret = callback(res)
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Merge.py", line 684, in insertOfficial
2019-10-14 14:11:46         tags = mapping.generate.tagFactory(res)
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Merge.py", line 787, in tagFactory
2019-10-14 14:11:46         tags_secondary = self.tagFactoryGroup(res, self.static2, self.mapping2)
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/Analyser_Merge.py", line 777, in tagFactoryGroup
2019-10-14 14:11:46         r = colomn(res)
2019-10-14 14:11:46       File "/data/project/osmose/backend/analysers/analyser_merge_museum_FR.py", line 56, in <lambda>
2019-10-14 14:11:46         "name": lambda res: res["Nom usage"][0].upper() + res["Nom usage"][1:] if res["Nom usage"] else res["Nom officiel"][0].upper() + res["Nom officiel"][1:],
2019-10-14 14:11:46     TypeError: 'NoneType' object has no attribute '__getitem__'

http://buildbot.osmose.openstreetmap.fr/builders/france_local_db/builds/732/steps/osmose_run.py/logs/stdio

@Olyon
Copy link
Contributor Author

Olyon commented Oct 14, 2019

Il y a un musée qui n'a pas de nom !
Je n'avais pas vu. ni nom officiel ni nom d'usage. il n'y en a qu'un
Donc il faut changer la ligne :
"name": lambda res: res["Nom usage"][0].upper() + res["Nom usage"][1:] if res["Nom usage"] else res["Nom officiel"][0].upper() + res["Nom officiel"][1:],
pour vérifier qu'un nom existe :
"name": lambda res: res["Nom usage"][0].upper() + res["Nom usage"][1:] if res["Nom usage"] else res["Nom officiel"][0].upper() + res["Nom officiel"][1:] if res["Nom officiel"] else None,

Chez moi ça marche avec ça

frodrigo added a commit to frodrigo/osmose-backend that referenced this issue Oct 15, 2019
jocelynj added a commit that referenced this issue Oct 16, 2019
* frodrigo/master:
  Use pyproj to improv Merge perf
  User run() for SQL
  Also log run0 SQL query call
  Split SQL queries in Analyser_Merge
  Fix analyser_merge_museum_FR.py with no name, fix by Olyon #618
  Base upload error on HTTP code
  Enable merge_carpool_FR #659
@frodrigo
Copy link
Member

@vinber
Copy link
Contributor

vinber commented Oct 24, 2019

Thanks, but here i don't understand http://osmose.openstreetmap.fr/fr/map/#item=8010%2C8011&class=31%2C33&zoom=18&lat=44.835697&lon=-0.574734&level=1%2C2%2C3&tags=&fixable=

Musée d'Aquitaine / 2 different number
ref:FR:museofile = M0064 If it's Museum not integrated
ref:FR:museofile = M0069 if it's Museum, integration suggestion

@frodrigo
Copy link
Member

If required, you can set both with M0064;M0069

@Olyon
Copy link
Contributor Author

Olyon commented Oct 24, 2019

2 museums at the same address.
Musée d'Aquitaine : https://www.pop.culture.gouv.fr/notice/museo/M0064
Musée Goupil : https://www.pop.culture.gouv.fr/notice/museo/M0069
According to wikipedia, the Musée d'Aquitaine host the Musée Goupil since 1998.

@frodrigo
Copy link
Member

Maybe on the paper, but the Musée Goupil have an other location https://www.openstreetmap.org/way/154310583

@vinber
Copy link
Contributor

vinber commented Oct 24, 2019

according to the web site and a phonecall, now "Musée Goupil" is host by "Muséee d'Aquitaine" : https://www.openstreetmap.org/node/6912095875#map=19/44.83557/-0.57455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants