openreferral / api-specification

This is the working repository for Open Referral's Human Services Data API protocols.
https://openreferral.readthedocs.io/en/latest/hsda/
Other
29 stars 13 forks source link

Sorting #12

Closed kinlane closed 3 years ago

kinlane commented 7 years ago

How will we be sorting information. There is no sorting capability in the current design.

NeilMcKLogic commented 6 years ago

We need at least Alphabetical and Proximity (if a search reference location is included). A third option is Relevance which opens a big can of worms about how relevance is calculated. We could just keep that can closed for now though, leave it as a sorting option, and let each implementer decide how to calculate and sort via Relevance.

timgdavies commented 6 years ago

A last-updated (descending) sort will be important for synchronisation use-cases.

kinlane commented 6 years ago

Suggesting we run with

sortby ([fieldname],last-updated) order (asc,desc)

leaving proximity for futue release, and possibility limited to HSDA search.

combinging simplicity, best practices, and above feedback.

timgdavies commented 6 years ago

Would this only allow sorting by fields in the top resource? Or would we allow a syntax of field paths to access sub-resources in the /full / /complete representations (or even when /complete is not requested)?

For example, I might want to search for organizations, but sort the results based on thee funding source of their services.

Could this be expressed as:

?sortby=organizations/services/funding/source&order=asc

kinlane commented 6 years ago

with this release I kept just top level. Plan is to go next level with next release. Trying to minimize the change. Thanks for brining up!

rasmus-storjohann-PG commented 6 years ago

A possible alternative to the order parameter is an optional - prefix on each of the fields passed to sortby, that way it's possible to sort ascending by one field and descending by another. Not sure if this is functionality that is useful or just making things more complicated.

kinlane commented 6 years ago

@rasmus-storjohann-PG I like that concept. Will be evaluating.

kinlane commented 3 years ago

Keeping single parameter order by as the default, and will be adding robust search capabilities to /search.

      - in: query
        name: sort_by
        description: Which field to sort by.
        schema:
          type: string
      - in: query
        name: order
        description: Which order to sort by (asc,desc).
        schema:
          type: string