# Maintain your Redox repository for Carequality

> **Who can use this how-to**
>
> - Existing customers using Network Onramps

All Carequality participants—including those who join via Redox—must respond to requests they receive from other Carequality participants. In some cases, you may receive up to 200K requests per day. 

With Redox as your Carequality responder, we can respond to incoming patient requests on your behalf. But you must push patient records and documents to your Redox repository so that we can maintain an accurate representation of each of your patients.

> **For direct responders**
>
> If you are your own responder, you must build an infrastructure capable of supporting a large volume of incoming requests. And you must still maintain your own patient and document database so that you can respond to incoming requests with the most accurate data. 

> **Use curl for technical validation**
>
> You can copy our code examples and send the test requests with `curl` ([learn more about curl](https://curl.haxx.se/docs/manpage.html)) instead of Postman. If you do, remember to:
>
> - Replace any variables with your specific data (e.g., your organization's OID) before sending the request. 
>   - `$VARIABLE`: An environment variable you can set in your terminal before running the command.
>   - `{{variable here}}`: A placeholder for your specific data. 
> - Add the `source-id` if you have multiple sources. We don’t include `{{source-id}}` in the code examples, so you’ll have to add them yourself. [Learn about including source details](/basics/data-exchange-with-redox/Managing-source-details-in-outgoing-requests).
> - Make sure you have a full request for your own use since some of the code examples are abbreviated.
>
> Check out these troubleshooting guides if you run into errors:
>
> - [Troubleshoot Carequality errors](/troubleshooting/troubleshoot-carequality-interoperability-framework-errors)
> - [Troubleshoot OAuth API key errors](/troubleshooting/troubleshoot-oauth-api-key-errors)

## Maintain your patient database

As you create and update patient records in your system, you must make sure that they stay current in your data on demand repository. 

> **API reference**
>
> [Review the PatientAdmin data model](https://docs.redoxengine.com/permalink/patient-admin-patient-update) schema for full requirements.

### Create a new patient record

Send a `PatientAdmin.NewPatient` request with the new patient’s details:

- For production queries, set the `Test` value to `false`.
- The destination ID should be the one provided by Redox for your data on demand repository. 
- For `PatientIdentifiers.ID`, use the MRN or primary ID of the patient in your system. 
- For `PatientIdentifiers.IDType`, use the value Redox provides. Typically, this means mapping a value like MR to this OID. This OID is linked to the data on demand repository and is required to associate the patient.
- For supported patient demographics, [review the PatientAdmin schema](https://docs.redoxengine.com/permalink/patient-admin-new-patient). The values below are examples only and should change for your individual queries. 

**Example: Create a new patient in Carequality**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
    "Meta": {
        "Extensions": {
            "sender-organization-id": {
                "url": "https://api.redoxengine.com/extensions/sender-organization-id",
                "string": "{{ORGANIZATION-OID}}"
            },
            "user-id": {
                "url": "https://api.redoxengine.com/extensions/user-id",
                "string": "{{SENDING-USER-NAME}}"
            },
            "user-role": {
                "url": "https://api.redoxengine.com/extensions/user-role",
                // The role of the user identified above. This must be a SNOMED CT code.
                "coding": {
                    "code": "112247003",
                    "display": "Medical Doctor"
                }
            },
            "purpose-of-use": {
                "url": "https://api.redoxengine.com/extensions/purpose-of-use",
                "coding": {
                    "code": "TREATMENT",
                    "display": "Treatment"
                }
            }
        },
        "DataModel": "PatientAdmin",
        "EventType": "NewPatient",
        "Test": true,
        "Destinations": [
            {
                "ID": "{{DATA-ON-DEMAND-REPOSITORY-ID}}"
            }
        ]
    },
    "Patient": {
        "Identifiers": [
            {
                "ID": "1234",
                "IDType": "MR"
            }
        ],
        "Demographics": {
            "FirstName": "Timothy",
            "MiddleName": "Paul",
            "LastName": "Bixby",
            "DOB": "2008-01-06",
            "SSN": "101-01-0001",
            "Sex": "Male",
            "Race": "White",
            "IsHispanic": null,
            "MaritalStatus": "Married",
            "IsDeceased": null,
            "DeathDateTime": null,
            "PhoneNumber": {
                "Home": "+18088675301",
                "Office": null,
                "Mobile": null
            },
            "EmailAddresses": [],
            "Language": "en",
            "Citizenship": [],
            "Address": {
                "StreetAddress": "4762 Hickory Street",
                "City": "Monroe",
                "State": "WI",
                "ZIP": "53566",
                "County": "Green",
                "Country": "US"
            }
        },
        "Notes": [],
        "Contacts": [
            {
                "FirstName": "Barbara",
                "MiddleName": null,
                "LastName": "Bixby",
                "Address": {
                    "StreetAddress": "4762 Hickory Street",
                    "City": "Monroe",
                    "State": "WI",
                    "ZIP": "53566",
                    "County": "Green",
                    "Country": "US"
                },
                "PhoneNumber": {
                    "Home": "+18088675303",
                    "Office": "+17077543758",
                    "Mobile": "+19189368865"
                },
                "RelationToPatient": "Mother",
                "EmailAddresses": [
                    "barb.bixby@test.net"
                ],
                "Roles": [
                    "Emergency Contact"
                ]
            }
        ],
        "Allergies": [
            {
                "Code": "7982",
                "Codeset": "RxNorm",
                "Name": "Penicillin",
                "Type": {
                    "Code": null,
                    "Codeset": null,
                    "Name": null
                },
                "OnsetDateTime": null,
                "Reaction": [
                    {
                        "Code": "28926001",
                        "Codeset": "SNOMED CT",
                        "Name": "Rash"
                    },
                    {
                        "Code": "247472004",
                        "Codeset": "SNOMED CT",
                        "Name": "Hives"
                    }
                ],
                "Severity": {
                    "Code": null,
                    "Codeset": null,
                    "Name": null
                },
                "Status": null
            }
        ],
        "PCP": {
            "NPI": "4356789876",
            "ID": "4356789876",
            "IDType": "NPI",
            "FirstName": "Pat",
            "LastName": "Granite",
            "Credentials": [
                "MD"
            ],
            "Address": {
                "StreetAddress": "123 Main St.",
                "City": "Madison",
                "State": "WI",
                "ZIP": "53703",
                "County": "Dane",
                "Country": "USA"
            },
            "EmailAddresses": [],
            "PhoneNumber": {
                "Office": "+16085551234"
            },
            "Location": {
                "Type": null,
                "Facility": null,
                "Department": null,
                "Room": null
            }
        },
        "Guarantor": {
            "Number": "10001910",
            "FirstName": "Kent",
            "MiddleName": null,
            "LastName": "Bixby",
            "SSN": null,
            "DOB": null,
            "Sex": null,
            "Spouse": {
                "FirstName": "Barbara",
                "LastName": "Bixby"
            },
            "Address": {
                "StreetAddress": "4762 Hickory Street",
                "City": "Monroe",
                "State": "WI",
                "ZIP": "53566",
                "County": "Green",
                "Country": "USA"
            },
            "PhoneNumber": {
                "Home": null,
                "Business": null,
                "Mobile": null
            },
            "EmailAddresses": [],
            "Type": null,
            "RelationToPatient": "Father",
            "Employer": {
                "Name": "Accelerator Labs",
                "Address": {
                    "StreetAddress": "1456 Old Sauk Road",
                    "City": "Madison",
                    "State": "WI",
                    "ZIP": "53719",
                    "County": "Dane",
                    "Country": "USA"
                },
                "PhoneNumber": "+18083451121"
            }
        },
        "Insurances": [
            {
                "Plan": {
                    "ID": "31572",
                    "IDType": "Payor ID",
                    "Name": "HMO Deductable Plan",
                    "Type": null
                },
                "MemberNumber": null,
                "Company": {
                    "ID": "60054",
                    "IDType": null,
                    "Name": "aetna (60054 0131)",
                    "Address": {
                        "StreetAddress": "PO Box 14080",
                        "City": "Lexington",
                        "State": "KY",
                        "ZIP": "40512-4079",
                        "County": "Fayette",
                        "Country": "US"
                    },
                    "PhoneNumber": "+18089541123"
                },
                "GroupNumber": "847025-024-0009",
                "GroupName": "Accelerator Labs",
                "EffectiveDate": "2015-01-01",
                "ExpirationDate": "2020-12-31",
                "PolicyNumber": "9140860055",
                "AgreementType": null,
                "CoverageType": null,
                "Insured": {
                    "Identifiers": [],
                    "LastName": null,
                    "MiddleName": null,
                    "FirstName": null,
                    "SSN": null,
                    "Relationship": null,
                    "DOB": null,
                    "Sex": null,
                    "Address": {
                        "StreetAddress": null,
                        "City": null,
                        "State": null,
                        "ZIP": null,
                        "County": null,
                        "Country": null
                    }
                }
            }
        ]
    }
}
```

### Update an existing patient record

Send a `PatientAdmin.PatientUpdate` request with the updated details:

- For production queries, set the `Test` value to `false`.
- The destination ID should be the one provided by Redox for your data on demand repository. 
- For `PatientIdentifiers.ID`, use the MRN or primary ID of the patient in your system. 
- For `PatientIdentifiers.IDType`, use the value Redox provides. Typically, this means mapping a value like MR to this OID. This OID is linked to the data on demand repository and is required to associate the patient.
- For supported patient demographics, [review the PatientAdmin schema](https://docs.redoxengine.com/permalink/patient-admin-patient-update). The values below are examples only and should change for your individual queries. 

**Example: Update an existing patient in Carequality**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
    "Meta": {
        "Extensions": {
            "sender-organization-id": {
                "url": "https://api.redoxengine.com/extensions/sender-organization-id",
                "string": "{{ORGANIZATION-OID}}"
            },
            "user-id": {
                "url": "https://api.redoxengine.com/extensions/user-id",
                "string": "{{SENDING-USER-NAME}}"
            },
            "user-role": {
                "url": "https://api.redoxengine.com/extensions/user-role",
                "coding": {
                    "code": "112247003",
                    "display": "Medical Doctor"
                }
            },
            "purpose-of-use": {
                "url": "https://api.redoxengine.com/extensions/purpose-of-use",
                "coding": {
                    "code": "TREATMENT",
                    "display": "Treatment"
                }
            }
        },
        "DataModel": "PatientAdmin",
        "EventType": "PatientUpdate",
        "Test": true,
        "Destinations": [
            {
                "ID": "{{DATA-ON-DEMAND-REPOSITORY-ID}}"
            }
        ]
    },
    "Patient": {
        "Identifiers": [
            {
                "ID": "1234",
                "IDType": "MR"
            }
        ],
        "Demographics": {
            "FirstName": "Timothy",
            "MiddleName": "Paul",
            "LastName": "Bixby",
            "DOB": "2008-01-06",
            "SSN": "101-01-0001",
            "Sex": "Male",
            "Race": "White",
            "IsHispanic": null,
            "MaritalStatus": "Married",
            "IsDeceased": null,
            "DeathDateTime": null,
            "PhoneNumber": {
                "Home": "+18088675301",
                "Office": null,
                "Mobile": null
            },
            "EmailAddresses": [],
            "Language": "en",
            "Citizenship": [],
            "Address": {
                "StreetAddress": "4435 Victoria Ln",
                "City": "Madison",
                "State": "WI",
                "ZIP": "53719",
                "County": "Dane",
                "Country": "US"
            }
        },
        "Notes": [],
        "Contacts": [
            {
                "FirstName": "Barbara",
                "MiddleName": null,
                "LastName": "Bixby",
                "Address": {
                    "StreetAddress": "4762 Hickory Street",
                    "City": "Monroe",
                    "State": "WI",
                    "ZIP": "53566",
                    "County": "Green",
                    "Country": "US"
                },
                "PhoneNumber": {
                    "Home": "+18088675303",
                    "Office": "+17077543758",
                    "Mobile": "+19189368865"
                },
                "RelationToPatient": "Mother",
                "EmailAddresses": [
                    "barb.bixby@test.net"
                ],
                "Roles": [
                    "Emergency Contact"
                ]
            }
        ],
        "Diagnoses": [
            {
                "Code": "R07.0",
                "Codeset": "ICD-10",
                "Name": "Pain in throat",
                "Type": null,
                "DocumentedDateTime": null
            }
        ],
        "Allergies": [
            {
                "Code": "7982",
                "Codeset": "RxNorm",
                "Name": "Penicillin",
                "Type": {
                    "Code": null,
                    "Codeset": null,
                    "Name": null
                },
                "OnsetDateTime": null,
                "Reaction": [
                    {
                        "Code": "28926001",
                        "Codeset": "SNOMED CT",
                        "Name": "Rash"
                    },
                    {
                        "Code": "247472004",
                        "Codeset": "SNOMED CT",
                        "Name": "Hives"
                    }
                ],
                "Severity": {
                    "Code": null,
                    "Codeset": null,
                    "Name": null
                },
                "Status": null
            }
        ],
        "PCP": {
            "NPI": "4356789876",
            "ID": "4356789876",
            "IDType": "NPI",
            "FirstName": "Pat",
            "LastName": "Granite",
            "Credentials": [
                "MD"
            ],
            "Address": {
                "StreetAddress": "123 Main St.",
                "City": "Madison",
                "State": "WI",
                "ZIP": "53703",
                "County": "Dane",
                "Country": "USA"
            },
            "EmailAddresses": [],
            "PhoneNumber": {
                "Office": "+16085551234"
            },
            "Location": {
                "Type": null,
                "Facility": null,
                "Department": null,
                "Room": null
            }
        },
        "Insurances": [
            {
                "Plan": {
                    "ID": "31572",
                    "IDType": "Payor ID",
                    "Name": "HMO Deductable Plan",
                    "Type": null
                },
                "MemberNumber": null,
                "Company": {
                    "ID": "60054",
                    "IDType": null,
                    "Name": "aetna (60054 0131)",
                    "Address": {
                        "StreetAddress": "PO Box 14080",
                        "City": "Lexington",
                        "State": "KY",
                        "ZIP": "40512-4079",
                        "County": "Fayette",
                        "Country": "US"
                    },
                    "PhoneNumber": "+18089541123"
                },
                "GroupNumber": "847025-024-0009",
                "GroupName": "Accelerator Labs",
                "EffectiveDate": "2015-01-01",
                "ExpirationDate": "2020-12-31",
                "PolicyNumber": "9140860055",
                "AgreementType": null,
                "CoverageType": null,
                "Insured": {
                    "Identifiers": [],
                    "LastName": null,
                    "MiddleName": null,
                    "FirstName": null,
                    "SSN": null,
                    "Relationship": null,
                    "DOB": null,
                    "Sex": null,
                    "Address": {
                        "StreetAddress": null,
                        "City": null,
                        "State": null,
                        "ZIP": null,
                        "County": null,
                        "Country": null
                    }
                }
            }
        ],
        "Guarantor": {
            "Number": "10001910",
            "FirstName": "Kent",
            "MiddleName": null,
            "LastName": "Bixby",
            "SSN": null,
            "DOB": null,
            "Sex": null,
            "Spouse": {
                "FirstName": "Barbara",
                "LastName": "Bixby"
            },
            "Address": {
                "StreetAddress": "4762 Hickory Street",
                "City": "Monroe",
                "State": "WI",
                "ZIP": "53566",
                "County": "Green",
                "Country": "USA"
            },
            "PhoneNumber": {
                "Home": null,
                "Business": null,
                "Mobile": null
            },
            "EmailAddresses": [],
            "Type": null,
            "RelationToPatient": "Father",
            "Employer": {
                "Name": "Accelerator Labs",
                "Address": {
                    "StreetAddress": "1456 Old Sauk Road",
                    "City": "Madison",
                    "State": "WI",
                    "ZIP": "53719",
                    "County": "Dane",
                    "Country": "USA"
                },
                "PhoneNumber": "+18083451121"
            }
        }
    }
}
```

### Merge duplicate patient records

Send a `PatientAdmin.PatientMerge` request to merge the patient records in your data on demand repository and replace the previous identifiers with the new one.

- For production queries, set the `Test` value to `false`.
- The destination ID should be the one provided by Redox for your data on demand repository. 
- For `PatientIdentifiers.ID`, include a new MRN or primary ID of the patient in your system. Also use the corresponding `PatientIdentifiers.IDType`.
- For `PreviousIdentifiers`, include the the former patient ID and ID type values for the duplicate records. 
- For supported patient demographics, [review the PatientAdmin schema](https://docs.redoxengine.com/permalink/patient-admin-patient-merge). The values below are examples only and should change for your individual queries. 

**Example: Merge patient records in Carequality**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
    "Meta": {
        "Extensions": {
            "sender-organization-id": {
                "url": "https://api.redoxengine.com/extensions/sender-organization-id",
                "string": "{{ORGANIZATION-OID}}"
            },
            "user-id": {
                "url": "https://api.redoxengine.com/extensions/user-id",
                "string": "{{SENDING-USER-NAME}}"
            },
            "user-role": {
                "url": "https://api.redoxengine.com/extensions/user-role",
                "coding": {
                    "code": "112247003",
                    "display": "Medical Doctor"
                }
            },
            "purpose-of-use": {
                "url": "https://api.redoxengine.com/extensions/purpose-of-use",
                "coding": {
                    "code": "TREATMENT",
                    "display": "Treatment"
                }
            }
        },        
        "DataModel": "PatientAdmin",
        "EventType": "PatientMerge",
        "Test": true,
        "Destinations": [
            {
                "ID": "{{DATA-ON-DEMAND-REPOSITORY-ID}}"
            }
        ]
    },
    "Patient": {
        "Identifiers": [
            {
                "ID": "1235",
                "IDType": "MR"
            }
        ],
        "PreviousIdentifiers": [
            {
                "ID": "1234",
                "IDType": "MR"
            }
        ],
        "Demographics": {
            "FirstName": "Timothy",
            "MiddleName": "Paul",
            "LastName": "Bixby",
            "DOB": "2008-01-06",
            "SSN": "101-01-0001",
            "Sex": "Male",
            "Race": "White",
            "IsHispanic": null,
            "MaritalStatus": "Married",
            "IsDeceased": null,
            "DeathDateTime": null,
            "PhoneNumber": {
                "Home": "+18088675301",
                "Office": null,
                "Mobile": null
            },
            "EmailAddresses": [],
            "Language": "en",
            "Citizenship": [],
            "Address": {
                "StreetAddress": "4762 Hickory Street",
                "City": "Monroe",
                "State": "WI",
                "ZIP": "53566",
                "County": "Green",
                "Country": "US"
            }
        },
        "Notes": []
    }
}
```

## Save patient documents

> **Rules for returned data**
>
> As a clinical network participant, you must include certain data when you're returning data to the network. [Check out the rules for returned data](https://docs.redoxengine.com/permalink/1ldmpAmaxAriJ7Ei0zYn3Q/#what-data-is-exchanged). 

After providing care for a patient, save the patient summary documents to your data on demand repository so that we can respond to requests for documents. 

We recommend using the `ClinicalSummary.VisitPush` request with all the available unique clinical information that you produce. 

Be mindful of these requirements and best practices:

| **Field** | **Notes** |
| --- | --- |
| `Header.Patient.Identifiers[].IDType` | At least one patient identifier should include an ID Type that matches the patient identification OID used in the `PatientAdmin` messages. |
| `Header.Document.ID` | This ID must be globally unique across Carequality as either a GUID or an internally unique ID prefixed with your organizational OID.  Our examples use the OID prefix. |
| `Header.Document.Type` `Header.Document.TypeCode` | These values should be a LOINC code. Typically, you should use the code for a Continuity of Care Document (i.e., `34133-9`).  When sending a document related to a single patient visit, you should use these codes:  Use Progress Notes (i.e., `11506-3`) for outpatient/ambulatory visits. Use discharge summary (i.e., `18842-5`) for inpatient/hospital visits. |
| `Header.Document.Custodian.Name` | We recommend populating this value since it tells other Carequality participants where the data came from.  If this field isn’t populated, the value defaults to the `Meta.Source.Name`, which is set based on the source you’re sending the request from.  We encourage you to populate as much of the `Header.Document.Custodian.Name` object as possible. Most entries use the same data as their directory, but you may want more or less granularity. |
| `Documents[].Author.Location` | Some external systems use this to display the location the document originated from when viewing a list documents. When looking at an individual document, `Custodian.Name` is typically used instead.  Typically, the `Author` and `Custodian` values are the same, but they may differ. If not supplied, Redox sets this to the directory entry name you’ve saved to Carequality. See the difference between [Author](https://build.fhir.org/ig/HL7/CDA-core-2.0/StructureDefinition-Author.html) and [Custodian](https://build.fhir.org/ig/HL7/CDA-core-2.0/StructureDefinition-Custodian.html). |

> **API reference**
>
> [Review the Clinical Summary data model](https://docs.redoxengine.com/permalink/clinical-summary) schema for more technical details.

Since `ClinicalSummary.VisitPush` is lengthy, we include an abbreviated example below. [Check out an unabbreviated example](https://docs.redoxengine.com/permalink/clinical-summary-visit-push) or view the Postman package.

**Example: Save a patient document (abbreviated)**

```bash
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
    "Meta": {
        "DataModel": "Clinical Summary",
        "EventType": "VisitPush",
        "Test": true,
        "Destinations": [
            {
                "ID": "{{DATA-ON-DEMAND-REPOSITORY-ID}}"
            }
        ]
    },
    "Header": {
        "DirectAddressFrom": null,
        "DirectAddressTo": null,
        "Document": {
            "Author": {
                "ID": "4356789876",
                "IDType": "NPI",
                "Type": null,
                "FirstName": "Pat",
                "LastName": "Granite",
                "Credentials": [
                    "MD"
                ],
                "Address": {
                    "StreetAddress": "123 Main St.",
                    "City": "Madison",
                    "State": "WI",
                    "ZIP": "53703",
                    "County": "Dane",
                    "Country": "USA"
                },
                "EmailAddresses": [],
                "PhoneNumber": {
                    "Office": "+16085551234"
                },
                "Location": { ...
                }
            },
            "ID": "{{REDOX-PARENT-OID}}^67890",
            "Locale": "US",
            "Title": "Community Health and Hospitals: Annual Physical",
            "DateTime": "2012-09-12T00:00:00.000Z",
            "Type": "Progress Note",
            "TypeCode": {
                "Code": "11506-3",
                "CodeSystem": "2.16.840.1.113883.6.1",
                "CodeSystemName": "LOINC",
                "Name": "Progress Note"
            },
            "Visit": {
                "Location": {
                    "Type": "Outpatient Clinic",
                    "Facility": "RHS Vista Oaks Clinic",
                    "Department": "Vista Oaks Clinic",
                    "Room": null
                },
                "StartDateTime": "2020-11-12T00:18:30.592Z",
                "EndDateTime": "2020-11-12T00:18:30.592Z",
                "Reason": "Annual Physical",
                "VisitNumber": "30311442"
            }
        },
        "Patient": {
            "Identifiers": [
                {
                    "ID": "1234",
                    "IDType": "MR"
                }
            ],
            "FirstName": "Timothy",
            "MiddleName": "Paul",
            "LastName": "Bixby",
            "DOB": "2008-01-06",
            "SSN": "101-01-0001",
            "Sex": "Male",
            "Race": "White",
            "IsHispanic": null,
            "MaritalStatus": "Married",
            "IsDeceased": null,
            "DeathDateTime": null,
            "PhoneNumber": {
                "Home": "+18088675301",
            },
            "EmailAddresses": [],
            "Language": "en",
            "Citizenship": [],
            "Address": {
                "StreetAddress": "4762 Hickory Street",
                "City": "Monroe",
                "State": "WI",
                "ZIP": "53566",
                "County": "Green",
                "Country": "US"
            }
        },
        "PCP": { ...
        }
    },
    "AdvanceDirectivesText": "
Directive	Description	Verification	Supporting Document(s)
Resuscitation status	Do not resuscitate	Dr. Robert Dolin, Nov 07, 1999	Advance directive
",
    "AdvanceDirectives": [
        {
            "Type": {
                "Code": "304251008",
                "CodeSystem": "2.16.840.1.113883.6.96",
                "CodeSystemName": "SNOMED CT",
                "Name": "Resuscitation",
                "AltCodes": []
            },
            "Code": "304253006",
            "CodeSystem": "2.16.840.1.113883.6.96",
            "CodeSystemName": "SNOMED CT",
            "Name": "Do not resuscitate",
            "AltCodes": [],
            "StartDate": "2011-02-13T05:00:00.000Z",
            "EndDate": null,
            "ExternalReference": "AdvanceDirective.b50b7910-7ffb-4f4c-bbe4-177ed68cbbf3.pdf",
            "VerifiedBy": [
                {
                    "FirstName": "Robert",
                    "LastName": "Dolin",
                    "Credentials": "Dr.",
                    "DateTime": null
                }
            ],
            "Custodians": [
                {
                    "FirstName": "Robert",
                    "LastName": "Dolin",
                    "Credentials": "Dr.",
                    "Address": { ...
                    }
                }
            ]
        }
    ],
    "AllergyText": "
Substance	Reaction	Severity	Status
Penicillin G benzathine	Hives	Moderate to severe	Inactive
Codeine	Shortness of Breath	Moderate	Active
Aspirin	Hives	Mild to moderate	Active
",
    "Allergies": [ ...
            ] ...
        }
    ],
    "AssessmentText": "Recurrent GI bleed of unknown etiology; hypotension perhaps secondary to this but as likely secondary to polypharmacy.Acute on chronic anemia secondary to #1.Azotemia, acute renal failure with volume loss secondary to #1.Hyperkalemia secondary to #3 and on ACE and K+ supplement.Other chronic diagnoses as noted above, currently stable.Also, this person has back problems.",
    "Assessment": {
        "Diagnoses": [
            {
                "Value": "Displacement of lumbar intervertebral disc without myelopathy",
                "DateTime": "2009-11-01T05:00:00.000Z",
                "IsNegativeIndicator": false,
                "Codes": [
                    {
                        "Code": "202708005",
                        "CodeSystem": "2.16.840.1.113883.6.96",
                        "CodeSystemName": "SNOMED-CT",
                        "Name": "Herniated lumbar intervertebral disc"
                    }, 
                    { ...
                    }
                ]
            },
            {
                "Value": "Thoracic or lumbosacral neuritis or radiculitis, unspecified",
                "DateTime": "2009-11-01T05:00:00.000Z",
                "IsNegativeIndicator": false,
                "Codes": [
                    {
                        "Code": "M54.16",
                        "CodeSystem": "2.16.840.1.113883.6.90",
                        "CodeSystemName": "ICD-10",
                        "Name": "Right lumbar radiculopathy"
                    }
                ]
            }
        ]
    },
    "ChiefComplaintText": "Dark stools.",
    "EncountersText": "
Encounter	Performer	Location	Date
Pnuemonia	Dr Henry Seven	Community Health and Hospitals	20120806
",
    "Encounters": [
        {
            "Identifiers": [
                {
                    "ID": "2376492",
                    "IDType": "URMC Epic CSN"
                }, ...
            ],
            "Type": {
                "Code": "99222",
                "CodeSystem": "2.16.840.1.113883.6.12",
                "CodeSystemName": "CPT",
                "Name": "InPatient Admission",
                "AltCodes": []
            },
            "DateTime": "2012-08-06T04:00:00.000Z",
            "EndDateTime": null,
            "Providers": [ ...
            ],
            "Diagnosis": [
                {
                    "Code": "233604007",
                    "CodeSystem": "2.16.840.1.113883.6.96",
                    "CodeSystemName": "SNOMED CT",
                    "Name": "Pneumonia",
                    "AltCodes": []
                }
            ],
            "ReasonForVisit": [
                {
                    "Code": "233604007",
                    "CodeSystem": "2.16.840.1.113883.6.96",
                    "CodeSystemName": "SNOMED CT",
                    "Name": "Pneumonia",
                    "AltCodes": []
                }
            ]
        }
    ], 
    "FamilyHistoryText": "Father (deceased)
Diagnosis	Age At Onset
Myocardial Infarction (cause of death)	57
Diabetes	40
",
    "FamilyHistory": [ ...
     ],
    "HistoryOfPresentIllnessText": "Kelp, Lonnie Ray Sr., MD PHD - 10/21/2014 8:07 PM PSTDate: 10/21/2014

Pre-procedure diagnosis: L5 S1 Acute Lumbar Radiculopathy (Right)

Post-procedure diagnosis: Same

Procedure: 1) L5S1 Transforaminal Epidural Steroid injection(Right)
2) Fluoroscopic Guidance for needle placement

