Robert Dennett
unread,Nov 4, 2025, 12:46:10 PM (8 days ago) Nov 4Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to STAC Community, ico...@element84.com, STAC Community, rob.d...@twdb.texas.gov, Robert Dennett
The purpose of this extension is to return Collections belonging to a certain category, along with the counts of any collections in the results which belong to second, third, etc. category. This extension is build to service a particular need we have in our UI, and I don't know that it would be helpful for others.
Since I was unable to find instructions on how to actually implement an API extension, I created a project with a Dockerfile which installs stac-fastapi-pgstac. The code in the project contains a python script which defines a ConformanceClasses class, a child of the Collections class, a child of the CoreCrudClient class and a child of the APIExtension class. The parent classes are those found in stac-fastapi-pgstac. Additionally, there is a .sql file which contains the DDL for a Postgres function which actually performs the business logic, similar to the other functions defined by pgstac.
The extension only supports collections and so the ConformanceClasses class only defines a URL for Collections. It's currently a placeholder since I note that a number of conformance class URLs return 404 errors when you try to follow them.
My collections class adds another field which contains the counts of other categories.
The CoreCrudClient child adds a method which causes a new endpoint to link to the PG function. It closely mimics the method which serves the /collections endpoint
The APIExtension child defines the methods necessary to register the client method as responding to the endpoint which we're calling /facets.
Does this sound reasonable/in line with how you might implement an extension? Are there other things I need to create that I may have missed? It works in my testing, but I am winging it here and am not sure I did it right.
Thanks,
Rob