Materials-Consortia / Materials-Consortia/optimade-python-tools

The `OptimadeClient` should have a persistent cache on disk

Open
#1,190 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

client enhancement help wanted
Dominant language
Python
Stars
91
Forks
54
PR merge metrics
No merged PRs in 30d

Description

As discussed in #1154, it would be good if the OptimadeClient had a persistent cache it could use to avoid repeating queries, e.g.:

optimade-get --filter 'elements HAS "Ag" example.org should check the cache.json for keys ["structures"][filter][base_url] before making any new requests.

Caveats:

  • The cache lookup should check for any links->next to indicate whether not all pages of the results were pulled.
  • The cache should have a timeout/lifetime; this could be dynamic based on a auxiliary query to the database sorted by last_modified.
  • The cache location should be configurable

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

Start by reading the OptimadeClient and optimade-get entry points, then review the cache.json structure described in the issue and the discussion in #1154. Define how incomplete links->next results, cache lifetime, dynamic freshness, and configurable location should work; done means repeated queries reuse valid complete cached results without unnecessary requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.