Materials-Consortia / OPTIMADE

Specification of a common REST API for access to materials databases
https://optimade.org/specification
Creative Commons Attribution 4.0 International
83 stars 37 forks source link

Deserializing a whole OPTIMADE API as a file #471

Open ml-evs opened 1 year ago

ml-evs commented 1 year ago

At the workshop, we discussed a file format specification that would allow an entire OPTIMADE API to be stored in a single file on disk. This would be useful for many applications (archival + restore, data transfer, local tools/exploration, caching etc.). We (@unkcpz, @eimrek, @giovannipizzi) proposed a draft of this file format that is approximately the following:

optimade_example.jsonl:

{"x-optimade": {...}}
{"meta": {"api_version": "1.1.0"}}
{"data": {"type": "info", "attributes": {"provider": {...}}}
{"info/structures": {"properties": ["_aiida_cell_volume": {"type": "number", ...}]}
{"info/references": {...}}
{"data": {"type": "structures", "id": "1234", "attributes": {...}}
{"data": {"type": "structures", "id": "1235", "attributes": {...}}
{"data": {"type": "references", "id": "sfdas", "attributes": {...}}

If there is interest, we will try to write this up as an appendix of the specification.

merkys commented 1 year ago

I had a somewhat similar idea when exploring the idea to store OPTIMADE responses or even serve them statically. I was thinking more about file tree layout than single file, but this layer could be handled by tar and similar tools.

My principles were the following:

A very simple server can then be developed to serve these static files.

ml-evs commented 4 months ago

Just a note that we adopted a very similar format to this in https://github.com/materialscloud-org/optimade-maker, though the OP is slightly out of date.

I can see the benefits of allowing both a single file and a directory structure (suggested above by @merkys). Somehow this could be capture in the top line of the root file, outlining whether the "client" should read the next lines of the file to find data, or look elsewhere in the filesystem.