localgovdrupal / localgov_openreferral

Open Referral integration
0 stars 1 forks source link

Open referral: Vocabulary & Taxonomy endpoint #2

Closed ekes closed 3 years ago

ekes commented 3 years ago

Includes:-

and

ekes commented 3 years ago

So the open question:

Preparation for how taxonomy terms would work if a controlled (external) vocabulary (with it's own CURIE and IDs) is imported.

Filtering on by vocabulary and taxonomy is done on Services (and can be done on any other endpoint that would need to be filtered by them) by using Search API aggregated field. This way a string can be stored for the term id, and vocabulary against the entity and used for filtering - there can be different sources for this (uuid field, machine_name field, some external id field). This hopefully solves filtering.

What about listing the vocabularies and taxonomy terms with their correct ID?

endpoint/taxonomies/?vocabulary=esdCircumstances&per_page=500&parent_id=Accommodationtype
endpoint/services/?&taxonomy_id=AddictSubstanceAbuser&vocabulary=esdCircumstances&page=1

So vocabulary name is defined by the standard (and suggested to be used as a Curie) https://developers.openreferraluk.org/UseOfTaxonomies/#curies-to-use Not actually sure what prefixing the id with the curie would bring here if the query in the end includes vocabulary= The id is defined by the vocabulary itself https://standards.esd.org.uk/?uri=circumstanceCollection/Accommodationtype&tab=details If we had to route by the taxonomy_id then a custom upcaster which exploded the curie (look that up to find what entity type and bundle the term is in) and then load the id (what ever that maps to there) would be helpful; but we're not we're just filtering on an indexed text string for a list.

ekes commented 3 years ago

CURIES are now defined on the configuration entity the https://github.com/localgovdrupal/localgov_openreferral/blob/21f5d88ebfc4f7f1eeb82b62adb9621e4129e2fe/config/schema/localgov_openreferral.schema.yml#L19 public_datatype. If they aren't defined the bundle name is used. This is indexed and displayed.