Skip to content
New issue

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

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

Already on GitHub? # to your account

Issue/Enhancement- Make the expand option in the REST interface consistent with other options #659

Closed
colin-e-nhsd opened this issue Sep 11, 2020 · 2 comments
Assignees
Labels

Comments

@colin-e-nhsd
Copy link

colin-e-nhsd commented Sep 11, 2020

SnowOwl: 7.8.4
Endpoint: /snomed-ct/v3/{path}/concepts

Describe the bug
The concepts endpoint has an expand option. This option accepts a parameter defining multiple choices selected from any combination of the values: fsn(); pt(); and descriptions()

Issues:

  1. The doc page does not define the syntax for the single string parameter (it accepts comma-delimited options)
  2. The interface accepts multiple string parameter values in any order, therefore it should be of type string array (not a single delimited string) to be consistent with other options in the interface, e.g. ancestor
  3. The presentation of the allowed parameters as "function like" i.e. with parentheses is misleading. They are not functions and they don't accept parameters. These are column or attribute names (or maybe attribute synonyms) and are therefore just plain fsn etc. I think.

Expected / Preferred behavior

  1. Give expand a string array parameter type like the other multi-value options
  2. Make the choices plain column names (no parentheses), unless they are ultimately going to behave like functions and allow parameter values to be supplied in the parentheses for each option.

Version

  • Snow Owl Version: 7.8.4
  • Elasticsearch Version (external): ?
@cmark
Copy link
Member

cmark commented Sep 23, 2020

Hi @colin-e-nhsd,

Yes, this is something we would like to enhance in the future to make the expansion API easier to use and accept array of values as well, not just a single String value.
We will definitely schedule this for an upcoming release.

The presentation of the allowed parameters as "function like" i.e. with parentheses is misleading. They are not functions and they don't accept parameters. These are column or attribute names (or maybe attribute synonyms) and are therefore just plain fsn etc. I think.

Regarding the function-like behaviour. This is actually by design and some of the parameters that are accepted by the expand query parameter are actually allow arguments to be defined.
For example: descendants() expansion accepts three arguments:

  • direct: true|false - whether to return direct descendants, aka children, or return concepts from the entire subtree
  • limit: integer - the number of descendants to return
  • expand: for nested expansion (eg. to expand the fsn() of the descendant concepts)

This is similar to GraphQL APIs, where you can create a nested query.

A great example would be to fetch all information for a concept in a single request:

curl localhost:8080/snowowl/snomed-ct/v3/<path>/concepts/<conceptId>?expand=definitionStatus(expand(pt(),fsn())),module(expand(pt(),fsn())),pt(),fsn(),descriptions(expand(acceptabilities(expand(acceptability(expand(pt())),languageRefSet(expand(pt(),fsn())))),type(expand(pt())),module(expand(pt())),caseSignificance(expand(pt())))),relationships(expand(type(expand(pt(),fsn())),destination(expand(pt(),fsn())),module(expand(pt(),fsn())),characteristicType(expand(pt(),fsn())),modifier(expand(pt(),fsn()))))

This returns a Concept JSON object with all necessary information expanded (description with types/modules/etc, relationships with types/destinations/etc, concept pt/fsn) to display a detail page for it. It even supports Locale based display label expansion by using the Accept-Language header.

Regards,
Mark

cmark added a commit that referenced this issue Jul 16, 2021
Update documentation to use `array<string>` collection format.
Update all uses of expand parameter by extracting it into a
ResourceSelectors class.

Fixes #659.
@cmark
Copy link
Member

cmark commented Oct 29, 2021

Hi @colin-e-nhsd,

This feature is available in the latest 8.0.0 release. Feel free to check it out.

Cheers,
Mark

@cmark cmark closed this as completed Oct 29, 2021
@cmark cmark self-assigned this Oct 29, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants