$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:
  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: "../../structs.json#/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:
          allOf:
            - properties:
                finding:
                  title: "Finding"
                  anyOf:
                    - type: string
                      enum: [ "POSITIVE", "NEGATIVE" ]
                    - type: string
                      enum: [ "AVERAGE_RISK", "ELEVATED_RISK", "HIGH_RISK", "LOW_RISK", "INTERMEDIATE_RISK", "BORDERLINE_RISK" ]
                    - type: string
                      enum: [ "MINIMAL_IMPACT", "ALTERED_DOSE", "MAJOR_IMPACT", "CONTRAINDICATED" ]
                  type: string
                text:
                  title: "Text"
                  type: string
              required:
                - finding
                - text
            - properties:
                finding:
                  type: string
                  enum: [ "POSITIVE", "NEGATIVE" ]
        example:
          finding: "POSITIVE"
          text: "A pathogenic variant was identified on chromosome chr1."
      sample_limitations:
        type: array
        items:
          type: string
      references:
        type: array
        description: "Medical references related to the report findings"
        items:
          type: object
          required:
            - value
            - type
          properties:
            value:
              type: integer
              description: "Reference identifier value, such as a PubMed ID"
            type:
              type: string
              enum: [ "PUBMED" ]
              description: "Type of reference (currently only PUBMED supported)"

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