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

title: "MyOme json report"
description: "MyOme report object"
type: "object"

allOf:
  - $ref: "base.json"
  - properties:
      report_type:
        const: "RARE_DISEASE"
        type: string
      results:
        $ref: "#/definitions/RDReportResults"

definitions:
  RareDiseaseVariationClassification:
    type: object
    additionalProperties: false
    required:
      - classification
    properties:
      classification:
        title: ACMG Classification
        $ref: '../../core.json#/definitions/ACMGPlusNegativeClassification'
      gene_symbol:
        type: string
      variation:
        type: object
        $ref: '../../structs.json#/definitions/RareDiseaseVariation'
      phenotype:
        type: object
        properties:
          evidence_summary:
            type: [ "string", "null" ]
      inheritance:
        type: object
        properties:
          mode:
            title: Mode of Inheritance
            $ref: '../../core.json#/definitions/Inheritance'
          zygosity:
            title: Zygosity
            $ref: '../../core.json#/definitions/Zygosity'
          pattern:
            title: Inherited From
            $ref: '../../core.json#/definitions/VariantInheritance'
      variant_description:
        title: "Evidence"
        type: [ "string", "null" ]
      gene_info:
        type: string
      condition:
        type: string

  RDReportResults:
    description: >-
      ReportResults is the editable, versioned component of a MyOme
      lab report.
    type: object
    additionalProperties: false
    required:
      - toplines
      - next_steps
      - classifications
    properties:
      classifications:
        minItems: 1
        type: array
        items:
          $ref: "#/definitions/RareDiseaseVariationClassification"
      hpo_terms:
        type: array
        items:
          type: string
        examples:
          - "Seizure"
          - "Hypertelorism"
      next_steps:
        title: "Next Steps"
        type: array
        items:
          type: string
        example:
          - "Women with an estimated lifetime breast cancer risk of 20% or higher should speak with their healthcare provider about American Cancer Society (ACS) guidelines for increased breast cancer surveillance as outlined below, as well as published recommendations for risk-reducing agents and comprehensive risk assessment."
          - "Annual mammograms starting at age 40 or 10 years younger than the earliest breast cancer diagnosis in the family (but no earlier than age 30)\n"
          - "Annual breast MRI starting at age 40 or 10 years younger than the earliest breast cancer diagnosis in the family (but no earlier than age 25)\n"
          - "These results should be interpreted in the context of the individual's personal medical history and family history. The patient's female relatives may wish to speak with their healthcare provider to undergo a personalized risk assessment."
      toplines:
        description: "Uses topline finding definition from structs.json."
        type: array
        minItems: 1
        maxItems: 5
        items:
          type: object
          required:
            - finding
            - text
          properties:
            finding:
              $ref: "../../core.json#/definitions/RareDiseaseToplineFinding"
            text:
              title: "Text"
              type: string
        example:
          finding: "POSITIVE"
          text: "A pathogenic variant was identified on chromosome chr1."
      sample_limitations:
        type: array
        items:
          type: string

  RDTopline:
    description: Uses topline finding definition from structs.json.
    type: array
    minItems: 1
    maxItems: 5
    items:
      allOf:
        - $ref: "../../structs.json#/definitions/ToplineFinding"
        - properties:
            finding:
              $ref: "../../core.json#/definitions/RareDiseaseToplineFinding"
    example:
      finding: POSITIVE
      text: A pathogenic variant was identified on chromosome chr1.