mysociety / alaveteli

Provide a Freedom of Information request system for your jurisdiction
https://alaveteli.org
Other
385 stars 195 forks source link

Link public bodies to Wikidata entry #6535

Open garethrees opened 2 years ago

garethrees commented 2 years ago

There's already a WhatDoTheyKnow organisation ID.

This would enable things like Adding an authority logo, pulling in a Twitter handle, and updating home pages.

We should consider how we make this usable for all Alavetelis.

garethrees commented 2 years ago

Probably want to hinge this on public body tags, e.g. wikidata:Q4916650.

RichardTaylor commented 2 years ago

See

https://github.com/mysociety/alaveteli/issues/235#issuecomment-977070532

which I think is about obtaining geographical coordinates for public bodies via the WikiData links.

laurentS commented 1 year ago

We are working on this with madada.fr right now, we've kept track of our conversation around this with a wikidata expert who's helping us on our forum (in French): https://forum.madada.fr/t/suivi-du-travail-nlnet-2-1-lien-avec-wikidata/654/10

I wish I has searched the issues here before :(

What ID do you use for the WhatDoTheyKnow organisation ID? We were thinking of using the internal db id, which seems to be the only stable ID that alaveteli has. url_name for instance changes when an organisation is renamed. Do you see any major issues with this? I was thinking of adding a url such as /body/by_id/:id which would redirect to the public page of the body on our site, so that it becomes possible to link from wikidata to madada.fr (or any other alaveteli site then).

garethrees commented 1 year ago

I wish I has searched the issues here before

It is a goldmine!

What ID do you use for the WhatDoTheyKnow organisation ID

We use url_name by the looks of it.

Screenshot 2022-09-13 at 17 30 18

Alaveteli redirects from an old url_name to the current version.

https://github.com/mysociety/alaveteli/blob/d095180580f12faaee84cb3f21c1c3f6422706b7/app/controllers/public_body_controller.rb#L32

I was thinking of adding a url such as /body/by_id/:id

I'd go with /body/:id to mimic the way that it works with requests if you go down this route (i.e. https://www.whatdotheyknow.com/request/872106https://www.whatdotheyknow.com/request/reserves_11). Can take a look at the code that does that for inspiration.

garethrees commented 1 year ago

We use url_name

I should add that there is some appetite to use the internal ID in places (e.g. for https://mysociety.github.io/uk_local_authority_names_and_codes/ I think).

I'd go with /body/:id

Could route this to a separate action to keep the code cleaner instead of jamming it in to the existing PublicBodyController#show:

# Routes
match '/body/:id' => 'public_body#by_id' # …

# Controller
def by_id
  redirect_to show_public_body_path(PublicBody.find(params[:id]).url_name)
end
mdeuk commented 1 year ago

I should add that there is some appetite to use the internal ID in places (e.g. for https://mysociety.github.io/uk_local_authority_names_and_codes/ I think).

From a WDTK perspective, this would have been my preference!

Using the slug (url_name) is a little bit of a nuisance, as it can make for out-of-date data[^1], or in the case of bodies we've renamed [^2], misleading information, as the identifier points to a body which isn't the one the Wikidata entry refers to.

If we implement mapping of identifiers in Alaveteli, it'll let the WDTK team work to correct this historic anomaly - it should be a reasonably simple data matching exercise we can do (OpenRefine might work).

[^1]: NHS organisations, for example - where there is a renaming which didn't otherwise affect the constitution of the entity, we'd simply rename them. Whereas, for Schools, conversion to academy status is a brand new entity on WDTK. [^2]: For example, where a successor entity uses the trading name of the predecessor - we've been known to swap the url_name around (for example, East West Rail Consortium's url_name was reused for East West Railway Company, and Abellio ScotRail's url_name was reused for ScotRail Trains).

laurentS commented 1 year ago

Just updating this ticket to mention the newly created Ma Dada Organisation ID which we ended up creating using the same logic as WDTK (using url_name) to favour compatibility between sites. We are in the process of marking our 50k authorities with it starting this week.