Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

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

Closed tschaffter closed 2 months ago

tschaffter commented 2 months ago

Closes #2642

cc: @rrchai

Changelog

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
sonarcloud[bot] commented 2 months ago

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

sonarcloud[bot] commented 2 months ago

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

sonarcloud[bot] commented 2 months ago

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

sonarcloud[bot] commented 2 months ago

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

tschaffter commented 2 months ago

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