# DeviceUseStatement _search

`POST /DeviceUseStatement/_search`

This resource stores information about a device that a patient uses or has used, as reported by the patient, a care provider, or a related person. Device use statements may indicate an implanted device (e.g., a pacemaker or cochlear implant) or an external device the patient uses at home (e.g., a hearing aid or CPAP machine).

### \_search

Query for a patient’s current or historical device use, as documented by one organization.

> **Flexible FHIR queries, different query parameters**
>
> FHIR queries are a flexible option with parameters to refine your search. The response returns a bundle of resources, known as a `searchset` bundle type. [Learn about bundles and bundle types](https://docs.redoxengine.com/permalink/23Q1Oku3NdxxvwYnQGJVrg) in our FHIR glossary.
>
> We add a `required` label only to query parameters _a FHIR server requires if you query it directly_. Remember that Redox <u>**data on demand**</u> isn’t a FHIR server, and your connection may not be either.
>
> _Query parameters vary between sites._ Work with your connection to find out which query parameters they require for a successful search.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `device` | Array of string | No | Returns statements about this device |
| `identifier` | Array of string | No | Returns statements with this external identifier |
| `patient` | Array of string | No | The identity of a patient to list device use statements for. |
| `patient.identifier` | Array of string | No | One or more external identifiers for the patient |
| `subject` | Array of string | No | The identity of a subject to list device use statements for. |
| `subject.identifier` | Array of string | No | One or more external identifiers for the patient |

## Request example

_Generated from the schema: the values are placeholders, not a real payload._

```bash
curl 'https://api.redoxengine.com/fhir/R4/{destinationSlug}/{environmentFlag}/DeviceUseStatement/_search' \
--request POST \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'device=string' \
--data-urlencode 'identifier=string' \
--data-urlencode 'patient=string' \
--data-urlencode 'patient.identifier=string' \
--data-urlencode 'subject=string' \
--data-urlencode 'subject.identifier=string'
```

## Responses

### 200

Search results (Bundle)

Response to a DeviceUseStatement search operation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `resourceType` | string | Yes | Identifies the type of the resource. Value: Bundle |
| `type` | string | Yes | Identifies this bundle as a response to a search. Value: searchset |
| `total` | number | Yes | The total number of matches |
| `entry` | Array of DeviceUseStatement or Other | No | A resource matching the search criteria or related to a matching resource |
| `entry[] (DeviceUseStatement).resource` | object | Yes | A record of a device being used by a patient. |
| `entry[] (DeviceUseStatement).resource.resourceType` | string | Yes | Identifies the type of the resource. Value: DeviceUseStatement |
| `entry[] (DeviceUseStatement).resource.status` | string | Yes | A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed. Possible values: active, completed, entered-in-error + |
| `entry[] (DeviceUseStatement).resource.subject` | object | Yes | The patient who used the device. Must be a resource of type `Patient`. |
| `entry[] (DeviceUseStatement).resource.subject.reference` | string | No | A reference to another resource. This is typically either a relative reference which includes the resource type and ID, or an internal reference which starts with `#` and refers to a contained resource. |
| `entry[] (DeviceUseStatement).resource.device` | object | Yes | The details of the device used. Must be a resource of type `Device`. |
| `entry[] (DeviceUseStatement).resource.device.reference` | string | No | A reference to another resource. This is typically either a relative reference which includes the resource type and ID, or an internal reference which starts with `#` and refers to a contained resource. |
| `entry[] (DeviceUseStatement).resource.id` | string | No | The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes. |
| `entry[] (DeviceUseStatement).resource.identifier` | Array of object | No | An external identifier for this statement such as an IRI. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension` | Array of Boolean or String or CodeableConcept or Coding or HumanName or Reference | No | May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Boolean).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Boolean).valueBoolean` | boolean | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (String).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (String).valueString` | string | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).valueCodeableConcept` | object | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).valueCodeableConcept.coding` | Array of object | No | A reference to a code defined by a terminology system. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).valueCodeableConcept.coding[].system` | string | No | The identification of the code system that defines the meaning of the symbol in the code. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).valueCodeableConcept.coding[].code` | string | No | A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (CodeableConcept).valueCodeableConcept.text` | string | No | A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Coding).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Coding).valueCoding` | object | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Coding).valueCoding.system` | string | No | The identification of the code system that defines the meaning of the symbol in the code. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Coding).valueCoding.code` | string | No | A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (HumanName).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (HumanName).valueHumanName` | object | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (HumanName).valueHumanName.use` | string | No | Identifies the purpose for this name. Possible values: usual, official, temp, nickname, anonymous, old, maiden |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (HumanName).valueHumanName.family` | string | No | The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (HumanName).valueHumanName.given` | Array of string | No | Given name. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Reference).url` | string | Yes | Source of the definition for the extension code - a logical name or a URL. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Reference).valueReference` | object | No | A single value for the extension. |
| `entry[] (DeviceUseStatement).resource.identifier[].extension[] (Reference).valueReference.reference` | string | No | A reference to another resource. This is typically either a relative reference which includes the resource type and ID, or an internal reference which starts with `#` and refers to a contained resource. |
| `entry[] (DeviceUseStatement).resource.identifier[].use` | string | No | The purpose of this identifier. Possible values: usual, official, temp, secondary, old (If known) |
| `entry[] (DeviceUseStatement).resource.identifier[].system` | string | No | Establishes the namespace for the value - that is, a URL that describes a set values that are unique. |
| `entry[] (DeviceUseStatement).resource.identifier[].value` | string | No | The portion of the identifier typically relevant to the user and which is unique within the context of the system. |
| `entry[] (DeviceUseStatement).resource.basedOn` | Array of object | No | A plan, proposal or order that is fulfilled in whole or in part by this DeviceUseStatement. Must be a resource of type `ServiceRequest`. |
| `entry[] (DeviceUseStatement).resource.basedOn[].reference` | string | No | A reference to another resource. This is typically either a relative reference which includes the resource type and ID, or an internal reference which starts with `#` and refers to a contained resource. |
| `entry[] (DeviceUseStatement).resource.recordedOn` | string | No | The time at which the statement was made/recorded. |
| `entry[] (DeviceUseStatement).resource.source` | object | No | Who reported the device was being used by the patient. Must reference one of the following types of resources: - `Patient` - `Practitioner` - `PractitionerRole` - `RelatedPerson` |
| `entry[] (DeviceUseStatement).resource.source.reference` | string | No | A reference to another resource. This is typically either a relative reference which includes the resource type and ID, or an internal reference which starts with `#` and refers to a contained resource. |
| `entry[] (DeviceUseStatement).resource.reasonCode` | Array of object | No | Reason or justification for the use of the device. |
| `entry[] (DeviceUseStatement).resource.reasonCode[].coding` | Array of object | No | A reference to a code defined by a terminology system. |
| `entry[] (DeviceUseStatement).resource.reasonCode[].coding[].system` | string | No | The identification of the code system that defines the meaning of the symbol in the code. |
| `entry[] (DeviceUseStatement).resource.reasonCode[].coding[].code` | string | No | A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). |
| `entry[] (DeviceUseStatement).resource.reasonCode[].text` | string | No | A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. |
| `entry[] (DeviceUseStatement).resource.bodySite` | object | No | Indicates the anotomic location on the subject's body where the device was used ( i.e. the target). |
| `entry[] (DeviceUseStatement).resource.bodySite.coding` | Array of object | No | A reference to a code defined by a terminology system. |
| `entry[] (DeviceUseStatement).resource.bodySite.coding[].system` | string | No | The identification of the code system that defines the meaning of the symbol in the code. |
| `entry[] (DeviceUseStatement).resource.bodySite.coding[].code` | string | No | A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). |
| `entry[] (DeviceUseStatement).resource.bodySite.text` | string | No | A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user. |
| `entry[] (DeviceUseStatement).resource.note` | Array of object | No | Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement. |
| `entry[] (DeviceUseStatement).resource.note[].text` | string | Yes | The text of the annotation in markdown format. |
| `entry[] (DeviceUseStatement).resource.timingPeriod` | object | No | How often the device was used. Only one of `timingPeriod`, `timingDateTime` may be present. |
| `entry[] (DeviceUseStatement).resource.timingPeriod.start` | string | No | The start of the period. The boundary is inclusive. |
| `entry[] (DeviceUseStatement).resource.timingPeriod.end` | string | No | The end of the period. If the end of the period is missing, it means no end was known or planned at the time the instance was created. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time. |
| `entry[] (DeviceUseStatement).resource.timingDateTime` | string | No | How often the device was used. Only one of `timingPeriod`, `timingDateTime` may be present. |
| `entry[] (DeviceUseStatement).search` | object | Yes | Information about the search process that lead to the creation of this entry. |
| `entry[] (DeviceUseStatement).search.mode` | string | Yes | Identifies the DeviceUseStatement as matching the search parameters. Value: match |
| `entry[] (Other).search` | object | Yes | Information about the search process that lead to the creation of this entry. |
| `entry[] (Other).search.mode` | string | No | Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process. Possible values: match, include, outcome - why this is in the result set |