Complications: None

CONSENT: Today's procedure, its potential benefits as well as its risks and potential side effects were reviewed. Discussed risks of the procedure include bleeding, infection, nerve irritation or damage, reactions to the medications, headache, failure of the pain to improve, and exacerbation of the pain were explained to the patient, who verbalized understanding and who wished to proceed. Informed consent was signed.

DESCRIPTION OF PROCEDURES: After written informed consent was obtained, the patient was taken to the fluoroscopy suite. Anatomical landmarks were identified by way of fluoroscopy in multiple views. Strict aseptic technique was utilized.

A 22-gauge 3-1/2-inch needle was then incrementally advanced using multiple fluoroscopic views from an oblique approach into the Right L5S1 lumbar intervertebral space. Both AP and lateral views were used to confirm final needle placement. After negative aspiration, Omniopaque 240 contrast was injected which delineated epidural without vascular flow and a normal epidurogram under fluoroscopy in the lateral and AP view. After negative aspiration was reconfirmed, a 1.0 mL of 0.25% Bupivicaine and 1mL of 40 mg/mL of Kenalog was slowly injected into the epidural space.

All needles were removed intact. Hemostasis was maintained. There were no complications. The area was cleaned and a Band-Aid placed as necessary. The patient tolerated the procedure well and all needles were removed intact. After a period of observation, the patient was noted to be hemodynamically stable and neurovascularly intact following the procedure as prior to the procedure, and was ultimately discharged to home with supervision in good condition. The patient was instructed to schedule an appointment in the office within 2 weeks.
Lonnie Ray Kelp Sr., MD PHD

