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

Creating providers #724

Closed
mielvds opened this issue Sep 5, 2022 · 6 comments
Closed

Creating providers #724

mielvds opened this issue Sep 5, 2022 · 6 comments
Labels

Comments

@mielvds
Copy link
Contributor

mielvds commented Sep 5, 2022

Split of from #694:

     creating and importing concept schemes through the UI

Currently it's not possible to create a conceptschem through the UI since there is some programmatic configuration involed. Once created, it is possible to edit the metadata about the conceptscheme though. Importing of concepts is possible on a one by one basis, but not for a full conceptscheme. Importing entire conceptschemes from SKOS files is possible through the CLI.

Creating conceptschemes through the UI has been discussed once or twice, so there's certainly some interest in that.

Started draft PR in #725 . Help and guidance needed.

@koenedaele
Copy link
Member

koenedaele commented Sep 9, 2022

Before we dive into the code and the PR, I'd like to have a look at it from a more architectural point of view.

I think the endgoal we want to accomplish is: adding new CS without editing the code or config files. The current setup is extremely flexible, but it always requires updating the config and redeploying.

What we basically need is to have the create_registry funtion in https://github.com/OnroerendErfgoed/atramhasis/blob/develop/atramhasis/skos/__init__.py talk to the database to initialise all the SQLAlchemyProviders. This function is run on a per-request basis to initialise all providers. It doesn't only init internal providers stored in the SQL database, but can also handle any external provider such as the getty vocabs in this example, or a connection with someone else's Atramhasis through skosprovider_atramhasis. These providers are marked as "external" so they don't show up in the UI, but they are available in the edit environment for importing and matching concepts. So, we need to replace lines 29-143 and 160-167.

The pattern is basically: instantiate a SQLALchemyProvider and register it with the SkosRegistry. To instantiate a SQLAlchemyProvider the following things are absolutely necessary:

  • A provider ID, such as ERFGOEDTYPES or SPECIES, this is the ID by which the provider is known to the registry.
  • A conceptscheme_id, this is the ID of the CS in the database. This is only mandatory for SQLAlchemyProviders.
  • A SQLALchemy db connection. This is only mandatory for SQLAlchemyProviders

Not mandatory in theory because there's a default option, but pretty unavoidable in actual use:

I think these are the ones that are the most important. Apart from those there's also:

Of all of the above, the dataset stuff gives me the most concern. I do see that I never wrote docs on the void features and it never appeared in the release notes either, so it could be considered unofficial and unsupported. I was planning on replacing it with a dcat ap Vlaanderen file that could then be fed to open data portals, using a similar approach. But that required even more metadata and I never finished it. Still seems like that would be a useful feature, but that's a different story. All things considered, I'm considering dropping this feature to make our lives easier.

It basically boils down to ID's, URI generating patterns and a few config options that influence display options. The provider id could by default be equal to the conceptscheme_id, but be changeable to simplify things even more.

So, there's the data that makes up the actual CS and a few things that configure how Atramhasis deals with a certain CS. I don't think there's much point in being able to create a CS if you can't configure the corresponding provider and there also isn't much point in configuring a provider without a CS. This raises the question if these should be two endpoints or one. Currently I'm in favor of keeping them separated so it's possible to have different security roles there. A more technical admin who can configure the provider and a more business admin who can edit the CS data such a label and description, but can't change the URI config or hide providers. Probably makes it easier to maintain a close link between the CS endpoint and SKOS.

And that's enough for a Friday evening ;-)

@koenedaele
Copy link
Member

BTW, it's possible we rearrange things when it comes to issues and branches and stuff. We have a development model with feature branches and epics and such, but that uses some third-party software not everyone has access to. We'll look into this next week.

@koenedaele koenedaele added the Epic label Oct 3, 2022
@koenedaele koenedaele changed the title Creating and Deleting a conceptscheme through the UI Creating providers Jan 4, 2023
@cedrikv
Copy link
Contributor

cedrikv commented May 10, 2023

@koenedaele Shouldn't we add an option to provide a conceptscheme label? If you create a provider now, the label is just 'null':
image

@koenedaele
Copy link
Member

Good catch. How would this work?

  • Option 1: When POSTing a Provider, make it possible to add a conceptscheme label
  • Option 2: POST provider, GET conceptscheme, add label, PUT conceptscheme
  • Option 3: Update that dropdown to show the URI of a conceptscheme if there's no label present

Options I'm missing?

@cedrikv
Copy link
Contributor

cedrikv commented May 15, 2023

regarding option 3 : you can't edit the label of a conceptscheme in the current UI

@koenedaele
Copy link
Member

I think you can edit the label of a conceptscheme by pressing that "Edit" button next to the null label:

image

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

No branches or pull requests

3 participants