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

feat(openchallenges): extend EDAM endpoint with sorting capabilities #2644

Merged
merged 6 commits into from
Apr 22, 2024

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Apr 22, 2024

Closes #2642

cc: @rrchai

Changelog

  • add the query parameters sort and direction to the search query of the EDAM concept endpoint
  • index the new property preferred_label_sort in Elasticsearch
  • update EDAM endpoint to sort concepts by relevance or preferred label (default)
  • add example queries to requests.http
  • update API client for Angular

Preview

GET {{basePath}}/edamConcepts?sort=preferred_label
GET {{basePath}}/edamConcepts?sort=preferred_label&direction=asc
HTTP/1.1 200 

{
  "number": 0,
  "size": 100,
  "totalElements": 3473,
  "totalPages": 35,
  "hasNext": true,
  "hasPrevious": false,
  "edamConcepts": [
    {
      "id": 1901,
      "classId": "http://edamontology.org/format_3010",
      "preferredLabel": ".nib"
    },
    {
      "id": 889,
      "classId": "http://edamontology.org/data_2178",
      "preferredLabel": "1 or more"
    },
    {
      "id": 2923,
      "classId": "http://edamontology.org/operation_3640",
      "preferredLabel": "18O labeling"
    },
...

Sort the challenges by relevance (still by preferred label if search terms is empty):

GET {{basePath}}/edamConcepts?sort=relevance&searchTerms=data
HTTP/1.1 200 

{
  "number": 0,
  "size": 100,
  "totalElements": 166,
  "totalPages": 2,
  "hasNext": true,
  "hasPrevious": false,
  "edamConcepts": [
    {
      "id": 2,
      "classId": "http://edamontology.org/data_0006",
      "preferredLabel": "Data"
    },
    {
      "id": 1028,
      "classId": "http://edamontology.org/data_2540",
      "preferredLabel": "Data index data"
    },
    {
      "id": 2635,
      "classId": "http://edamontology.org/operation_2409",
      "preferredLabel": "Data handling"
    },
    {
      "id": 826,
      "classId": "http://edamontology.org/data_2093",
      "preferredLabel": "Data reference"
    },
    {
      "id": 968,
      "classId": "http://edamontology.org/data_2353",
      "preferredLabel": "Ontology data"
    },
...

Development Notes

Check that the property preferred_label_sort is indexed by ES:

http://localhost:9200/openchallenges-edam-concept-000001

@tschaffter tschaffter marked this pull request as ready for review April 22, 2024 21:35
Copy link

Quality Gate Passed Quality Gate passed for 'openchallenges-app'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

Quality Gate Passed Quality Gate passed for 'openchallenges-challenge-service'

Issues
0 New issues
6 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

Quality Gate Passed Quality Gate passed for 'openchallenges-organization-service'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

Quality Gate Passed Quality Gate passed for 'openchallenges-image-service'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@rrchai rrchai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

It seems the results of sorting alphabetic will show the labels with special characters and number first, which means by default they will be the top results displayed in the input data type filter. Would you think we should move those to the bottom, or it's acceptable?

GET {{basePath}}/edamConcepts?searchTerms={
  "number": 0,
  "size": 100,
  "totalElements": 3473,
  "totalPages": 35,
  "hasNext": true,
  "hasPrevious": false,
  "edamConcepts": [
    {
      "id": 1901,
      "classId": "http://edamontology.org/format_3010",
      "preferredLabel": ".nib"
    },
    {
      "id": 889,
      "classId": "http://edamontology.org/data_2178",
      "preferredLabel": "1 or more"
    },
    {
      "id": 2923,
      "classId": "http://edamontology.org/operation_3640",
      "preferredLabel": "18O labeling"
    },
    {
      "id": 891,
      "classId": "http://edamontology.org/data_2180",
      "preferredLabel": "2 or more"
    },
    {
      "id": 977,
      "classId": "http://edamontology.org/data_2363",
      "preferredLabel": "2D PAGE data"
    },
    {
      "id": 3408,
      "classId": "http://edamontology.org/topic_3521",
      "preferredLabel": "2D PAGE experiment"
    },
    {
      "id": 1318,
      "classId": "http://edamontology.org/data_2965",
      "preferredLabel": "2D PAGE gel report"
    },
    {
      "id": 101,
      "classId": "http://edamontology.org/data_0942",
      "preferredLabel": "2D PAGE image"
    },
    {
      "id": 978,
      "classId": "http://edamontology.org/data_2364",
      "preferredLabel": "2D PAGE report"
    },
    {
      "id": 986,
      "classId": "http://edamontology.org/data_2372",
      "preferredLabel": "2D PAGE spot report"
    },
...

@tschaffter
Copy link
Member Author

@rrchai You are making a good point. A different behavior will be considered in a future PR.

@tschaffter tschaffter merged commit eb0a0c4 into Sage-Bionetworks:main Apr 22, 2024
13 checks passed
@tschaffter tschaffter deleted the sort-edam-concepts branch April 22, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Extend EDAM endpoint with sorting capabilities
2 participants