> ## 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.

# Goal

## Overview

The Goal resource describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.

**Each Goal has next elements:**

* a status
* text description of the goal
* a patient

**Each Goal supports next elements:**

* target date(s)
* start date
* expressed by (who identified the goal)

**Profile specific implementation guidance:**

* Free text goals can be used in Goal.description.text when a concept isn’t available or a legacy goal is not mapped to a LOINC or SNOMED concept.
* See the [SDOH](https://www.hl7.org/fhir/us/core/sdoh.html) guidance page for more information when exchanging Social Determinants of Health (SDOH) Goals

This resource conforms to [USCDI v3 profile](https://www.healthit.gov/isa/uscdi-data-class/health-concerns#uscdi-v3) for Goal - refers to [StructureDefinition US Core Goal](https://build.fhir.org/ig/HL7/US-Core/StructureDefinition-us-core-goal.html). Goal 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              | Goal.achievementStatus |
| goal description    | Goal.description       |
| patient             | Goal.subject           |

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

*Goal**must support** these elements:*

* `lifecycleStatus`
* `description`
* `subject`
* `target`
  * `dueDate`
* `startDate`

*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 goals for a patient using the patient search parameter:
`GET [base url]/Goal?patient={Type/}[id]`

*The following search parameter combinations **SHOULD** be supported (**optional**):*

**SHOULD** support searching using the combination of the patient and lifecycle-status search parameters:
`GET [base url]/Goal?patient={Type/}[id]&lifecycle-status={system|}[code]`

**SHOULD** support searching using the combination of the patient and target-date search parameters:

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

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

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

## Goal By Patient Id

Search for Goal by patient.

**METHOD** *GET*

```
[base url]/Goal?patient={Type/}[id]
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\[id] - Id for the Patient

**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/Goal?patient=Patient/c5137fa5-3216-b12a-cbbc-a0c6bef361g7' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Goal By Id

Get Goal by ID.

**METHOD** *GET*

```
[base url]/Goal/{id}
```

or

```
[base url]/Goal?_id={id}
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\{id} - Id for Goal resource

**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/Goal/c5137fa5-3216-b12a-cbbc-a0c6bef361g7' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## Goal by patient and lifecycle-status

Get Goals using the combination of the patient and lifecycle-status search parameters

**METHOD** *GET*

```
GET [base url]/Goal?patient={Type/}[id]&lifecycle-status={system|}[code]
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\{Type/} - Type for the Reference. *Example:* `Patient`
\[id] - patient id
\{system|} - an identity of the terminology system, used to specify the state of the goal throughout its lifecycle
\[code] - the state of the goal throughout its lifecycle

**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/Goal?patient=Patient/fe1cd986-1ac7-4c26-b8b3-d632a48408fd&lifecycle-status=active' \
--header 'Authorization: Bearer 1239b275-909e-4754-8f73-1e411fd6769e'
```

## Goal by patient and target-date search parameters

Get Goals using the combination of the patient and target-date search parameters

**METHOD** *GET*

```
GET [base url]/Goal?patient={Type/}[id]&target-date={gt|lt|ge|le}[date]
```

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\{Type/} - Type for the Reference. *Example:* `Patient`
\[id] - patient id
\[date] - indicates either the date or the duration after start by which the goal should be met

**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/Goal?patient=Patient/fe1cd986-1ac7-4c26-b8b3-d632a48408fd&target-date=ge2015-01-14&target-date=le2019-01-14' \
--header 'Authorization: Bearer 1239b275-909e-4754-8f73-1e411fd6769e'
```

## Goal by patient and description search parameters

Get Goals using the combination of the patient and description search parameters

**METHOD** *GET*

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

**PARAMS**
\[base url] - [FHIR base url](/articles/fhir/service-base-urls)
\{Type/} - Type for the Reference. *Example:* `Patient`
\[id] - patient id
\{system|} - an identity of the terminology system for goal description codes
\[code] - a coded value for the goal description

**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/Goal?patient=Patient/fe1cd986-1ac7-4c26-b8b3-d632a48408fd&description=http://snomed.info/sct|289169006' \
--header 'Authorization: Bearer 1239b275-909e-4754-8f73-1e411fd6769e'
```
