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

title: PRS Findings Format
type: object

description: >
  The PRS 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/Interpretation'
    maxItems: 1
    minItems: 1
    type: array
    
required:
- findings

definitions:
  ClinicalRiskInputs:
    properties:
      sample:
        $ref: ../../ids.json#/definitions/SampleId
      age:
        title: Age
        type: integer
        minimum: 0
        maximum: 99
      sex:
        $ref: ../../core.json#/definitions/BiologicalSex
      race:
        type: string
        title: Ancestry / Race
        examples:
          - WHITE
          - HISPANIC
          - BLACK_AFRICAN_AMERICAN
          - EAST_ASIAN
          - SOUTH_ASIAN
          - ASHKENAZI_JEWISH
          - N/A
      smoking_status:
        $ref: ../../requisition_observations/smoking.json#/definitions/SmokingStatus
      diagnosed_with_type_2_diabetes:
        $ref: ../../requisition_observations/diabetes.json#/definitions/DiagnosedWithType2Diabetes
      antihypertension_medication_use:
        $ref: ../../requisition_observations/blood_pressure.json#/definitions/AntiHyperTensionMedicationUse
      total_cholesterol:
        $ref: ../../requisition_observations/cholesterol.json#/definitions/TotalCholesterol
      hdl_cholesterol:
        $ref: ../../requisition_observations/cholesterol.json#/definitions/HDLCholesterol
      diastolic_blood_pressure:
        $ref: ../../requisition_observations/blood_pressure.json#/definitions/DiastolicBloodPressure
      systolic_blood_pressure:
        $ref: ../../requisition_observations/blood_pressure.json#/definitions/SystolicBloodPressure
      body_mass_index:
        $ref: ../../requisition_observations/body_mass_index.json#/definitions/BodyMassIndex
      waist_circumference:
        $ref: ../../requisition_observations/waist_circumference.json#/definitions/WaistCircumference
      first_degree_family_with_type_2_diabetes:
        $ref: ../../requisition_observations/diabetes_family_history.json#/definitions/FirstDegreeFamilyWithType2Diabetes
      fasting_glucose_level:
        $ref: ../../requisition_observations/glucose.json#/definitions/FastingGlucoseLevel
      triglyceride_level:
        $ref: ../../requisition_observations/triglyceride.json#/definitions/TriglycerideLevel

  Interpretation:
    properties:
      clinical:
        items:
          $ref: '#/definitions/PRSResult'
        maxItems: 2
        minItems: 1
        type: array
      integrated:
        items:
          $ref: '#/definitions/PRSResult'
        maxItems: 2
        minItems: 1
        type: array
      prs_type:
        $ref: ../../core.json#/definitions/PRSType
    required:
    - prs_type
    - clinical
  PRSResult:
    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/PRSTimespan
    required:
    - timespan
    - score
    type: object
