Skip to content
Novus Examples
json1.1 KB

Measurement JSON Schema — Units as Annotations (.json)

A 2020-12 JSON Schema for the absorbance rows, carrying the physical unit and coverage factor as custom annotation keywords beside the standard type and range constraints. Annotations like these are ignored by validators and read by humans and tooling, which is precisely the contract being tested.

Preview — first 50 linesjson
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.invalid/novus/scientific/measurement-schema.json",
  "title": "Spectrometer absorbance row",
  "description": "Column contract for the paired absorbance CSV, including physical units.",
  "type": "object",
  "required": [
    "wavelength_nm",
    "absorbance_AU",
    "u_absorbance_AU_k2",
    "instrument_id"
  ],
  "additionalProperties": false,
  "properties": {
    "wavelength_nm": {
      "type": "number",
      "unit": "nm",
      "minimum": 190,
      "maximum": 1100
    },
    "absorbance_AU": {
      "type": "number",
      "unit": "AU",
      "minimum": -0.1,
      "maximum": 4.0
    },
    "u_absorbance_AU_k2": {
      "type": "number",
      "unit": "AU",
      "minimum": 0,
      "coverageFactor": 2,
      "confidenceLevel": "95%"
    },
    "blank_corrected": {
      "type": "boolean"
    },
    "instrument_id": {
      "type": "string",
      "pattern": "^NX-[A-Z]+-SYNTH-[0-9]{2}$"
    },
    "flag": {
      "type": "string",
      "enum": [
        "ok",
        "near_saturation",
        "saturated",
        "suspect"
      ]
    }
  }
52 lines total — download for the full file.

Specifications

Dialect
JSON Schema 2020-12
Properties
6
Required Properties
4
Unit Annotations
custom 'unit' keyword on three properties
Coverage Factor Annotation
true
Additional Properties
false
Describes
the spectrometer absorbance CSV

Testing contract

Expected to pass
Scenario
Validate one row of the paired absorbance CSV against this schema, then read the unit annotation for absorbance_AU.
Expected result
A conforming row validates, a row with an extra column fails on additionalProperties, and the unit annotation reads 'AU' with u_absorbance_AU_k2 declaring coverageFactor 2.

What is a .json file?

JSON (JavaScript Object Notation) is a lightweight, text-based data-interchange format representing objects, arrays, strings, numbers, booleans, and null. It is language-independent, human-readable, and the dominant format for web APIs and configuration. It requires a single well-formed root value.

How to use this file

Use an example JSON file to test parsers and serializers, schema validation, Unicode and number-precision handling, and API request or response processing.

How to use this file for testing

“Measurement JSON Schema — Units as Annotations (.json)” is a deterministic Novus Examples fixture for Scientific data, Schema validation, Editor testing. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: JSON · 1,158 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Code examples

import json

with open("measurement-schema.json") as f:
    data = json.load(f)
print(type(data), len(data))

Generated by generation/scientific.py. Free for any use, no attribution required — license.