//    Copyright 2019 Google Inc.
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        https://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

syntax = "proto3";

package google.fhir.r4.core;

import "google/protobuf/any.proto";
import "google/fhir/core/proto/annotations.proto";
import "google/fhir/r4/proto/core/codes.proto";
import "google/fhir/r4/proto/core/datatypes.proto";

option java_multiple_files = true;
option java_package = "com.google.fhir.r4.core";
option (.google.fhir.proto.fhir_version) = R4;
option go_package = "github.com/google/fhir/go/google/fhir/r4/proto/core/resources/risk_evidence_synthesis_go_proto";

// Auto-generated from StructureDefinition for RiskEvidenceSynthesis.
// A quantified estimate of risk based on a body of evidence.
// See http://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesis
message RiskEvidenceSynthesis {
  option (.google.fhir.proto.structure_definition_kind) = KIND_RESOURCE;
  option (.google.fhir.proto.fhir_structure_definition_url) =
      "http://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesis";
  option (.google.fhir.proto.fhir_path_message_warning_constraint) =
      "name.matches('[A-Z]([A-Za-z0-9_]){0,254}')";

  // Logical id of this artifact
  Id id = 1;

  // Metadata about the resource
  Meta meta = 2;

  // A set of rules under which this content was created
  Uri implicit_rules = 3;

  // Language of the resource content
  Code language = 4;

  // Text summary of the resource, for human interpretation
  Narrative text = 5;

  // Contained, inline Resources
  repeated protobuf.Any contained = 6;

  // Field 7 reserved for strongly-typed ContainedResource for id:
  // RiskEvidenceSynthesis.contained
  reserved 7;

  // Additional content defined by implementations
  repeated Extension extension = 8;

  // Extensions that cannot be ignored
  repeated Extension modifier_extension = 9;

  // Canonical identifier for this risk evidence synthesis, represented as a URI
  // (globally unique)
  Uri url = 10;

  // Additional identifier for the risk evidence synthesis
  repeated Identifier identifier = 11;

  // Business version of the risk evidence synthesis
  String version = 12;

  // Name for this risk evidence synthesis (computer friendly)
  String name = 13;

  // Name for this risk evidence synthesis (human friendly)
  String title = 14;

  // draft | active | retired | unknown
  message StatusCode {
    option (.google.fhir.proto.structure_definition_kind) = KIND_PRIMITIVE_TYPE;
    option (.google.fhir.proto.fhir_valueset_url) =
        "http://hl7.org/fhir/ValueSet/publication-status";
    option (.google.fhir.proto.fhir_profile_base) =
        "http://hl7.org/fhir/StructureDefinition/code";

    PublicationStatusCode.Value value = 1;

    String id = 2;

    repeated Extension extension = 3;
  }
  StatusCode status = 15
      [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR];

  // Date last changed
  DateTime date = 16;

  // Name of the publisher (organization or individual)
  String publisher = 17;

  // Contact details for the publisher
  repeated ContactDetail contact = 18;

  // Natural language description of the risk evidence synthesis
  Markdown description = 19;

  // Used for footnotes or explanatory notes
  repeated Annotation note = 20;

  // The context that the content is intended to support
  repeated UsageContext use_context = 21;

  // Intended jurisdiction for risk evidence synthesis (if applicable)
  repeated CodeableConcept jurisdiction = 22;

  // Use and/or publishing restrictions
  Markdown copyright = 23;

  // When the risk evidence synthesis was approved by publisher
  Date approval_date = 24;

  // When the risk evidence synthesis was last reviewed
  Date last_review_date = 25;

  // When the risk evidence synthesis is expected to be used
  Period effective_period = 26;

  // The category of the EffectEvidenceSynthesis, such as Education, Treatment,
  // Assessment, etc.
  repeated CodeableConcept topic = 27;

  // Who authored the content
  repeated ContactDetail author = 28;

  // Who edited the content
  repeated ContactDetail editor = 29;

  // Who reviewed the content
  repeated ContactDetail reviewer = 30;

  // Who endorsed the content
  repeated ContactDetail endorser = 31;

  // Additional documentation, citations, etc.
  repeated RelatedArtifact related_artifact = 32;

  // Type of synthesis
  CodeableConcept synthesis_type = 33;

  // Type of study
  CodeableConcept study_type = 34;

  // What population?
  Reference population = 35 [
    (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR,
    (.google.fhir.proto.valid_reference_type) = "EvidenceVariable"
  ];

  // What exposure?
  Reference exposure = 36
      [(.google.fhir.proto.valid_reference_type) = "EvidenceVariable"];

  // What outcome?
  Reference outcome = 37 [
    (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR,
    (.google.fhir.proto.valid_reference_type) = "EvidenceVariable"
  ];

  // What sample size was involved?
  message SampleSize {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Description of sample size
    String description = 4;

    // How many studies?
    Integer number_of_studies = 5;

    // How many participants?
    Integer number_of_participants = 6;
  }
  SampleSize sample_size = 38;

  // What was the estimated risk
  message RiskEstimate {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Description of risk estimate
    String description = 4;

    // Type of risk estimate
    CodeableConcept type = 5;

    // Point estimate
    Decimal value = 6;

    // What unit is the outcome described in?
    CodeableConcept unit_of_measure = 7;

    // Sample size for group measured
    Integer denominator_count = 8;

    // Number with the outcome
    Integer numerator_count = 9;

    // How precise the estimate is
    message PrecisionEstimate {
      // Unique id for inter-element referencing
      String id = 1;

      // Additional content defined by implementations
      repeated Extension extension = 2;

      // Extensions that cannot be ignored even if unrecognized
      repeated Extension modifier_extension = 3;

      // Type of precision estimate
      CodeableConcept type = 4;

      // Level of confidence interval
      Decimal level = 5;

      // Lower bound
      Decimal from = 6;

      // Upper bound
      Decimal to = 7;
    }
    repeated PrecisionEstimate precision_estimate = 10;
  }
  RiskEstimate risk_estimate = 39;

  // How certain is the risk
  message Certainty {
    // Unique id for inter-element referencing
    String id = 1;

    // Additional content defined by implementations
    repeated Extension extension = 2;

    // Extensions that cannot be ignored even if unrecognized
    repeated Extension modifier_extension = 3;

    // Certainty rating
    repeated CodeableConcept rating = 4;

    // Used for footnotes or explanatory notes
    repeated Annotation note = 5;

    // A component that contributes to the overall certainty
    message CertaintySubcomponent {
      // Unique id for inter-element referencing
      String id = 1;

      // Additional content defined by implementations
      repeated Extension extension = 2;

      // Extensions that cannot be ignored even if unrecognized
      repeated Extension modifier_extension = 3;

      // Type of subcomponent of certainty rating
      CodeableConcept type = 4;

      // Subcomponent certainty rating
      repeated CodeableConcept rating = 5;

      // Used for footnotes or explanatory notes
      repeated Annotation note = 6;
    }
    repeated CertaintySubcomponent certainty_subcomponent = 6;
  }
  repeated Certainty certainty = 40;
}