",
    "ImmunizationText": "
Vaccine	Date	Status
Influenza virus vaccine, IM	May 2012	Completed
Tetanus and diphtheria toxoids, IM	Apr 2012	Completed
",
    "Immunizations": [ ...
    ],
    "InstructionsText": "Please carefully follow the subsequent instructions and patient education:

FlossBrush teeth twice daily

Scarf tying instructions may be found online.",
    "InsurancesText": null,
    "Insurances": [
        {
            "Plan": { ...
            }
        }
    ],
    "InterventionsText": "Patient practiced use of novel prosthesis including movements formerly neglected including distal extension and retroflexive hyperextension.",
    "MedicalEquipmentText": "
Supply/Device	Date Supplied
Automatic implantable cardioverter/defibrillator	Nov 1999
Total hip replacement prosthesis	1998
Wheelchair	1999
",
    "MedicalEquipment": [ ...
     ],
    "MedicationsText": "
Medication	Directions	Start Date	Status	Indications	Fill Instructions
Albuterol 0.09 MG/ACTUAT inhalant solution	0.09 MG/ACTUAT inhalant solution, 2 puffs once	20120806	Active	Pneumonia (233604007 SNOMED CT)	Generic Substitition Allowed
",
    "Medications": [ ...
     ],
    "MedicationsAdministeredText": "