_Generated from the schema: the values are placeholders, not a real payload._

```json
{
  "resourceType": "Bundle",
  "type": "searchset",
  "total": 0,
  "entry": [
    {
      "resource": {
        "resourceType": "DeviceUseStatement",
        "id": "RedoxDeviceUseStatementExample",
        "status": "active",
        "subject": {
          "reference": "Patient/RedoxPatientExampleTimothy"
        },
        "device": {
          "reference": "Device/RedoxDeviceExample"
        },
        "timingPeriod": {
          "start": "2019-04-01T17:04:16.605Z"
        },
        "recordedOn": "2019-04-01T17:04:16.605Z",
        "bodySite": {
          "coding": [
            {
              "code": "89644007",
              "system": "http://snomed.info/sct",
              "display": "Left ear structure"
            }
          ],
          "text": "Left ear"
        }
      },
      "search": {
        "mode": "match"
      }
    }
  ]
}
```

### 400

Request could not be processed or failed validation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `resourceType` | string | Yes | Identifies the type of the resource. Value: OperationOutcome |
| `issue` | Array of object | Yes | A structured respresentation of the error that occurred |
| `issue[].severity` | string | Yes | Generally `error` or `fatal` Possible values: fatal, error, warning, information |
| `issue[].code` | string | Yes | A FHIR category code that describes the general type of issue. See http://hl7.org/fhir/ValueSet/issue-type for details |
| `issue[].id` | string | No | If the error occurs in the RedoxEngine, this corresponds to an Error record in the organization. |
| `issue[].details` | object | No | Additional details about the error. This may be a text description of the error or a system code that identifies the error. |
| `issue[].details.coding` | Array of object | No | A more granular FHIR code for the specific error. Typically from http://hl7.org/fhir/ValueSet/operation-outcome |
| `issue[].details.coding[].system` | string | No | The identification of the code system that defines the meaning of the symbol in the code. |
| `issue[].details.coding[].code` | string | No | A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination). |
| `issue[].details.text` | string | No | A human-readable interpretation of the issue code |
| `issue[].diagnostics` | string | No | Additional diagnostic information about the issue. |

```json
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "fatal",
      "code": "invalid",
      "details": {
        "coding": [
          {
            "code": "MSG_BAD_SYNTAX",
            "system": "http://terminology.hl7.org/CodeSystem/operation-outcome"
          }
        ],
        "text": "Invalid content found in request body."
      }
    }
  ]
}
```

### 401

Authorization is required

Same fields as 400.

```json
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "fatal",
      "code": "unknown",
      "details": {
        "coding": [
          {
            "code": "MSG_AUTH_REQUIRED",
            "system": "http://terminology.hl7.org/CodeSystem/operation-outcome"
          }
        ],
        "text": "Invalid authorization token"
      }
    }
  ]
}
```

### 500

Internal server error

Same fields as 400.

```json
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "fatal",
      "code": "processing",
      "details": {
        "coding": [
          {
            "code": "MSG_RESOURCE_ID_FAIL",
            "system": "http://terminology.hl7.org/CodeSystem/operation-outcome"
          }
        ],
        "text": "Unable to allocate resource id."
      }
    }
  ]
}
```

### 503

Service unavailable

Same fields as 400.

```json
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "fatal",
      "code": "transient",
      "details": {
        "text": "System is unable to process this message at this time."
      }
    }
  ]
}
```
