> ## Documentation Index
> Fetch the complete documentation index at: https://help.elationhealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Observation Sexual Orientation

## Overview

The Observation Sexual Orientation resource represents a patient's self-identified sexual orientation. Sexual orientation is a person's identity in relation to the gender or genders to which they are romantically or sexually attracted. This resource captures patient-reported sexual orientation information as part of comprehensive patient demographics and social history. At its minimum, Observation contains a specific LOINC code for sexual orientation (76690-7), a status, a reference to the patient, and the sexual orientation value, but may also contain data about when the information was recorded and who recorded it.

**Each Observation has next elements:**

* a status
* a fixed code for sexual orientation(76690-7)
* a patient

**Each Observation supports next elements:**

* a time indicating when the observation was made
* a sexual orientation value

**Profile specific implementation guidance:**

* Additional codes that translate or map to the Observation code (e.g., local codes) are allowed.

This resource conforms to **[USCDI v3 profile](https://www.healthit.gov/isa/uscdi-data-element/sexual-orientation)** for Sexual Orientation - refer to [StructureDefinition US Core Observation Sexual Orientation Profile](http://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-observation-sexual-orientation.html). Observation Sexual Orientation response will be provided in JSON (refers to Capability Statement) format as per [FHIR](https://hl7.org/fhir) standard R4 version.

| USCore Data Element                             | FHIR Resource Field       |
| ----------------------------------------------- | ------------------------- |
| status                                          | Observation.status        |
| a fixed code for sexual orientation             | Observation.code          |
| patient                                         | Observation.subject       |
| a time indicating when the observation was made | Observation.effective\[x] |
| a sexual orientation value                      | Observation.value\[x]     |

### Must support elements, mandatory and optional search parameters

*Observation**must support** these elements:*

* `status`
* `code`
* `subject`
* `effective[x]`
* `value[x]:valueCodeableConcept`

*The following search parameters and search parameter combinations SHALL be supported:*

The syntax used to describe the interactions is described [here](/articles/fhir/us-core-guidance).

**SHALL** support searching for all Observations for a patient and code search parameters:\
`GET [base url]/Observation?patient={Type/}[id]&code={system|}[code]{,{system|}[code],...}`

**SHALL** support searching for all Observations for a patient and code and date search parameters:

* including support for these date comparators: gt,lt,ge,le
* including optional support for AND search on date (e.g.date=\{date}\&date=\{date}}&...)\
  `GET [base url]/Observation?patient={Type/}{id}&code={system|}|{code}{,{system|}|{code},...}&date={gt|lt|ge|le}{date}{&date={gt|lt|ge|le}{date}&...}`

*The following search parameters and search parameter combinations SHALL be supported:*

The syntax used to describe the interactions is described [here](/articles/fhir/us-core-guidance).

**SHALL** support searching using the combination of the `patient` and `code` search parameters:

* including optional support for OR search on code (e.g.code=\{system|}\[code],\{system|}\[code],...)

`GET [base url]/Observation?patient={Type/}[id]&code={system|}[code]`

**SHALL** support searching using the combination of the `patient` and `category` search parameters:
`GET [base url]/Observation?patient={Type/}[id]&category={system|}[code]`

**SHALL** support searching using the combination of the `patient` and `category` and `date` search parameters:

* including support for these date comparators: gt,lt,ge,le
* including optional support for AND search on date (e.g.date=\[date]\&date=\[date]]&...)
  `GET [base url]/Observation?patient={Type/}[id]&category={http://terminology.hl7.org/CodeSystem/observation-category|}social-history&date={gt|lt|ge|le}[date]{&date={gt|lt|ge|le}[date]&...}`

*The following search parameters and search parameter combinations SHOULD be supported:*

**SHOULD** support searching using the combination of the `patient` and `category` and `status` search parameters:

* including support for OR search on status (e.g.status=\{system|}\[code],\{system|}\[code],...)
  `GET [base url]/Observation?patient={Type/}[id]&category={http://terminology.hl7.org/CodeSystem/observation-category|}social-history&status={system|}[code]{,{system|}[code],...}`

**SHOULD** support searching using the combination of the `patient` and `code` and `date` search parameters:

* including optional support for OR search on code (e.g.code=\{system|}\[code],\{system|}\[code],...)
* including support for these date comparators: gt,lt,ge,le
* including optional support for AND search on date (e.g.date=\[date]\&date=\[date]]&...)
  `GET [base url]/Observation?patient={Type/}[id]&code={system|}[code]{,{system|}[code],...}&date={gt|lt|ge|le}[date]{&date={gt|lt|ge|le}[date]&...}`

The response to any search operation is always a list of resources in a Bundle or an Operation Outcome.

## Observation Sexual Orientation By patient and code search parameters

Get Observation Sexual Orientation by combination of the patient and code search parameters.

**METHOD** *GET*

```
[base url]/Observation?patient=[reference]&code={system|}[code]
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[reference] - reference to the Patient
\{system|} - terminology system (LOINC)
\[code] - LOINC code 76690-7 for Sexual orientation

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/Observation?patient=1137192&code=http://loinc.org|76690-7' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Observation Sexual Orientation By patient and category search parameters

Get Observation Sexual Orientation by combination of the patient and category search parameters.

**METHOD** *GET*

```
[base url]/Observation?patient=[reference]&category={system|}[code]
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[reference] - reference to the Patient
\{system|} - terminology system used to define observation category code
\[code] - category code (social-history)

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/Observation?patient=1137192&category=social-history' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Observation Sexual Orientation By patient, category and date search parameters

Get Observation Sexual Orientation by combination of the patient, category and date search parameters.

**METHOD** *GET*

```
[base url]/Observation?patient=[reference]&category={http://terminology.hl7.org/CodeSystem/observation-category|}social-history&date={gt|lt|ge|le}[date]{&date={gt|lt|ge|le}[date]&...}
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[reference] - reference to the Patient
\{system|} - terminology system ([http://terminology.hl7.org/CodeSystem/observation-category](http://terminology.hl7.org/CodeSystem/observation-category))
\[code] - category code (social-history)
\[date] - effective date of observation

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/Observation?patient=1137192&category=http://terminology.hl7.org/CodeSystem/observation-category|social-history&date=ge2023-01-01' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Observation Sexual Orientation By patient, category and status search parameters

Get Observation Sexual Orientation by combination of the patient, category and status search parameters.

**METHOD** *GET*

```
[base url]/Observation?patient=[reference]&category={http://terminology.hl7.org/CodeSystem/observation-category|}social-history&status={system|}[code]{,{system|}[code],...}
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[reference] - reference to the Patient
\{system|} - terminology system used to define observation category/status code
\[code] - category code (social-history) and status code (supports OR search)

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/Observation?patient=1137192&category=http://terminology.hl7.org/CodeSystem/observation-category|social-history&status=final' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Observation Sexual Orientation By patient, code and date search parameters

Get Observation Sexual Orientation by combination of the patient, code and date search parameters.

**METHOD** *GET*

```
[base url]/Observation?patient=[reference]&code={system|}[code]{,{system|}[code],...}&date={gt|lt|ge|le}[date]{&date={gt|lt|ge|le}[date]&...}
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[reference] - reference to the Patient
\{system|} - terminology system (LOINC)
\[code] - observation code (supports OR search)
\[date] - effective date of observation

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/Observation?patient=1137192&code=http://loinc.org|76690-7&date=ge2023-01-01' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```