Medication	Start Date	Status
Albuterol 0.09 MG/ACTUAT inhalant solution	0.09 MG/ACTUAT inhalant solution, 2 puffs once	20120806	Active
",
    "MedicationsAdministered": [ ...
    ],
    "ObjectiveText": "Chest: clear to ausc. No rales, normal breath soundsHeart: RR, PMI in normal location and no heave or evidence ofcardiomegaly,normal heart sounds, no murm or gallop",
    "PhysicalExamText": "All examinations performed within normal limits.

WNL

Nothing to report here.",
    "PlanOfCareText": "
Planned Activity	Planned Date
Consultation with Dr George Potomac for Asthma	20120820
Chest X-ray	20120826
Sputum Culture	20120820
",
    "PlanOfCare": { ...
    },
    "ProblemsText": "Pneumonia : Status - ResolvedAsthma : Status - Active",
    "Problems": [ ...
    ],
    "ProceduresText": "
Procedure	Date
Chest X-Ray	8/7/2012
",
    "Procedures": { ...
    },
    "ReasonForReferralText": "
Incoming Referral	Reason	Specialty	Diagnoses / Procedures	Referred By Contact	Referred To Contact
Consult, Test & Treat (Routine)		BA-Physical Medicine / Physical Medicine and Rehab	DiagnosesRadiculopathy, lumbar regionL5S1 TTRANSFORMINAL ESIL5S1 TTRANSFORMINAL ESIProceduresPR INJECT ANES/STEROID FORAMEN LUMBAR/SACRAL W IMG GUIDE ,1 LEVELINJECTION	Kelp, Lonnie Ray Sr., MD PHD	Kelp, Lonnie Ray Sr., MD PHD
",
    "ReasonForVisitText": "Light stools.",
    "ResultText": "
