$schema: https://json-schema.org/draft/2020-12/schema

title: Clinical Risk Findings Format
type: object

description: >
  The Clinical Risk interpretation format stores risk for a disease across a certain timespan.

properties:
  _version:
    $ref: ../../core.json#/definitions/Version
  clinical_risk_inputs:
    items:
      $ref: '#/definitions/ClinicalRiskInputs'
    maxItems: 1
    minItems: 1
    type: array
  findings:
    items:
      $ref: '#/definitions/ClinicalInterpretation'
    maxItems: 1
    minItems: 1
    type: array

definitions:
  ClinicalInterpretation:
    properties:
      clinical:
        items:
          $ref: '#/definitions/ClinicalRiskResult'
        maxItems: 2
        minItems: 1
        type: array
      score_type:
        $ref: ../../core.json#/definitions/ClinicalScoreType
    required:
      - score_type
      - clinical

  ClinicalRiskResult:
    properties:
      score:
        example: 0.1
        type: number
        description: Expecting score in decimal format then converted to percentage by report generator.
        minimum: 0
        maximum: 1
      timespan:
        $ref: ../../core.json#/definitions/ClinicalTimespan
    required:
      - timespan
      - score
    type: object