stac-utils / stac-utils/stac-fastapi

Increase core code?

Open
#812 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
324
Forks
126
Avg merge
1d 22h
Merged PRs (30d)
10

Description

This might be more of a discussion point that an issue. But it seems to me there is a lot of duplication between the different backends. Would it be possible to harmonise them. I know @jonhealy1 done something similar with the Elasticsearch and Opensearch parts of STAC FastAPI Elasticsearch Opensearch but I wondered if this was extendable to the other backends.

Possible areas of shared code:

  • Base Database model. Having a common set of methods, with typed input and outputs, for the database would make code sharing of other areas easier.
  • Switching from abstract methods to default methods for the BaseCoreClients. This would mean moving backend specific code to the database level which would give better separation of the API and Database layers. These methods could still be overridden in the backend if needed.
  • Base app.py. Most of this code looks like it could be shared if extensions can be split into API and Database components.
  • Authentication. Authentication should be independent of the chosen database.
  • Utilities. Some utility methods are copied across multiple backends and I imagine there are others that could be shared.

Ideally the only parts exclusive to the backends should be the database, serialisation, settings, and the database components of extensions. I understand this level of code sharing may not be possible.

This would require substantial changes to the core and backend code bases so I wanted to see if others agreed or if the backends were too different.

Tagging some people I think might have opinions please share with others.

@vincentsarago @jonhealy1 @m-mohr

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the different backend implementations, then inspect the Base Database model, BaseCoreClient, base app.py, authentication, utilities, and extension components named in the issue. First establish whether the backends can share these areas; done would require an agreed scope and design for substantial core and backend changes, which this discussion does not yet define.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.