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

REST API method for listing vocabularies and their metadata #754

Open
juhoinkinen opened this issue Dec 14, 2023 · 1 comment
Open

REST API method for listing vocabularies and their metadata #754

juhoinkinen opened this issue Dec 14, 2023 · 1 comment

Comments

@juhoinkinen
Copy link
Member

Currently the Annif REST API has /v1/projects endpoint for getting a list of available projects. This is needed e.g. in web UI usage for populating the projects menu.

At Finto AI there is also the menu for suggestions language, which sets the language of the suggestions labels independently of the used project. If/when the Northern Sami will be added to the labels language menu (NatLibFi/FintoAI#18 (comment)), allowed because now YSO has labels in Sami in addition to Finnish, Swedish and English, there should be a way in Annif API to inform Finto AI which label languages should be selectable depending on the selected project.

For example, YKL/PLC and KAUNO do not support Sami, and trying to get labels in Sami when using those projects, an JS error occurs. The selectable languages could ofc be hard-coded in Finto AI JS code, but a better approach would be to have /v1/languages endpoint in Annif API, which would give the same information as annif list-vocabs CLI command, notably the supported languages per project:

Vocabulary ID  Languages    Size   Loaded
-----------------------------------------
yso            en,fi,se,sv  38586  True  
ykl            en,fi,sv     2406   True  
kauno          en,fi,sv     31138  True 

Also, the endpoint could also offer some metadata of the language, for example URLs to "homepages" of the vocabularies, which are now hard-coded in Finto AI JS source. (Well, for vocabularies served at finto.fi, instead of hard-coding the URL, the mapping could just use appending <vocabId> to https://finto.fi/... but a more general solution would be better.)

@juhoinkinen
Copy link
Member Author

Also, the endpoint could also offer some metadata of the language, for example URLs to "homepages" of the vocabularies, which are now hard-coded in Finto AI JS source. (Well, for vocabularies served at finto.fi, instead of hard-coding the URL, the mapping could just use appending <vocabId> to https://finto.fi/... but a more general solution would be better.)

The (optional) vocabulary metadata could be stored in a file named vocabs.cfg or vocabs.toml, which would be in line with the project configurations file projects.{cfg,toml}.

In addition to a URLs, there could be also some free-form description for each vocabulary section.

I think @osma already had an idea to add a free-form description for each project too (in the projects configuration file?).

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

1 participant