{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "const": "fitdata"
    },
    "version": {
      "type": "string",
      "const": "0.0.0-local"
    },
    "profiles": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema0"
      }
    },
    "subject": {
      "$ref": "#/$defs/__schema1"
    },
    "producer": {
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/__schema1"
        },
        "version": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "name",
        "version"
      ],
      "additionalProperties": false
    },
    "references": {
      "type": "string",
      "enum": [
        "closed",
        "external"
      ]
    },
    "externalReferences": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema2"
      }
    },
    "records": {
      "maxItems": 10000,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema5"
      }
    }
  },
  "required": [
    "format",
    "version",
    "references",
    "records"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "string",
      "maxLength": 256,
      "pattern": "^[a-z][a-z0-9.-]*:[A-Za-z0-9_.-]+$"
    },
    "__schema1": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "__schema2": {
      "anyOf": [
        {
          "$ref": "#/$defs/__schema3"
        },
        {
          "$ref": "#/$defs/__schema4"
        }
      ]
    },
    "__schema3": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "id",
        "revision"
      ],
      "additionalProperties": false
    },
    "__schema4": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema0"
        },
        "version": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "id",
        "version"
      ],
      "additionalProperties": false
    },
    "__schema5": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "core.measurement"
            },
            "metric": {
              "$ref": "#/$defs/__schema0"
            },
            "time": {
              "$ref": "#/$defs/__schema19"
            },
            "value": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "quantity"
                    },
                    "value": {
                      "$ref": "#/$defs/__schema21"
                    },
                    "unit": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "required": [
                    "kind",
                    "value",
                    "unit"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "category"
                    },
                    "code": {
                      "$ref": "#/$defs/__schema0"
                    }
                  },
                  "required": [
                    "kind",
                    "code"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "type": "string",
                      "maxLength": 10000
                    }
                  },
                  "required": [
                    "kind",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "boolean"
                    },
                    "value": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "kind",
                    "value"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "absent"
                    },
                    "reason": {
                      "$ref": "#/$defs/__schema0"
                    }
                  },
                  "required": [
                    "kind",
                    "reason"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "laterality": {
              "type": "string",
              "enum": [
                "left",
                "right",
                "bilateral"
              ]
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "metric",
            "time",
            "value"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "core.series"
            },
            "interval": {
              "$ref": "#/$defs/__schema22"
            },
            "channels": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema23"
              }
            },
            "timing": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "regular"
                    },
                    "periodSeconds": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    }
                  },
                  "required": [
                    "kind",
                    "periodSeconds"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "irregular"
                    },
                    "offsetsSeconds": {
                      "maxItems": 100000,
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/__schema24"
                      }
                    }
                  },
                  "required": [
                    "kind",
                    "offsetsSeconds"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "samples": {
              "minItems": 1,
              "maxItems": 100000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema25"
              }
            },
            "resolution": {
              "type": "string",
              "enum": [
                "source",
                "downsampled"
              ]
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "interval",
            "channels",
            "timing",
            "samples",
            "resolution"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "core.summary"
            },
            "scope": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "day"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "interval"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "meal"
                    },
                    "label": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "required": [
                    "kind",
                    "label"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "time": {
              "$ref": "#/$defs/__schema19"
            },
            "metrics": {
              "maxItems": 500,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema27"
              }
            },
            "totals": {
              "maxItems": 500,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema28"
              }
            },
            "completeness": {
              "type": "string",
              "enum": [
                "complete",
                "partial",
                "unknown"
              ]
            },
            "statistic": {
              "type": "string",
              "enum": [
                "sum",
                "minimum",
                "maximum",
                "last",
                "mean"
              ]
            },
            "weighting": {
              "type": "string",
              "enum": [
                "samples",
                "time",
                "not_applicable"
              ]
            },
            "sampleCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "coverage": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "scope",
            "time"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "core.tombstone"
            },
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema9"
            }
          },
          "required": [
            "kind",
            "id",
            "revision"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "sleep.session"
            },
            "interval": {
              "$ref": "#/$defs/__schema22"
            },
            "isNap": {
              "type": "boolean"
            },
            "stages": {
              "maxItems": 10000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema31"
              }
            },
            "metrics": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema27"
              }
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "interval",
            "stages",
            "metrics"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema0"
            },
            "version": {
              "$ref": "#/$defs/__schema1"
            },
            "subject": {
              "$ref": "#/$defs/__schema32"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema33"
            },
            "provenance": {
              "$ref": "#/$defs/__schema34"
            },
            "links": {
              "$ref": "#/$defs/__schema35"
            },
            "extensions": {
              "$ref": "#/$defs/__schema36"
            },
            "kind": {
              "type": "string",
              "const": "training.routine"
            },
            "name": {
              "$ref": "#/$defs/__schema1"
            },
            "sport": {
              "$ref": "#/$defs/__schema0"
            },
            "description": {
              "$ref": "#/$defs/__schema1"
            },
            "scheduled": {
              "$ref": "#/$defs/__schema19"
            },
            "structure": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "steps"
                    },
                    "steps": {
                      "minItems": 1,
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/__schema37"
                      }
                    }
                  },
                  "required": [
                    "kind",
                    "steps"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "timeline"
                    },
                    "durationSeconds": {
                      "type": "number",
                      "exclusiveMinimum": 0,
                      "maximum": 31536000
                    },
                    "segments": {
                      "minItems": 1,
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/__schema42"
                      }
                    },
                    "cues": {
                      "maxItems": 2000,
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/__schema43"
                      }
                    }
                  },
                  "required": [
                    "kind",
                    "durationSeconds",
                    "segments"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "id",
            "version",
            "kind",
            "name",
            "sport",
            "structure"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "training.workout"
            },
            "sport": {
              "$ref": "#/$defs/__schema0"
            },
            "name": {
              "$ref": "#/$defs/__schema1"
            },
            "interval": {
              "$ref": "#/$defs/__schema22"
            },
            "movingSeconds": {
              "type": "number",
              "minimum": 0
            },
            "routine": {
              "$ref": "#/$defs/__schema4"
            },
            "status": {
              "type": "string",
              "enum": [
                "completed",
                "partial",
                "aborted"
              ]
            },
            "metrics": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema27"
              }
            },
            "steps": {
              "maxItems": 1000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema44"
              }
            },
            "sessionRpe": {
              "type": "number",
              "minimum": 0,
              "maximum": 10
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "sport",
            "interval"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "training.threshold"
            },
            "metric": {
              "$ref": "#/$defs/__schema0"
            },
            "quantity": {
              "$ref": "#/$defs/__schema41"
            },
            "effectiveAt": {
              "$ref": "#/$defs/__schema9"
            },
            "method": {
              "type": "string",
              "enum": [
                "tested",
                "estimated"
              ]
            },
            "basis": {
              "$ref": "#/$defs/__schema0"
            },
            "exercise": {
              "$ref": "#/$defs/__schema38"
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "metric",
            "quantity",
            "effectiveAt",
            "method"
          ],
          "additionalProperties": false
        },
        {
          "$ref": "#/$defs/__schema45"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema0"
            },
            "version": {
              "$ref": "#/$defs/__schema1"
            },
            "subject": {
              "$ref": "#/$defs/__schema32"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema33"
            },
            "provenance": {
              "$ref": "#/$defs/__schema34"
            },
            "links": {
              "$ref": "#/$defs/__schema35"
            },
            "extensions": {
              "$ref": "#/$defs/__schema36"
            },
            "kind": {
              "type": "string",
              "const": "nutrition.nutrient"
            },
            "schemaVersion": {
              "type": "string",
              "const": "0.0.0-local"
            },
            "names": {
              "$ref": "#/$defs/__schema46"
            },
            "definition": {
              "$ref": "#/$defs/__schema1"
            },
            "quantityKind": {
              "type": "string",
              "enum": [
                "mass",
                "energy",
                "activity",
                "fraction",
                "other"
              ]
            },
            "preferredUnit": {
              "$ref": "#/$defs/__schema1"
            },
            "externalCodes": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema48"
              }
            }
          },
          "required": [
            "id",
            "version",
            "kind",
            "names",
            "definition",
            "quantityKind",
            "preferredUnit",
            "externalCodes"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "nutrition.intake"
            },
            "schemaVersion": {
              "type": "string",
              "const": "0.0.0-local"
            },
            "time": {
              "$ref": "#/$defs/__schema19"
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            },
            "meal": {
              "$ref": "#/$defs/__schema0"
            },
            "intake": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "food"
                    },
                    "snapshot": {
                      "$ref": "#/$defs/__schema45"
                    },
                    "compositionId": {
                      "$ref": "#/$defs/__schema1"
                    },
                    "consumed": {
                      "$ref": "#/$defs/__schema55"
                    },
                    "nutrition": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "calculated"
                            },
                            "method": {
                              "type": "string",
                              "const": "fitdata:food_scaling@1"
                            },
                            "resolvedAmount": {
                              "$ref": "#/$defs/__schema55"
                            },
                            "totals": {
                              "$ref": "#/$defs/__schema56"
                            }
                          },
                          "required": [
                            "kind",
                            "method",
                            "resolvedAmount",
                            "totals"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "reported"
                            },
                            "totals": {
                              "$ref": "#/$defs/__schema56"
                            },
                            "source": {
                              "$ref": "#/$defs/__schema30"
                            }
                          },
                          "required": [
                            "kind",
                            "totals",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "unavailable"
                            },
                            "reason": {
                              "$ref": "#/$defs/__schema0"
                            }
                          },
                          "required": [
                            "kind",
                            "reason"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "snapshot",
                    "compositionId",
                    "consumed",
                    "nutrition"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "nutrients"
                    },
                    "name": {
                      "$ref": "#/$defs/__schema1"
                    },
                    "totals": {
                      "$ref": "#/$defs/__schema56"
                    }
                  },
                  "required": [
                    "kind",
                    "name",
                    "totals"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "capture": {
              "type": "object",
              "properties": {
                "method": {
                  "$ref": "#/$defs/__schema0"
                },
                "evidence": {
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema30"
                  }
                },
                "algorithm": {
                  "$ref": "#/$defs/__schema13"
                },
                "review": {
                  "type": "string",
                  "enum": [
                    "unreviewed",
                    "confirmed",
                    "corrected"
                  ]
                }
              },
              "required": [
                "method",
                "evidence",
                "review"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "time",
            "intake"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "nutrition.meal"
            },
            "schemaVersion": {
              "type": "string",
              "const": "0.0.0-local"
            },
            "time": {
              "$ref": "#/$defs/__schema19"
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            },
            "name": {
              "$ref": "#/$defs/__schema1"
            },
            "category": {
              "$ref": "#/$defs/__schema48"
            },
            "entries": {
              "minItems": 1,
              "maxItems": 1000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema3"
              }
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "time",
            "name",
            "entries"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "kind": {
              "type": "string",
              "const": "nutrition.goal"
            },
            "schemaVersion": {
              "type": "string",
              "const": "0.0.0-local"
            },
            "effectiveDate": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "timezone": {
              "$ref": "#/$defs/__schema1"
            },
            "targets": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema27"
              }
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "effectiveDate",
            "targets"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema0"
            },
            "version": {
              "$ref": "#/$defs/__schema1"
            },
            "subject": {
              "$ref": "#/$defs/__schema32"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema33"
            },
            "provenance": {
              "$ref": "#/$defs/__schema34"
            },
            "links": {
              "$ref": "#/$defs/__schema35"
            },
            "extensions": {
              "$ref": "#/$defs/__schema36"
            },
            "schemaVersion": {
              "$ref": "#/$defs/__schema58"
            },
            "names": {
              "$ref": "#/$defs/__schema59"
            },
            "aliases": {
              "$ref": "#/$defs/__schema60"
            },
            "kind": {
              "type": "string",
              "const": "lab.biomarker"
            },
            "description": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "id",
            "version",
            "names",
            "aliases",
            "kind",
            "description"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema0"
            },
            "version": {
              "$ref": "#/$defs/__schema1"
            },
            "subject": {
              "$ref": "#/$defs/__schema32"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema33"
            },
            "provenance": {
              "$ref": "#/$defs/__schema34"
            },
            "links": {
              "$ref": "#/$defs/__schema35"
            },
            "extensions": {
              "$ref": "#/$defs/__schema36"
            },
            "schemaVersion": {
              "$ref": "#/$defs/__schema58"
            },
            "names": {
              "$ref": "#/$defs/__schema59"
            },
            "aliases": {
              "$ref": "#/$defs/__schema60"
            },
            "kind": {
              "type": "string",
              "const": "lab.test"
            },
            "biomarker": {
              "$ref": "#/$defs/__schema4"
            },
            "measurement": {
              "type": "object",
              "properties": {
                "property": {
                  "$ref": "#/$defs/__schema0"
                },
                "specimens": {
                  "minItems": 1,
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema48"
                  }
                },
                "timing": {
                  "$ref": "#/$defs/__schema0"
                },
                "scale": {
                  "type": "string",
                  "enum": [
                    "quantitative",
                    "ordinal",
                    "nominal",
                    "narrative"
                  ]
                },
                "method": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "unspecified"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "specified"
                        },
                        "code": {
                          "$ref": "#/$defs/__schema0"
                        }
                      },
                      "required": [
                        "kind",
                        "code"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "property",
                "specimens",
                "timing",
                "scale",
                "method"
              ],
              "additionalProperties": false
            },
            "resultKinds": {
              "minItems": 1,
              "maxItems": 3,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema61"
              }
            },
            "supportedUnits": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema1"
              }
            },
            "preferredUnit": {
              "$ref": "#/$defs/__schema1"
            },
            "externalMappings": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema62"
              }
            }
          },
          "required": [
            "id",
            "version",
            "names",
            "aliases",
            "kind",
            "biomarker",
            "measurement",
            "resultKinds",
            "supportedUnits",
            "externalMappings"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "schemaVersion": {
              "$ref": "#/$defs/__schema64"
            },
            "source": {
              "$ref": "#/$defs/__schema65"
            },
            "kind": {
              "type": "string",
              "const": "lab.specimen"
            },
            "type": {
              "$ref": "#/$defs/__schema48"
            },
            "collected": {
              "$ref": "#/$defs/__schema19"
            },
            "collectionMethod": {
              "$ref": "#/$defs/__schema48"
            },
            "bodySite": {
              "$ref": "#/$defs/__schema48"
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "type",
            "collected"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "schemaVersion": {
              "$ref": "#/$defs/__schema64"
            },
            "source": {
              "$ref": "#/$defs/__schema65"
            },
            "kind": {
              "type": "string",
              "const": "lab.result"
            },
            "test": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "identified"
                    },
                    "definition": {
                      "$ref": "#/$defs/__schema4"
                    }
                  },
                  "required": [
                    "kind",
                    "definition"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "unresolved"
                    },
                    "label": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "required": [
                    "kind",
                    "label"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "collected": {
              "$ref": "#/$defs/__schema19"
            },
            "specimen": {
              "$ref": "#/$defs/__schema3"
            },
            "status": {
              "type": "string",
              "enum": [
                "preliminary",
                "final",
                "corrected",
                "amended",
                "cancelled",
                "entered_in_error"
              ]
            },
            "review": {
              "type": "string",
              "enum": [
                "unreviewed",
                "accepted",
                "excluded"
              ]
            },
            "raw": {
              "type": "object",
              "properties": {
                "label": {
                  "$ref": "#/$defs/__schema1"
                },
                "value": {
                  "type": "string",
                  "maxLength": 512
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                },
                "reference": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "label",
                "value"
              ],
              "additionalProperties": false
            },
            "value": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "quantity"
                    },
                    "comparator": {
                      "$ref": "#/$defs/__schema29"
                    },
                    "value": {
                      "$ref": "#/$defs/__schema21"
                    },
                    "unit": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "required": [
                    "kind",
                    "comparator",
                    "value",
                    "unit"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "category"
                    },
                    "coding": {
                      "$ref": "#/$defs/__schema48"
                    }
                  },
                  "required": [
                    "kind",
                    "coding"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "$ref": "#/$defs/__schema1"
                    }
                  },
                  "required": [
                    "kind",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "absent"
                    },
                    "reason": {
                      "$ref": "#/$defs/__schema0"
                    }
                  },
                  "required": [
                    "kind",
                    "reason"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "referenceRanges": {
              "maxItems": 100,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema66"
              }
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "test",
            "collected",
            "status",
            "review",
            "raw",
            "value",
            "referenceRanges"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/__schema1"
            },
            "revision": {
              "$ref": "#/$defs/__schema6"
            },
            "subject": {
              "$ref": "#/$defs/__schema7"
            },
            "recordedAt": {
              "$ref": "#/$defs/__schema8"
            },
            "provenance": {
              "$ref": "#/$defs/__schema10"
            },
            "links": {
              "$ref": "#/$defs/__schema14"
            },
            "extensions": {
              "$ref": "#/$defs/__schema16"
            },
            "schemaVersion": {
              "$ref": "#/$defs/__schema64"
            },
            "source": {
              "$ref": "#/$defs/__schema65"
            },
            "kind": {
              "type": "string",
              "const": "lab.report"
            },
            "laboratory": {
              "type": "object",
              "properties": {
                "id": {
                  "$ref": "#/$defs/__schema1"
                },
                "name": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "id"
              ],
              "additionalProperties": false
            },
            "issued": {
              "$ref": "#/$defs/__schema19"
            },
            "received": {
              "$ref": "#/$defs/__schema19"
            },
            "status": {
              "type": "string",
              "enum": [
                "preliminary",
                "final",
                "corrected",
                "amended",
                "cancelled",
                "entered_in_error"
              ]
            },
            "results": {
              "maxItems": 10000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema3"
              }
            },
            "specimens": {
              "maxItems": 1000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema3"
              }
            },
            "panels": {
              "maxItems": 1000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema70"
              }
            }
          },
          "required": [
            "id",
            "revision",
            "kind",
            "status",
            "results",
            "specimens"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema6": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "__schema7": {
      "$ref": "#/$defs/__schema1"
    },
    "__schema8": {
      "$ref": "#/$defs/__schema9"
    },
    "__schema9": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "__schema10": {
      "$ref": "#/$defs/__schema11"
    },
    "__schema11": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "manual"
            },
            "source": {
              "$ref": "#/$defs/__schema12"
            }
          },
          "required": [
            "kind",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "sensor"
            },
            "source": {
              "$ref": "#/$defs/__schema12"
            }
          },
          "required": [
            "kind",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "imported"
            },
            "source": {
              "$ref": "#/$defs/__schema12"
            },
            "mapper": {
              "$ref": "#/$defs/__schema13"
            }
          },
          "required": [
            "kind",
            "source",
            "mapper"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "derived"
            },
            "source": {
              "$ref": "#/$defs/__schema12"
            },
            "algorithm": {
              "$ref": "#/$defs/__schema13"
            },
            "inputs": {
              "minItems": 1,
              "maxItems": 1000,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema3"
              }
            }
          },
          "required": [
            "kind",
            "source",
            "algorithm",
            "inputs"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema12": {
      "type": "object",
      "properties": {
        "provider": {
          "$ref": "#/$defs/__schema1"
        },
        "externalId": {
          "$ref": "#/$defs/__schema1"
        },
        "device": {
          "$ref": "#/$defs/__schema1"
        },
        "originalSource": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "provider"
      ],
      "additionalProperties": false
    },
    "__schema13": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema0"
        },
        "version": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "id",
        "version"
      ],
      "additionalProperties": false
    },
    "__schema14": {
      "maxItems": 1000,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema15"
      }
    },
    "__schema15": {
      "type": "object",
      "properties": {
        "relation": {
          "type": "string",
          "enum": [
            "part_of",
            "same_activity_as",
            "derived_from"
          ]
        },
        "target": {
          "$ref": "#/$defs/__schema3"
        }
      },
      "required": [
        "relation",
        "target"
      ],
      "additionalProperties": false
    },
    "__schema16": {
      "$ref": "#/$defs/__schema17"
    },
    "__schema17": {
      "type": "object",
      "propertyNames": {
        "$ref": "#/$defs/__schema0"
      },
      "additionalProperties": {
        "$ref": "#/$defs/__schema18"
      }
    },
    "__schema18": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema18"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema18"
          }
        }
      ]
    },
    "__schema19": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "instant"
            },
            "at": {
              "$ref": "#/$defs/__schema9"
            }
          },
          "required": [
            "kind",
            "at"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "interval"
            },
            "start": {
              "$ref": "#/$defs/__schema9"
            },
            "durationSeconds": {
              "$ref": "#/$defs/__schema20"
            }
          },
          "required": [
            "kind",
            "start",
            "durationSeconds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "date"
            },
            "date": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "timezone": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "kind",
            "date"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema20": {
      "type": "number",
      "minimum": 0,
      "maximum": 31536000
    },
    "__schema21": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "maxLength": 100,
          "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$"
        }
      ]
    },
    "__schema22": {
      "type": "object",
      "properties": {
        "start": {
          "$ref": "#/$defs/__schema9"
        },
        "durationSeconds": {
          "$ref": "#/$defs/__schema20"
        }
      },
      "required": [
        "start",
        "durationSeconds"
      ],
      "additionalProperties": false
    },
    "__schema23": {
      "type": "object",
      "properties": {
        "metric": {
          "$ref": "#/$defs/__schema0"
        },
        "unit": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "metric",
        "unit"
      ],
      "additionalProperties": false
    },
    "__schema24": {
      "type": "number",
      "minimum": 0
    },
    "__schema25": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema26"
      }
    },
    "__schema26": {
      "type": [
        "number",
        "null"
      ]
    },
    "__schema27": {
      "type": "object",
      "properties": {
        "metric": {
          "$ref": "#/$defs/__schema0"
        },
        "value": {
          "$ref": "#/$defs/__schema21"
        },
        "unit": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "metric",
        "value",
        "unit"
      ],
      "additionalProperties": false
    },
    "__schema28": {
      "type": "object",
      "properties": {
        "definition": {
          "$ref": "#/$defs/__schema4"
        },
        "value": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "quantity"
                },
                "comparator": {
                  "$ref": "#/$defs/__schema29"
                },
                "value": {
                  "$ref": "#/$defs/__schema21"
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "kind",
                "comparator",
                "value",
                "unit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "absent"
                },
                "reason": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              "required": [
                "kind",
                "reason"
              ],
              "additionalProperties": false
            }
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "analytical",
            "label",
            "calculated",
            "estimated",
            "imported",
            "unknown"
          ]
        },
        "source": {
          "$ref": "#/$defs/__schema30"
        }
      },
      "required": [
        "definition",
        "value",
        "method"
      ],
      "additionalProperties": false
    },
    "__schema29": {
      "type": "string",
      "enum": [
        "=",
        "<",
        "<=",
        ">",
        ">="
      ]
    },
    "__schema30": {
      "type": "object",
      "properties": {
        "system": {
          "$ref": "#/$defs/__schema1"
        },
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "version": {
          "$ref": "#/$defs/__schema1"
        },
        "retrievedAt": {
          "$ref": "#/$defs/__schema9"
        }
      },
      "required": [
        "system",
        "id"
      ],
      "additionalProperties": false
    },
    "__schema31": {
      "type": "object",
      "properties": {
        "stage": {
          "$ref": "#/$defs/__schema0"
        },
        "offsetSeconds": {
          "type": "number",
          "minimum": 0
        },
        "durationSeconds": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "required": [
        "stage",
        "offsetSeconds",
        "durationSeconds"
      ],
      "additionalProperties": false
    },
    "__schema32": {
      "$ref": "#/$defs/__schema1"
    },
    "__schema33": {
      "$ref": "#/$defs/__schema9"
    },
    "__schema34": {
      "$ref": "#/$defs/__schema11"
    },
    "__schema35": {
      "maxItems": 1000,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema15"
      }
    },
    "__schema36": {
      "$ref": "#/$defs/__schema17"
    },
    "__schema37": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "exercise": {
          "$ref": "#/$defs/__schema38"
        },
        "role": {
          "$ref": "#/$defs/__schema0"
        },
        "targets": {
          "minItems": 1,
          "maxItems": 20,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema39"
          }
        },
        "load": {
          "$ref": "#/$defs/__schema40"
        },
        "restSeconds": {
          "type": "number",
          "minimum": 0
        },
        "side": {
          "type": "string",
          "enum": [
            "left",
            "right",
            "bilateral"
          ]
        }
      },
      "required": [
        "id",
        "exercise",
        "targets"
      ],
      "additionalProperties": false
    },
    "__schema38": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema0"
        },
        "name": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "__schema39": {
      "type": "object",
      "properties": {
        "metric": {
          "$ref": "#/$defs/__schema0"
        },
        "target": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "exact"
                },
                "value": {
                  "$ref": "#/$defs/__schema21"
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "kind",
                "value",
                "unit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "range"
                },
                "min": {
                  "$ref": "#/$defs/__schema21"
                },
                "max": {
                  "$ref": "#/$defs/__schema21"
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "kind",
                "min",
                "max",
                "unit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "relative"
                },
                "fraction": {
                  "type": "number",
                  "minimum": 0
                },
                "basis": {
                  "$ref": "#/$defs/__schema0"
                },
                "threshold": {
                  "$ref": "#/$defs/__schema3"
                }
              },
              "required": [
                "kind",
                "fraction"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "ramp"
                },
                "start": {
                  "$ref": "#/$defs/__schema21"
                },
                "end": {
                  "$ref": "#/$defs/__schema21"
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                },
                "basis": {
                  "$ref": "#/$defs/__schema0"
                },
                "threshold": {
                  "$ref": "#/$defs/__schema3"
                },
                "interpolation": {
                  "type": "string",
                  "enum": [
                    "linear",
                    "step"
                  ]
                }
              },
              "required": [
                "kind",
                "start",
                "end",
                "unit"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "metric",
        "target"
      ],
      "additionalProperties": false
    },
    "__schema40": {
      "type": "object",
      "properties": {
        "basis": {
          "type": "string",
          "enum": [
            "external_total",
            "external_per_hand",
            "added",
            "assisted",
            "bodyweight_fraction"
          ]
        },
        "amount": {
          "$ref": "#/$defs/__schema41"
        }
      },
      "required": [
        "basis",
        "amount"
      ],
      "additionalProperties": false
    },
    "__schema41": {
      "type": "object",
      "properties": {
        "value": {
          "$ref": "#/$defs/__schema21"
        },
        "unit": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "value",
        "unit"
      ],
      "additionalProperties": false
    },
    "__schema42": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "startSeconds": {
          "type": "number",
          "minimum": 0
        },
        "endSeconds": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "label": {
          "$ref": "#/$defs/__schema1"
        },
        "role": {
          "$ref": "#/$defs/__schema0"
        },
        "targets": {
          "minItems": 1,
          "maxItems": 20,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema39"
          }
        }
      },
      "required": [
        "id",
        "startSeconds",
        "endSeconds",
        "targets"
      ],
      "additionalProperties": false
    },
    "__schema43": {
      "type": "object",
      "properties": {
        "atSeconds": {
          "type": "number",
          "minimum": 0
        },
        "posture": {
          "$ref": "#/$defs/__schema1"
        },
        "resistance": {
          "$ref": "#/$defs/__schema1"
        },
        "text": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "atSeconds"
      ],
      "additionalProperties": false
    },
    "__schema44": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "exercise": {
          "$ref": "#/$defs/__schema38"
        },
        "plannedStepId": {
          "$ref": "#/$defs/__schema1"
        },
        "role": {
          "$ref": "#/$defs/__schema0"
        },
        "side": {
          "type": "string",
          "enum": [
            "left",
            "right",
            "bilateral"
          ]
        },
        "result": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "completed",
                    "partial"
                  ]
                },
                "metrics": {
                  "minItems": 1,
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/__schema27"
                  }
                },
                "load": {
                  "$ref": "#/$defs/__schema40"
                },
                "rpe": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 10
                }
              },
              "required": [
                "kind",
                "metrics"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "skipped"
                },
                "reason": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "kind",
                "reason"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "id",
        "exercise",
        "result"
      ],
      "additionalProperties": false
    },
    "__schema45": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema0"
        },
        "version": {
          "$ref": "#/$defs/__schema1"
        },
        "subject": {
          "$ref": "#/$defs/__schema32"
        },
        "recordedAt": {
          "$ref": "#/$defs/__schema33"
        },
        "provenance": {
          "$ref": "#/$defs/__schema34"
        },
        "links": {
          "$ref": "#/$defs/__schema35"
        },
        "extensions": {
          "$ref": "#/$defs/__schema36"
        },
        "kind": {
          "type": "string",
          "const": "nutrition.food"
        },
        "schemaVersion": {
          "type": "string",
          "const": "0.0.0-local"
        },
        "names": {
          "$ref": "#/$defs/__schema46"
        },
        "foodType": {
          "type": "string",
          "enum": [
            "generic",
            "branded",
            "restaurant",
            "prepared_dish",
            "custom"
          ]
        },
        "brand": {
          "$ref": "#/$defs/__schema1"
        },
        "derivedFrom": {
          "$ref": "#/$defs/__schema4"
        },
        "identifiers": {
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema48"
          }
        },
        "sources": {
          "minItems": 1,
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema30"
          }
        },
        "servings": {
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema50"
          }
        },
        "compositions": {
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema54"
          }
        }
      },
      "required": [
        "id",
        "version",
        "kind",
        "names",
        "foodType",
        "identifiers",
        "sources",
        "servings",
        "compositions"
      ],
      "additionalProperties": false
    },
    "__schema46": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema47"
      }
    },
    "__schema47": {
      "type": "object",
      "properties": {
        "language": {
          "type": "string",
          "minLength": 2,
          "maxLength": 35
        },
        "text": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "language",
        "text"
      ],
      "additionalProperties": false
    },
    "__schema48": {
      "type": "object",
      "properties": {
        "system": {
          "$ref": "#/$defs/__schema1"
        },
        "code": {
          "$ref": "#/$defs/__schema1"
        },
        "version": {
          "$ref": "#/$defs/__schema49"
        },
        "display": {
          "$ref": "#/$defs/__schema1"
        }
      },
      "required": [
        "system",
        "code"
      ],
      "additionalProperties": false
    },
    "__schema49": {
      "$ref": "#/$defs/__schema1"
    },
    "__schema50": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "names": {
          "$ref": "#/$defs/__schema46"
        },
        "amount": {
          "$ref": "#/$defs/__schema51"
        },
        "compositionIds": {
          "minItems": 1,
          "maxItems": 100,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema1"
          }
        },
        "equivalent": {
          "oneOf": [
            {
              "$ref": "#/$defs/__schema52"
            },
            {
              "$ref": "#/$defs/__schema53"
            }
          ]
        }
      },
      "required": [
        "id",
        "names",
        "amount",
        "compositionIds"
      ],
      "additionalProperties": false
    },
    "__schema51": {
      "type": "number",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "__schema52": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "mass"
        },
        "amount": {
          "$ref": "#/$defs/__schema51"
        },
        "unit": {
          "type": "string",
          "enum": [
            "kg",
            "g",
            "mg",
            "ug",
            "[lb_av]",
            "[oz_av]"
          ]
        }
      },
      "required": [
        "kind",
        "amount",
        "unit"
      ],
      "additionalProperties": false
    },
    "__schema53": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "volume"
        },
        "amount": {
          "$ref": "#/$defs/__schema51"
        },
        "unit": {
          "type": "string",
          "enum": [
            "L",
            "mL",
            "[foz_us]",
            "[cup_us]",
            "[tbs_us]",
            "[tsp_us]",
            "[foz_br]",
            "[cup_m]",
            "[tbs_m]",
            "[tsp_m]"
          ]
        }
      },
      "required": [
        "kind",
        "amount",
        "unit"
      ],
      "additionalProperties": false
    },
    "__schema54": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "state": {
          "type": "string",
          "enum": [
            "raw",
            "cooked",
            "as_sold",
            "prepared",
            "unknown"
          ]
        },
        "basis": {
          "$ref": "#/$defs/__schema55"
        },
        "nutrients": {
          "$ref": "#/$defs/__schema56"
        },
        "massVolumeEquivalent": {
          "type": "object",
          "properties": {
            "mass": {
              "$ref": "#/$defs/__schema52"
            },
            "volume": {
              "$ref": "#/$defs/__schema53"
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            }
          },
          "required": [
            "mass",
            "volume",
            "source"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "id",
        "state",
        "basis",
        "nutrients"
      ],
      "additionalProperties": false
    },
    "__schema55": {
      "oneOf": [
        {
          "$ref": "#/$defs/__schema52"
        },
        {
          "$ref": "#/$defs/__schema53"
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "serving"
            },
            "amount": {
              "$ref": "#/$defs/__schema51"
            },
            "servingId": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "kind",
            "amount",
            "servingId"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema56": {
      "maxItems": 500,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema57"
      }
    },
    "__schema57": {
      "type": "object",
      "properties": {
        "nutrient": {
          "$ref": "#/$defs/__schema4"
        },
        "value": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "quantity"
                },
                "comparator": {
                  "$ref": "#/$defs/__schema29"
                },
                "value": {
                  "$ref": "#/$defs/__schema21"
                },
                "unit": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              "required": [
                "kind",
                "comparator",
                "value",
                "unit"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "absent"
                },
                "reason": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              "required": [
                "kind",
                "reason"
              ],
              "additionalProperties": false
            }
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "analytical",
            "label",
            "calculated",
            "estimated",
            "imported",
            "unknown"
          ]
        },
        "source": {
          "$ref": "#/$defs/__schema30"
        }
      },
      "required": [
        "nutrient",
        "value",
        "method"
      ],
      "additionalProperties": false
    },
    "__schema58": {
      "type": "string",
      "const": "0.0.0-local"
    },
    "__schema59": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema47"
      }
    },
    "__schema60": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema47"
      }
    },
    "__schema61": {
      "type": "string",
      "enum": [
        "quantity",
        "category",
        "text"
      ]
    },
    "__schema62": {
      "type": "object",
      "properties": {
        "coding": {
          "type": "object",
          "properties": {
            "system": {
              "$ref": "#/$defs/__schema1"
            },
            "code": {
              "$ref": "#/$defs/__schema1"
            },
            "version": {
              "$ref": "#/$defs/__schema49"
            },
            "display": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "system",
            "code",
            "display"
          ],
          "additionalProperties": false
        },
        "relationship": {
          "type": "string",
          "enum": [
            "equivalent",
            "broader",
            "narrower",
            "related"
          ]
        },
        "review": {
          "type": "object",
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "source_verified",
                "unreviewed"
              ]
            },
            "checkedAt": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            },
            "sources": {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "$ref": "#/$defs/__schema63"
              }
            }
          },
          "required": [
            "status",
            "checkedAt",
            "sources"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "coding",
        "relationship",
        "review"
      ],
      "additionalProperties": false
    },
    "__schema63": {
      "type": "string",
      "format": "uri"
    },
    "__schema64": {
      "type": "string",
      "const": "0.0.0-local"
    },
    "__schema65": {
      "$ref": "#/$defs/__schema30"
    },
    "__schema66": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "numeric"
            },
            "purpose": {
              "$ref": "#/$defs/__schema67"
            },
            "sourceKind": {
              "$ref": "#/$defs/__schema68"
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            },
            "applicability": {
              "$ref": "#/$defs/__schema69"
            },
            "low": {
              "$ref": "#/$defs/__schema21"
            },
            "high": {
              "$ref": "#/$defs/__schema21"
            },
            "lowInclusive": {
              "type": "boolean"
            },
            "highInclusive": {
              "type": "boolean"
            },
            "unit": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "kind",
            "purpose",
            "sourceKind",
            "source",
            "unit"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "text"
            },
            "purpose": {
              "$ref": "#/$defs/__schema67"
            },
            "sourceKind": {
              "$ref": "#/$defs/__schema68"
            },
            "source": {
              "$ref": "#/$defs/__schema30"
            },
            "applicability": {
              "$ref": "#/$defs/__schema69"
            },
            "text": {
              "$ref": "#/$defs/__schema1"
            }
          },
          "required": [
            "kind",
            "purpose",
            "sourceKind",
            "source",
            "text"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema67": {
      "type": "string",
      "enum": [
        "reference",
        "decision_limit",
        "target"
      ]
    },
    "__schema68": {
      "type": "string",
      "enum": [
        "laboratory",
        "external"
      ]
    },
    "__schema69": {
      "$ref": "#/$defs/__schema1"
    },
    "__schema70": {
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/__schema1"
        },
        "name": {
          "$ref": "#/$defs/__schema1"
        },
        "results": {
          "maxItems": 10000,
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema3"
          }
        }
      },
      "required": [
        "id",
        "name",
        "results"
      ],
      "additionalProperties": false
    }
  },
  "title": "FitData draft document",
  "description": "Structural schema. Also run FitData semantic and graph validation; see docs/m1/model.md."
}
