What is a schema?

A schema is a formal formatted representation of data as defined in the Sparrow database. Schema define the reproducible structure that is entered into the database and allow for subsequent transformations of data and connection to other databases.

Sparrow's import schemas interface with its database schemas but are conceptually separate. Sparrow's import infrastructure allows JSON with an appropriate schema structure to be imported into the database using the API.

For instance, the datum schema includes the value for one analytical parameter within one analysis (e.g. 87Sr/86Sr), the name of that type of datum, and uncertainty around the measurement. Schema such as session include multiple analysis.

Example schema from Sparrow

The various options for import schema can be viewed through the /api-explorer/v2 route on your implementation of Sparrow. These list the requirements for data to be incorporated using each nested level of the schema JSON. When building your importer using schema, be conscientious about what fields allow for null entries and be sure to exclude null entries.

Using schema for importing data

Reorganization of data to fit the schema is key. There are many ways to do this, the easiest is likely a Python script, although other languages like R have also been used.

Example code for an R reformater used on data from the WiscSIMS Lab is available in this Github file.

The API has examples of schemas.

There is a command-line feature for seeing schema definitions: sparrow show-interface <name-of-interface>. This tells you how to assemble the correct JSON to import data.