<?xml version="1.0" encoding="UTF-8"?>

<OperationDefinition xmlns="http://hl7.org/fhir">
  <id value="EEVRISPatientObservations"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: OperationDefinition EEVRISPatientObservations</b></p><a name="EEVRISPatientObservations"> </a><a name="hcEEVRISPatientObservations"> </a><p>URL: [base]/Patient/$patient-observations</p><p>URL: [base]/Patient/[id]/$patient-observations</p><h3>Parameters</h3><table class="grid"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>patient</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/references.html#Reference">Reference</a> (<a href="StructureDefinition-ee-vris-patient-universal.html" title="https://fhir.ee/vris/StructureDefinition/ee-vris-patient-universal">Patient: EE VRIS Patient</a>, <a href="https://fhir.ee/packages/mpi/1.5.0/site/StructureDefinition-ee-mpi-patient-verified.html" title="https://fhir.ee/mpi/StructureDefinition/ee-mpi-patient-verified">EE MPI Patient Verified</a>, <a href="https://fhir.ee/packages/mpi/1.5.0/site/StructureDefinition-ee-mpi-patient-unknown.html" title="https://fhir.ee/mpi/StructureDefinition/ee-mpi-patient-unknown">EE MPI Patient Unknown</a>)</td><td/><td><div><p>Reference to the patient whose observations are being requested. Required when invoked at type level; optional (implied) when invoked at instance level.</p>
</div></td></tr><tr><td>IN</td><td>profile</td><td/><td>0..*</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#canonical">canonical</a></td><td/><td><div><p>Filter results to include only Observations conforming to specified profile(s). Multiple profiles can be provided (OR condition).</p>
</div></td></tr><tr><td>IN</td><td>category</td><td/><td>0..*</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#CodeableConcept">CodeableConcept</a></td><td/><td><div><p>Filter by Observation.category value(s) (e.g., laboratory, exam, procedure, social-history).</p>
</div></td></tr><tr><td>IN</td><td>code</td><td/><td>0..*</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#CodeableConcept">CodeableConcept</a></td><td/><td><div><p>Filter by Observation.code value(s) (e.g., specific LOINC or SNOMED CT codes).</p>
</div></td></tr><tr><td>IN</td><td>date-from</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#dateTime">dateTime</a></td><td/><td><div><p>Include only Observations with effective date on or after this date.</p>
</div></td></tr><tr><td>IN</td><td>date-to</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#dateTime">dateTime</a></td><td/><td><div><p>Include only Observations with effective date on or before this date.</p>
</div></td></tr><tr><td>IN</td><td>status</td><td/><td>0..*</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#code">code</a></td><td/><td><div><p>Filter by Observation.status (e.g., final, amended, corrected, cancelled).</p>
</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/bundle.html">Bundle</a></td><td/><td><div><p>Bundle of type 'searchset' containing all matching Observation resources. Empty Bundle if patient has no observations.</p>
</div></td></tr></table><div><p>This operation returns all Observation resources associated with a given patient, optionally filtered by profile, category, code, or effective date range.</p>
</div></div>
  </text>
  <url value="https://fhir.ee/vris/OperationDefinition/patient-observations"/>
  <version value="0.1.0"/>
  <name value="PatientObservations"/>
  <title value="$patient-observations operation"/>
  <status value="draft"/>
  <kind value="operation"/>
  <experimental value="true"/>
  <date value="2026-07-15"/>
  <publisher value="TEHIK"/>
  <contact>
    <name value="TEHIK"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.tehik.ee"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="fhir@tehik.ee"/>
    </telecom>
  </contact>
  <contact>
    <name value="TEHIK Andmekorraldus"/>
    <telecom>
      <system value="email"/>
      <value value="andmekorraldus@tehik.ee"/>
      <use value="work"/>
    </telecom>
  </contact>
  <description value="TEST Custom operation to retrieve all Observation resources for a specific patient in Estonian VRIS. Supports optional filtering by profile, category, code, and date range. (ee Operatioon kõikide Observation ressursside pärimiseks VRIS-ist. Tagastab Bundle'i kõikide Observationitega, kus subject viitab antud patsiendile.)"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="EE"/>
      <display value="Estonia"/>
    </coding>
  </jurisdiction>
  <affectsState value="false"/>
  <code value="patient-observations"/>
  <comment value="This operation returns all Observation resources associated with a given patient, optionally filtered by profile, category, code, or effective date range."/>
  <resource value="Patient"/>
  <system value="false"/>
  <type value="true"/>
  <instance value="true"/>
  <parameter>
    <name value="patient"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Reference to the patient whose observations are being requested. Required when invoked at type level; optional (implied) when invoked at instance level."/>
    <type value="Reference"/>
    <targetProfile value="https://fhir.ee/vris/StructureDefinition/ee-vris-patient-universal"/>
    <targetProfile value="https://fhir.ee/mpi/StructureDefinition/ee-mpi-patient-verified"/>
    <targetProfile value="https://fhir.ee/mpi/StructureDefinition/ee-mpi-patient-unknown"/>
  </parameter>
  <parameter>
    <name value="profile"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Filter results to include only Observations conforming to specified profile(s). Multiple profiles can be provided (OR condition)."/>
    <type value="canonical"/>
  </parameter>
  <parameter>
    <name value="category"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Filter by Observation.category value(s) (e.g., laboratory, exam, procedure, social-history)."/>
    <type value="CodeableConcept"/>
  </parameter>
  <parameter>
    <name value="code"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Filter by Observation.code value(s) (e.g., specific LOINC or SNOMED CT codes)."/>
    <type value="CodeableConcept"/>
  </parameter>
  <parameter>
    <name value="date-from"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Include only Observations with effective date on or after this date."/>
    <type value="dateTime"/>
  </parameter>
  <parameter>
    <name value="date-to"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <documentation value="Include only Observations with effective date on or before this date."/>
    <type value="dateTime"/>
  </parameter>
  <parameter>
    <name value="status"/>
    <use value="in"/>
    <min value="0"/>
    <max value="*"/>
    <documentation value="Filter by Observation.status (e.g., final, amended, corrected, cancelled)."/>
    <type value="code"/>
  </parameter>
  <parameter>
    <name value="return"/>
    <use value="out"/>
    <min value="1"/>
    <max value="1"/>
    <documentation value="Bundle of type 'searchset' containing all matching Observation resources. Empty Bundle if patient has no observations."/>
    <type value="Bundle"/>
  </parameter>
</OperationDefinition>