codeforberlin / tickets

Collecting good beginner tasks and project ideas.
https://github.com/codeforberlin/tickets/issues
Creative Commons Zero v1.0 Universal
16 stars 0 forks source link

get images for public bodies #7

Open jfilter opened 6 years ago

jfilter commented 6 years ago

On FragDenStaat are details about public bodies but not images. It would be cool to have for each public body an image.

You can get public body information here: https://fragdenstaat.de/api/v1/publicbody/

One idea, use the search on https://commons.wikimedia.org/wiki/Main_Page. Or use either https://www.wikidata.org/wiki/Wikidata:Main_Page or dbpedia-lookup to first get the item and then an image.

It would be cool to have an npm module, that gives me an image url to an public body name. Then it could be included in the frontend of FragDenStaat and also into the mobile app. But having a separate registry/database would also be fine. One could also think about somehow adding/merging all the public bodies into wikidata.

Contact person: @jfilter

k-nut commented 6 years ago

I think this can probably be done with Wikidata directly. Here is a [query] that gets the logos of all public transport providers and federal ministries. One could probably build on top of this to find other classes of entities (state ministries etc.) that should also be included. Or am I misunderstanding the goal of this task?

[query]: https://query.wikidata.org/#%23defaultView%3AImageGrid%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fpicture%0AWHERE%20%0A%7B%0A%20%20%7B%20%3Fitem%20wdt%3AP31%20%20wd%3AQ740752%20%7D%20UNION%20%7B%20%3Fitem%20wdt%3AP31%20%20wd%3AQ896375%20%7D%0A%20%20%3Fitem%20wdt%3AP17%20wd%3AQ183%20.%0A%20%20%3Fitem%20wdt%3AP154%20%3Fpicture%20.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D

jfilter commented 6 years ago

Yes it’s a rather small project, but I still want to encapsulate the functionality in a module to use it for the app as well as the website.

And I think you have to do some serious data wrangling. It’s not only about the logo but also an image of the building. But some public bodies have several buildings. And for the important bodies such as federal ministries, you may want to choose the best pictures by manually selecting them.

k-nut commented 6 years ago

Wikidata actually also has an image property on items. See this query. The results are far from perfect though. So maybe it would be nice that once someone found a matching image for you use case they also add it to Wikidata so that everyone can profit from it :) I'm happy to help with that part!