{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fulcradynamics-com/json-schema/fulcradynamics-com-annotation-row-schema.json",
  "title": "AnnotationRow",
  "description": "Represents a db record of a user's annotation",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fulcradynamics-com-openapi.json#/components/schemas/AnnotationRow",
  "properties": {
    "annotation_type": {
      "$ref": "#/$defs/AnnotationType",
      "description": "Annotation type"
    },
    "created_at": {
      "format": "date-time",
      "title": "Created At",
      "type": "string"
    },
    "deleted_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Deleted At"
    },
    "description": {
      "description": "Description",
      "title": "Description",
      "type": "string"
    },
    "fulcra_source_id": {
      "readOnly": true,
      "title": "Fulcra Source Id",
      "type": "string"
    },
    "fulcra_userid": {
      "format": "uuid",
      "title": "Fulcra Userid",
      "type": "string"
    },
    "id": {
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "measurement_spec": {
      "anyOf": [
        {
          "oneOf": [
            {
              "$ref": "#/$defs/BooleanMeasurement"
            },
            {
              "$ref": "#/$defs/CountMeasurement"
            },
            {
              "$ref": "#/$defs/CustomMeasurement"
            },
            {
              "$ref": "#/$defs/DistanceMeasurement"
            },
            {
              "$ref": "#/$defs/DurationMeasurement"
            },
            {
              "$ref": "#/$defs/MassMeasurement"
            },
            {
              "$ref": "#/$defs/PercentMeasurement"
            },
            {
              "$ref": "#/$defs/PeriodMeasurement"
            },
            {
              "$ref": "#/$defs/ScaleMeasurement"
            },
            {
              "$ref": "#/$defs/TemperatureMeasurement"
            },
            {
              "$ref": "#/$defs/VolumeMeasurement"
            }
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Measurement spec",
      "title": "Measurement Spec"
    },
    "name": {
      "description": "Name",
      "title": "Name",
      "type": "string"
    },
    "spec": {
      "anyOf": [
        {
          "$ref": "#/$defs/ScaleAnnotationSpecContainer-Output"
        },
        {
          "$ref": "#/$defs/AnnotationSpecContainer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Type-specific spec",
      "title": "Spec"
    },
    "tags": {
      "description": "Default tags",
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "title": "Tags",
      "type": "array"
    },
    "updated_at": {
      "format": "date-time",
      "title": "Updated At",
      "type": "string"
    }
  },
  "required": [
    "name",
    "description",
    "annotation_type",
    "tags",
    "fulcra_userid",
    "id",
    "created_at",
    "updated_at",
    "fulcra_source_id"
  ],
  "type": "object",
  "$defs": {
    "AnnotationSpecContainer": {
      "properties": {
        "default_note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default note text, if any",
          "title": "Default Note"
        }
      },
      "title": "AnnotationSpecContainer",
      "type": "object"
    },
    "AnnotationType": {
      "description": "Represents the base type of an annotation",
      "enum": [
        "duration",
        "moment",
        "numeric",
        "people",
        "scale",
        "boolean"
      ],
      "title": "AnnotationType",
      "type": "string"
    },
    "BooleanMeasurement": {
      "description": "Represents a yes or no measurement configuration",
      "properties": {
        "boolean": {
          "$ref": "#/$defs/BooleanMeasurementSpec"
        },
        "measurement_type": {
          "const": "boolean",
          "default": "boolean",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "title": "Unit",
          "type": "null"
        },
        "value_type": {
          "const": "boolean",
          "default": "boolean",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "boolean"
      ],
      "title": "BooleanMeasurement",
      "type": "object"
    },
    "BooleanMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "BooleanMeasurementSpec",
      "type": "object"
    },
    "ColorScaleMapping-Output": {
      "description": "Represents a scale mapping to colorrs",
      "properties": {
        "color": {
          "$ref": "#/$defs/ColorScaleMappingSpec-Output"
        },
        "mapping_type": {
          "const": "color",
          "default": "color",
          "title": "Mapping Type",
          "type": "string"
        }
      },
      "required": [
        "color"
      ],
      "title": "ColorScaleMapping",
      "type": "object"
    },
    "ColorScaleMappingSpec-Output": {
      "properties": {
        "mapping": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Mapping of scale values to colors, normalized to hex format",
          "title": "Mapping",
          "type": "object"
        }
      },
      "required": [
        "mapping"
      ],
      "title": "ColorScaleMappingSpec",
      "type": "object"
    },
    "CountMeasurement": {
      "description": "Represents a count measurement configuration",
      "properties": {
        "count": {
          "$ref": "#/$defs/CountMeasurementSpec"
        },
        "measurement_type": {
          "const": "count",
          "default": "count",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "title": "Unit",
          "type": "null"
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "count"
      ],
      "title": "CountMeasurement",
      "type": "object"
    },
    "CountMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "CountMeasurementSpec",
      "type": "object"
    },
    "CustomMeasurement": {
      "description": "Represents a custom non-convertable measurement configuration",
      "properties": {
        "custom": {
          "$ref": "#/$defs/CustomMeasurementSpec"
        },
        "measurement_type": {
          "const": "custom",
          "default": "custom",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit"
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "custom"
      ],
      "title": "CustomMeasurement",
      "type": "object"
    },
    "CustomMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "CustomMeasurementSpec",
      "type": "object"
    },
    "DistanceMeasurement": {
      "description": "Represents a distance or length measurement configuration",
      "properties": {
        "distance": {
          "$ref": "#/$defs/DistanceMeasurementSpec"
        },
        "measurement_type": {
          "const": "distance",
          "default": "distance",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/DistanceUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "distance"
      ],
      "title": "DistanceMeasurement",
      "type": "object"
    },
    "DistanceMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "DistanceMeasurementSpec",
      "type": "object"
    },
    "DistanceUnit": {
      "enum": [
        "inch",
        "foot",
        "yard",
        "mile",
        "millimeter",
        "centimeter",
        "meter",
        "kilometer"
      ],
      "title": "DistanceUnit",
      "type": "string"
    },
    "DurationMeasurement": {
      "description": "Represents a time duration measurement configuration",
      "properties": {
        "measurement_type": {
          "const": "duration",
          "default": "duration",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "title": "Unit",
          "type": "null"
        },
        "value_type": {
          "const": "duration",
          "default": "duration",
          "title": "Value Type",
          "type": "string"
        }
      },
      "title": "DurationMeasurement",
      "type": "object"
    },
    "EmojiScaleMapping-Output": {
      "description": "Represents a scale mapping to colorrs",
      "properties": {
        "color": {
          "$ref": "#/$defs/ColorScaleMappingSpec-Output"
        },
        "mapping_type": {
          "const": "emoji",
          "default": "emoji",
          "title": "Mapping Type",
          "type": "string"
        },
        "string": {
          "$ref": "#/$defs/StringScaleMappingSpec"
        }
      },
      "required": [
        "color",
        "string"
      ],
      "title": "EmojiScaleMapping",
      "type": "object"
    },
    "MassMeasurement": {
      "description": "Represents a mass measurement configuration and may be inferred from weight",
      "properties": {
        "mass": {
          "$ref": "#/$defs/MassMeasurementSpec"
        },
        "measurement_type": {
          "const": "mass",
          "default": "mass",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/MassUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "mass"
      ],
      "title": "MassMeasurement",
      "type": "object"
    },
    "MassMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "MassMeasurementSpec",
      "type": "object"
    },
    "MassUnit": {
      "enum": [
        "ounce",
        "pound",
        "microgram",
        "milligram",
        "gram",
        "kilogram",
        "stone"
      ],
      "title": "MassUnit",
      "type": "string"
    },
    "MetricKind": {
      "enum": [
        "cumulative",
        "discrete"
      ],
      "title": "MetricKind",
      "type": "string"
    },
    "PercentMeasurement": {
      "description": "Represents a percentage measurement configuration",
      "properties": {
        "measurement_type": {
          "const": "percent",
          "default": "percent",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "percent": {
          "$ref": "#/$defs/PercentMeasurementSpec"
        },
        "unit": {
          "const": "percent",
          "default": "percent",
          "title": "Unit",
          "type": "string"
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "percent"
      ],
      "title": "PercentMeasurement",
      "type": "object"
    },
    "PercentMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "PercentMeasurementSpec",
      "type": "object"
    },
    "PeriodMeasurement": {
      "description": "Represents a time period measurement configuration",
      "properties": {
        "measurement_type": {
          "const": "period",
          "default": "period",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "period": {
          "$ref": "#/$defs/PeriodMeasurementSpec"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/PeriodUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "period"
      ],
      "title": "PeriodMeasurement",
      "type": "object"
    },
    "PeriodMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "PeriodMeasurementSpec",
      "type": "object"
    },
    "PeriodUnit": {
      "enum": [
        "second"
      ],
      "title": "PeriodUnit",
      "type": "string"
    },
    "ScaleAnnotationSpec-Output": {
      "properties": {
        "label_mapping": {
          "$ref": "#/$defs/StringScaleMapping",
          "description": "Optional label for each scale value"
        },
        "scale_mapping": {
          "anyOf": [
            {
              "oneOf": [
                {
                  "$ref": "#/$defs/ColorScaleMapping-Output"
                },
                {
                  "$ref": "#/$defs/EmojiScaleMapping-Output"
                }
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Display value mappoing for each scale value",
          "title": "Scale Mapping"
        }
      },
      "required": [
        "label_mapping"
      ],
      "title": "ScaleAnnotationSpec",
      "type": "object"
    },
    "ScaleAnnotationSpecContainer-Output": {
      "properties": {
        "default_note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default note text, if any",
          "title": "Default Note"
        },
        "scale": {
          "$ref": "#/$defs/ScaleAnnotationSpec-Output"
        }
      },
      "required": [
        "scale"
      ],
      "title": "ScaleAnnotationSpecContainer",
      "type": "object"
    },
    "ScaleMeasurement": {
      "description": "Represents a discrete scale measurement configuration with minimum and maximum values",
      "properties": {
        "measurement_type": {
          "const": "scale",
          "default": "scale",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "scale": {
          "$ref": "#/$defs/ScaleMeasurementSpec"
        },
        "unit": {
          "title": "Unit",
          "type": "null"
        },
        "value_type": {
          "const": "integer",
          "default": "integer",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "scale"
      ],
      "title": "ScaleMeasurement",
      "type": "object"
    },
    "ScaleMeasurementSpec": {
      "properties": {
        "max_allowed": {
          "description": "Maxiumum value on scale",
          "title": "Max Allowed",
          "type": "integer"
        },
        "min_allowed": {
          "description": "Minimum value on scale",
          "title": "Min Allowed",
          "type": "integer"
        },
        "value": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "required": [
        "min_allowed",
        "max_allowed"
      ],
      "title": "ScaleMeasurementSpec",
      "type": "object"
    },
    "StringScaleMapping": {
      "description": "Represents a scale mapping to strings or emojis",
      "properties": {
        "mapping_type": {
          "const": "string",
          "default": "string",
          "title": "Mapping Type",
          "type": "string"
        },
        "string": {
          "$ref": "#/$defs/StringScaleMappingSpec"
        }
      },
      "required": [
        "string"
      ],
      "title": "StringScaleMapping",
      "type": "object"
    },
    "StringScaleMappingSpec": {
      "properties": {
        "mapping": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Mapping of scale values to strings",
          "title": "Mapping",
          "type": "object"
        }
      },
      "required": [
        "mapping"
      ],
      "title": "StringScaleMappingSpec",
      "type": "object"
    },
    "TemperatureMeasurement": {
      "description": "Represents a temperature measurement configuration",
      "properties": {
        "measurement_type": {
          "const": "temperature",
          "default": "temperature",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "temperature": {
          "$ref": "#/$defs/TemperatureMeasurementSpec"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/TemperatureUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        }
      },
      "required": [
        "temperature"
      ],
      "title": "TemperatureMeasurement",
      "type": "object"
    },
    "TemperatureMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "TemperatureMeasurementSpec",
      "type": "object"
    },
    "TemperatureUnit": {
      "enum": [
        "degree_celsius",
        "degree_fahrenheit"
      ],
      "title": "TemperatureUnit",
      "type": "string"
    },
    "VolumeMeasurement": {
      "description": "Represents a physical volume measurement configuration",
      "properties": {
        "measurement_type": {
          "const": "volume",
          "default": "volume",
          "title": "Measurement Type",
          "type": "string"
        },
        "metric_kind": {
          "$ref": "#/$defs/MetricKind",
          "default": "discrete",
          "description": "How the measurement should be aggregated"
        },
        "unit": {
          "anyOf": [
            {
              "$ref": "#/$defs/VolumeUnit"
            },
            {
              "type": "null"
            }
          ]
        },
        "value_type": {
          "const": "real",
          "default": "real",
          "title": "Value Type",
          "type": "string"
        },
        "volume": {
          "$ref": "#/$defs/VolumeMeasurementSpec"
        }
      },
      "required": [
        "volume"
      ],
      "title": "VolumeMeasurement",
      "type": "object"
    },
    "VolumeMeasurementSpec": {
      "properties": {
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "description": "Default value",
          "title": "Value"
        }
      },
      "title": "VolumeMeasurementSpec",
      "type": "object"
    },
    "VolumeUnit": {
      "enum": [
        "teaspoon",
        "tablespoon",
        "fluid_ounce",
        "pint",
        "quart",
        "gallon",
        "millileter",
        "liter"
      ],
      "title": "VolumeUnit",
      "type": "string"
    }
  }
}