LABORATORY INFORMATION
Chemistries and drug levels
HGB (M 13-18 g/dl; F 12-16 g/dl)	13.2
WBC (4.3-10.8 10+3/ul)	6.7
PLT (135-145 meq/l)	123 (L)
",
    "Results": [ ...
    ],
    "ReviewOfSystemsText": "Patient denies recent history of fever or malaise. Positive for weakness and shortness of breath. One episode of melena. No recent headaches. Positive for osteoarthritis in hips, knees and hands.",
    "SocialHistoryText": "
Social History Element	Description	Effective Dates
smoking	Former Smoker (1 pack per day	20050501 to 20110227
smoking	Current Everyday Smoker 2 packs per day	20110227 - today
",
    "SocialHistory": { ...
    },
    "SubjectiveText": " Complaints of rectal bleeding, fatigue and a change in bowel patterns. Has several days of constipation alternating with diarrhea. ",
    "VitalSignsText": "
Date / Time: 	Nov 1, 2011	August 6, 2012
Height	69 inches	69 inches
Weight	189 lbs	194 lbs
Blood Pressure	132/86 mmHg	145/88 mmHg
",
    "VitalSigns": [ ...
    ]
}
```

## Manage patient consent

By default, we treat each patient as “consented” if their data is saved into a Redox repository. If a patient declines consent, however, you can send a `PatientAdmin.PatientUpdate` with the Consent extension ([learn about extensions](/api-reference/redox-data-model-api/extensions-for-data-models) or [review available Redox extensions](https://docs.redoxengine.com/datamodels/extensions/)). You can toggle the patient’s consent status to declined by sending an empty `codeableConcept` with the Consent extension. 

**Example: Declined patient consent in Consent extension **

```json
curl \
-X POST https://api.redoxengine.com/endpoint \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_TOKEN" \
-d '{
    "Meta": {
        "Extensions": {
            "sender-organization-id": {
                "url": "https://api.redoxengine.com/extensions/sender-organization-id",
                "string": "{{ORGANIZATION-OID}}"
            },
            "user-id": {
                "url": "https://api.redoxengine.com/extensions/user-id",
                "string": "{{SENDING-USER-NAME}}"
            },
            "user-role": {
                "url": "https://api.redoxengine.com/extensions/user-role",
                "coding": {
                    "code": "112247003",
                    "display": "Medical Doctor"
                }
            },
            "purpose-of-use": {
                "url": "https://api.redoxengine.com/extensions/purpose-of-use",
                "coding": {
                    "code": "TREATMENT",
                    "display": "Treatment"
                }
            }
        },
        "DataModel": "PatientAdmin",
        "EventType": "PatientUpdate",
        "Test": true,
        "Destinations": [
            {
                "ID": "{{DATA-ON-DEMAND-REPOSITORY-ID}}"
            }
        ]
    },
    "Patient": {
        "Identifiers": [
            {
                "ID": "1234",
                "IDType": "MR"
            }
        ],
        "Demographics": {
            {
            ...
            }
        },
        "Notes": [],
        "Contacts": [
            {
                ...
            }
        ],
        "Diagnoses": [
            {
                ...
            }
        ],
        "Allergies": [
            {
                ...
            }
        ],
        "PCP": {
            {
            ...
            }
        },
        "Insurances": [
            {
                ...
            }
        ],
        "Guarantor": {
            ...
        },
        "Extensions": {
           "consent-type": {
              "url": "https://api.redoxengine.com/extensions/consent-type",
              "codeableConcept": []
         },
       }
    }
}
```

> **API reference**
>
> [Review the PatientAdmin data model](https://docs.redoxengine.com/permalink/patient-admin-patient-update) schema for full requirements.

When a patient’s consent status changes, any of their existing data in the repository will no longer be returned in query responses.

To update a patient’s consent, you must send a `PatientAdmin.PatientUpdate` with `codeableConcept` populated as it is in the example below. This text toggles a patient’s consent status again so that data can be returned in query responses. 

**Example: Toggle a patient’s consent with the Consent extension **

```json
{
   "url": "https://api.redoxengine.com/extensions/consent-type",
   "codeableConcept": [
       {
            "text": "Treatment",
            "coding": [
                {
                    "system": "2.16.840.1.113883.3.18.7.1",
                    "code": "TREATMENT",
                    "display": "Treatment"
                }
            ]
        },
        {
            "text": "Request of the Individual",
            "coding": [
                {
                    "system": "2.16.840.1.113883.3.18.7.1",
                    "code": "REQUEST",
                    "display": "Request of the Individual"
                }
            ]
        },
    ]
}
```

> **Onramp to Carequality resources**
>
> **Basic information**
>
> - [Interact with clinical networks](/how-to-use-redox/interact-with-clinical-networks)
> - [Carequality identity and organization structure](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/carequality-identity-and-organization-structure)
> - [Carequality FAQ](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/carequality-interoperability-framework-faq)
> - [Carequality test patients](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/test-sandbox-for-onramp-to-Carequality) (contains patient data to use when testing)
>
> **How-to**
>
> - [Set up your onramp to Carequality](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/set-up-your-onramp-to-carequality)
> - [Create and maintain an organization record](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/create-a-carequality-organization-record)
> - [Search for patient records](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/search-for-patient-records)
> - [Request patient documents](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/request-patient-documents)
> - [Maintain your Redox repository](/how-to-use-redox/interact-with-clinical-networks/onramp-to-carequality/maintain-your-redox-repository-for-carequality)
>
> **Troubleshooting**
>
> - [Common Carequality errors](/troubleshooting/troubleshoot-carequality-interoperability-framework-errors)
