{
   "title": "ClinicianPortalRequisition",
   "type": "object",
   "properties": {
      "rerequisition": {
         "$ref": "../../../ids.json#/definitions/RequisitionId",
         "description": "Original requisition ID for this individual"
      },
      "campaign_code": {
         "type": "string",
         "title": "Campaign Code"
      },
      "clinicians": {
         "type": "array",
         "title": "Clinicians",
         "description": "Start typing to autocomplete, must select at least 1 clinician",
         "minItems": 1,
         "uniqueItems": true,
         "items": {
            "type": "object",
            "properties": {
               "label": {
                  "type": "string"
               },
               "id": {
                  "$ref": "../../../ids.json#/definitions/ClinicianId"
               }
            }
         }
      },
      "preferred_report_delivery": {
         "$ref": "../../../core.json#/definitions/PreferredReportDeliveryMethod",
         "default": "EMAIL"
      },
      "product_type": {
         "type": "string",
         "title": "Clinical Area",
         "default": "PROACTIVE",
         "enum": [
            "PROACTIVE",
            "DIAGNOSTIC"
         ],
         "enumNames": [
            "Proactive",
            "Diagnostic"
         ]
      },
      "product_ids": {
         "type": "array",
         "title": "Tests",
         "minItems": 1,
         "uniqueItems": true,
         "items": {
            "anyOf": [
               {
                  "$ref": "../../../ids.json#/definitions/ProductId",
                  "title": "Proactive Health Report \u2020",
                  "enum": [
                     "PR-2019"
                  ]
               },
               {
                  "$ref": "../../../ids.json#/definitions/ProductId",
                  "title": "Pharmacogenomics Report \u2020",
                  "enum": [
                     "PR-3009"
                  ]
               },
               {
                  "$ref": "../../../ids.json#/definitions/ProductId",
                  "title": "Neurodevelopmental Delay Copy Number Analysis Report",
                  "enum": [
                     "PR-5004"
                  ]
               }
            ]
         }
      },
      "pre_test_counseling": {
         "title": "Pre-Test Genetic Counseling",
         "type": "string",
         "$ref": "../../../core.json#/definitions/PreTestCounselingType",
         "default": "NO_COUNSELING"
      },
      "post_test_counseling": {
         "title": "Patient receives 3rd-party post-test genetic counseling",
         "type": "string",
         "$ref": "../../../core.json#/definitions/PostTestCounselingType",
         "default": "NO_COUNSELING"
      },
      "indications": {
         "title": "Clinical Indications",
         "description": "Indicate reasons for testing",
         "type": "string",
         "default": ""
      },
      "additional_files": {
         "title": "File Upload",
         "description": "Clinical Notes, Insurance Cards, Letter of Medical Necessity, etc. (Max file size: 30MB)",
         "type": "array",
         "uniqueItems": true,
         "items": {
            "type": "string",
            "format": "data-url"
         }
      },
      "consents_granted": {
         "type": "array",
         "title": "Consents",
         "minItems": 1,
         "maxItems": 1,
         "uniqueItems": true,
         "items": {
            "anyOf": [
               {
                  "$ref": "../../../ids.json#/definitions/ConsentUri",
                  "title": "Signed Provider Attestation",
                  "description": "By checking this box, the medical professional acknowledges that the individual/guardian authorized to make decisions for the individual (collectively, the Patient) has been supplied information regarding and consented to undergo the genetic testing ordered including genetic counseling by MyOme or its affiliates, substantially as set forth in the Informed Consent for Genetic Testing, and/or as required by applicable law, and the Patient has been informed that MyOme and its affiliates may notify them of clinical updates related to genetic test results (in consultation with the ordering medical professional). For orders originating outside the USA, the Patient has been informed that their personal information and specimen will be transferred to and processed in the USA.",
                  "enum": [
                     "myome:consent:GENERAL"
                  ]
               }
            ]
         }
      },
      "subject": {
         "$ref": "../../Subject.json"
      },
      "remote_mrn": {
         "type": "string",
         "title": "Patient ID MRN",
         "description": "Clinic's Medical Record Number",
         "default": ""
      },
      "guardian": {
         "title": "Parent or Guardian (required for minors)",
         "type": "object",
         "properties": {
            "name": {
               "$ref": "../../../structs.json#/definitions/Name",
               "title": "Parent or Guardian Name",
               "default": {
                  "first": "",
                  "last": "",
                  "middle": ""
               }
            },
            "relationship_to_patient": {
               "title": "Parent or Guardian Relationship to Patient",
               "type": "string",
               "default": "",
               "examples": [
                  "Mother",
                  "Father",
                  "Legal Guardian"
               ]
            }
         }
      },
      "billing": {
         "$ref": "../../../structs.json#/definitions/BillingInstitutional"
      },
      "sample_request": {
         "$ref": "../../../structs.json#/definitions/SampleRequest",
         "default": {
            "type": "BUCCAL_SWAB",
            "send_kit": true
         }
      },
      "campaign_information": {
         "title": "Natera EMR Information",
         "type": "object",
         "properties": {
            "patient_mrn": {
               "type": "string",
               "title": "Natera MRN"
            },
            "single_gene_order_id": {
               "type": "string",
               "title": "Natera Single Gene Order ID"
            },
            "single_gene_specimen_id": {
               "type": "string",
               "title": "Natera Specimen ID"
            },
            "medication_response_order_id": {
               "type": "string",
               "title": "Natera Medication Response Order ID"
            },
            "medication_response_specimen_id": {
               "type": "string",
               "title": "Natera Medication Response Specimen ID"
            }
         },
         "required": [
            "patient_mrn"
         ]
      }
   },
   "required": [
      "clinicians",
      "product_type",
      "product_ids",
      "consents_granted",
      "subject",
      "sample_request",
      "billing",
      "campaign_information"
   ],
   "additionalProperties": false,
   "dependencies": {
      "product_type": {
         "oneOf": [
            {
               "properties": {
                  "product_type": {
                     "enum": [
                        "PROACTIVE"
                     ]
                  },
                  "product_subtype": {
                     "type": "string",
                     "title": "Test Type",
                     "default": "PROACTIVE_WGS",
                     "enum": [
                        "PROACTIVE_WGS",
                        "PROACTIVE_BGE"
                     ],
                     "enumNames": [
                        "MyOme Proactive Health Plus",
                        "MyOme Proactive Health"
                     ]
                  }
               },
               "required": [
                  "product_subtype"
               ]
            },
            {
               "properties": {
                  "product_type": {
                     "enum": [
                        "DIAGNOSTIC"
                     ]
                  },
                  "product_subtype": {
                     "type": "string",
                     "title": "Test Type",
                     "default": "DIAGNOSTIC_RD",
                     "enum": [
                        "DIAGNOSTIC_RD",
                        "DIAGNOSTIC_FVT"
                     ],
                     "enumNames": [
                        "MyOme Rare Disease",
                        "MyOme Family Variant Testing"
                     ]
                  }
               },
               "required": [
                  "product_subtype"
               ]
            }
         ]
      },
      "product_subtype": {
         "oneOf": [
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "PROACTIVE_WGS"
                     ]
                  },
                  "product_ids": {
                     "description": "\u2020 Product requires minimum age of 18 years",
                     "default": [
                        "PR-2019",
                        "PR-2010"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Single-Gene Risk, 151 Genes \u2020",
                              "enum": [
                                 "PR-2019"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Medication Response \u2020",
                              "enum": [
                                 "PR-2010"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Integrated Risk Coronary Artery Disease \u2020",
                              "enum": [
                                 "PR-2011"
                              ]
                           }
                        ]
                     }
                  }
               }
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "PROACTIVE_BGE"
                     ]
                  },
                  "product_ids": {
                     "description": "\u2020 Product requires minimum age of 18 years",
                     "default": [
                        "PR-2020",
                        "PR-2021"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Single-Gene Risk, 84 Genes \u2020",
                              "enum": [
                                 "PR-2020"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Medication Response \u2020",
                              "enum": [
                                 "PR-2022"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Integrated Risk Coronary Artery Disease \u2020",
                              "enum": [
                                 "PR-2021"
                              ]
                           }
                        ]
                     }
                  }
               }
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "DIAGNOSTIC_RD"
                     ]
                  },
                  "product_ids": {
                     "maxItems": 1,
                     "description": "\u2020 Product requires minimum age of 1 year",
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Neurodevelopmental Delay, Copy Number Analysis \u2020",
                              "enum": [
                                 "PR-2032"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Rare Disease, Proband Genome \u2020",
                              "enum": [
                                 "PR-2033"
                              ]
                           },
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "MyOme Rare Disease, Trio Genome \u2020",
                              "enum": [
                                 "PR-2034"
                              ]
                           }
                        ]
                     }
                  },
                  "additional_files": {
                     "minItems": 1
                  }
               },
               "required": [
                  "additional_files"
               ]
            },
            {
               "properties": {
                  "product_subtype": {
                     "enum": [
                        "DIAGNOSTIC_FVT"
                     ]
                  },
                  "product_ids": {
                     "maxItems": 1,
                     "default": [
                        "PR1234"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "../../../ids.json#/definitions/ProductId",
                              "title": "Family Variant Testing",
                              "enum": [
                                 "PR1234"
                              ]
                           }
                        ]
                     }
                  },
                  "relative": {
                     "title": "Relative",
                     "type": "object",
                     "additionalProperties": false,
                     "properties": {
                        "relationship": {
                           "title": "Relationship to Relative",
                           "type": "string",
                           "enum": [
                              "PARENT",
                              "CHILD",
                              "SIBLING",
                              "1ST_COUSIN",
                              "GRANDPARENT",
                              "GRANDCHILD",
                              "AUNT_UNCLE",
                              "NEICE_NEPHEW",
                              "HALF_SIBLING",
                              "OTHER"
                           ],
                           "enumNames": [
                              "Parent",
                              "Child",
                              "Sibling",
                              "1st Cousin",
                              "Grandparent",
                              "Grandchild",
                              "Aunt/Uncle",
                              "Neice/Nephew",
                              "Half-Sibling",
                              "Other (up to 4th degree)"
                           ]
                        },
                        "requisition": {
                           "title": "Order ID",
                           "type": "string",
                           "description": "RQxxxx"
                        },
                        "dob": {
                           "$ref": "../../../core.json#/definitions/Date",
                           "title": "Relative's Date of Birth",
                           "description": "mm/dd/yyyy"
                        }
                     }
                  },
                  "fvt_variants": {
                     "type": "array",
                     "minItems": 1,
                     "uniqueItems": true,
                     "title": "Requested Variants to Test",
                     "default": [
                        "NC_000017.10:g.41197702T"
                     ],
                     "items": {
                        "anyOf": [
                           {
                              "type": "string",
                              "title": "GENE1, c.123, p.123 (Pathogenic)",
                              "enum": [
                                 "NC_000017.10:g.41197702T"
                              ]
                           }
                        ]
                     }
                  }
               },
               "required": [
                  "relative"
               ]
            }
         ]
      }
   }
}