Encounter
Encounter is a FHIR resource that records an interaction between a patient and healthcare providers for the purpose of providing healthcare services or assessing the health status of a patient.
Encounters document the administrative and clinical details of a patient visit, including the type of visit, location, participating providers, diagnoses addressed, and the time period of care. They serve as the connective tissue linking clinical activities to the context in which they occurred.
Encounter data is available from health insurers (derived from claims), medical record systems (from provider EHRs), and nationwide exchanges (via TEFCA). The level of detail varies by source — claims-derived encounters are typically summarized, while provider-sourced encounters may include richer clinical context.
Flexpa makes encounter data available as FHIR resources conforming to the US Core STU 6.1 Encounter Profile to support communicating USCDI v3 data. Data types used in this reference are defined in the FHIR R4 Data Types specification.
FHIR API
https://api.flexpa.com/fhir/Encounter
Schema
The FHIR R4 Encounter resource represents an interaction between a patient and healthcare provider(s). The US Core Encounter Profile constrains this resource to ensure consistent representation across US healthcare systems.
Encounters are structured around the visit context: who was seen, where and when the visit occurred, what type of visit it was, and why the patient was seen. They often reference other resources like Condition for diagnoses and Practitioner for participating providers.
Elements
- metaMeta
Metadata about the resource. See also Tags defined by Flexpa.
- lastUpdatedinstant
The last time the encounter was updated in the Endpoint's system of record
- statuscode
The current status of the encounter
- Codes
plannedThe encounter is planned but has not yet startedarrivedThe patient has arrived but the encounter has not yet beguntriagedThe patient has been triagedin-progressThe encounter is currently in progressonleaveThe encounter has been paused (patient temporarily left)finishedThe encounter has ended normallycancelledThe encounter was cancelled before it startedentered-in-errorThe encounter was entered in errorunknownThe encounter status is not known - classCoding
Classification of patient encounter (e.g. ambulatory, emergency, inpatient)
- System
http://terminology.hl7.org/CodeSystem/v3-ActCodeHL7 ActCode system for encounter classificationCodesAMBAmbulatory - a patient encounter where the patient is not admitted to the facilityEMEREmergency - a patient encounter in an emergency departmentFLDField - a patient encounter that takes place in a location other than a healthcare facilityHHHome health - healthcare encounter at the patient's homeIMPInpatient encounter - a patient encounter where a patient is admitted to a facilityACUTEInpatient acute - an acute inpatient encounterNONACInpatient non-acute - a non-acute inpatient encounterOBSENCObservation encounter - an encounter where the patient is under observationPRENCPre-admission - a patient encounter before admission to a facilitySSShort stay - a patient encounter in a short stay facilityVRVirtual - a patient encounter via telehealth or other virtual means - typeCodeableConcept[]
Specific type of encounter (e.g. office visit, home health visit). Bound to the US Core Encounter Type value set (extensible).
- System
http://www.ama-assn.org/go/cptCPT codes are commonly used as encounter type codesExample Codes99213Office or other outpatient visit, established patient, low complexity99214Office or other outpatient visit, established patient, moderate complexity - System
http://snomed.info/sctSNOMED CT codes for encounter typesExample Codes185349003Encounter for check up308335008Patient encounter procedure - subjectReference(Patient)
Reference to the Patient present at the encounter
- participantBackboneElement[]
Providers involved in the encounter
- typeCodeableConcept[]
Role of participant in the encounter
- System
http://terminology.hl7.org/CodeSystem/v3-ParticipationTypeHL7 participation type codesCodesATNDAttender - the practitioner that has responsibility for overseeing a patient's careADMAdmitter - the practitioner who is responsible for admitting a patientDISDischarger - the practitioner who is responsible for the discharge of a patientCONConsultant - an advisor participating in the encounter by providing guidanceREFReferrer - the practitioner that referred the patient - periodPeriod
Period of time during the encounter that the participant was present
- individualReference(Practitioner|PractitionerRole)
Reference to the individual provider involved
- periodPeriod
The start and end time of the encounter
- startdateTime
Starting time with inclusive boundary
- enddateTime
End time with inclusive boundary, if the encounter has ended
- reasonCodeCodeableConcept[]
Coded reason the encounter takes place
- System
http://snomed.info/sctSNOMED CT codes for encounter reasonsExample Codes185349003Encounter for check up - System
http://hl7.org/fhir/sid/icd-10-cmICD-10-CM codes used as encounter reasonsExample CodesZ00.00Encounter for general adult medical examination without abnormal findings - reasonReferenceReference(Condition|Procedure|Observation)[]
Reference to reason the encounter takes place, such as a Condition, Procedure, or Observation
- diagnosisBackboneElement[]
The list of diagnoses relevant to this encounter
- conditionReference(Condition)
Reference to the Condition diagnosed during this encounter
- useCodeableConcept
Role that this diagnosis has within the encounter (e.g. admission, billing, discharge)
- System
http://terminology.hl7.org/CodeSystem/diagnosis-roleDiagnosis role codesCodesADAdmission diagnosisDDDischarge diagnosisCCChief complaintCMComorbidity diagnosispre-opPre-op diagnosispost-opPost-op diagnosisbillingBilling diagnosis - rankpositiveInt
Ranking of the diagnosis (for each role type)
- hospitalizationBackboneElement
Details about the admission to a healthcare service, primarily for inpatient encounters
- dischargeDispositionCodeableConcept
Category or kind of location after discharge
- System
http://terminology.hl7.org/CodeSystem/discharge-dispositionDischarge disposition codesExample CodeshomeDischarged to homesnfDischarged to skilled nursing facilityrehabDischarged to rehabilitation facility - System
https://www.nubc.org/CodeSystem/PatDischargeStatusNUBC Patient Discharge Status codes from the UB-04Example Codes01Discharged to home or self care (routine discharge)03Discharged/transferred to skilled nursing facility - locationBackboneElement[]
List of locations where the patient has been during this encounter
- locationReference(Location)
Reference to the Location where the encounter took place
- serviceProviderReference(Organization)
The organization that is primarily responsible for this encounter's services - see also the
EndpointIdtag provided by Flexpa
Encounter Example
{
"resourceType": "Encounter",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"meta": {
"lastUpdated": "2024-03-15T10:30:00Z",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"
]
},
"status": "finished",
"class": {
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "AMB",
"display": "ambulatory"
},
"type": [
{
"coding": [
{
"system": "http://www.ama-assn.org/go/cpt",
"code": "99213",
"display": "Office or other outpatient visit, established patient"
}
]
}
],
"subject": {
"reference": "Patient/example"
},
"participant": [
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND",
"display": "attender"
}
]
}
],
"period": {
"start": "2024-03-15T09:00:00Z",
"end": "2024-03-15T09:30:00Z"
},
"individual": {
"reference": "Practitioner/example",
"display": "Dr. Jane Smith, MD"
}
}
],
"period": {
"start": "2024-03-15T09:00:00Z",
"end": "2024-03-15T09:30:00Z"
},
"reasonCode": [
{
"coding": [
{
"system": "http://hl7.org/fhir/sid/icd-10-cm",
"code": "Z00.00",
"display": "Encounter for general adult medical examination without abnormal findings"
}
]
}
],
"diagnosis": [
{
"condition": {
"reference": "Condition/example"
},
"use": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
"code": "billing"
}
]
}
}
],
"location": [
{
"location": {
"reference": "Location/example",
"display": "Primary Care Clinic"
}
}
],
"serviceProvider": {
"reference": "Organization/example",
"display": "Example Health System"
}
}
Example FHIRPaths
API
Read
A read is the most basic operation in FHIR. It allows you to retrieve the current version of a single resource by its ID.
For a full list of available Resources, please refer to the FHIR Resources documentation.
Request headers
- AuthorizationstringRequired
An
Authorization: Bearerheader value must be sent with a Patient Access Token or an Application Access Token
Request path parameters
- idstring
The id of the resource to be retrieved - used in the last part of the URL path segment
Error codes
- transient429 status code
The API is expected to return a 429 status code until the data is ready to be retrieved. This error is returned by the API while in the initial sync period. Most syncs complete in under a minute, but patients with large record sets on slower endpoints can take several minutes.
You will need to implement retry logic to handle this error. If you are using the Node SDK which we demonstrate in our Quickstart guide, retry logic is already built in and you don't need to implement it yourself.
- processing422 status code
- The API is expected to return a 422 when Flexpa fails to synchronize any resources from the Endpoint for the requested Patient. Please re-authorize or reach out to support.
Request
ACCESS_TOKEN=patient-access-token
curl https://api.flexpa.com/fhir/Encounter/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer $ACCESS_TOKEN"
Search
Searches on Flexpa API follow the RESTful style of the FHIR specification by submitting a GET HTTP request to the base URL of the resource with parameters to define the exact search criteria to filter the response.
Request headers
- AuthorizationstringRequired
An
Authorization: Bearerheader value must be sent with a Patient Access Token or an Application Access Token
Search parameters
- _idtoken
The logical ID of the resource
- patientreference
The patient or group present at the encounter
- datedate
A date within the period the encounter lasted
- classtoken
Classification of the encounter (e.g. AMB, IMP, EMER)
- typetoken
Specific type of encounter
- statustoken
Current status of the encounter
- identifiertoken
Identifier(s) by which this encounter is known
- diagnosisreference
The diagnosis or procedure relevant to the encounter
- locationreference
Location the encounter takes place
- participantreference
Persons involved in the encounter other than the patient
- participant-typetoken
Role of participant in the encounter
- service-providerreference
The organization (facility) responsible for this encounter
- reason-codetoken
Coded reason the encounter takes place
- reason-referencereference
Reason the encounter takes place (reference)
Note
Flexpa supports all Encounter SearchParameter values defined in the FHIR R4 specification
Error codes
- transient429 status code
The API is expected to return a 429 status code until the data is ready to be retrieved. This error is returned by the API while in the initial sync period. Most syncs complete in under a minute, but patients with large record sets on slower endpoints can take several minutes.
You will need to implement retry logic to handle this error. If you are using the Node SDK which we demonstrate in our Quickstart guide, retry logic is already built in and you don't need to implement it yourself.
- processing422 status code
- The API is expected to return a 422 when Flexpa fails to synchronize any resources from the Endpoint for the requested Patient. Please re-authorize or reach out to support.
Request
ACCESS_TOKEN=patient-access-token
curl https://api.flexpa.com/fhir/Encounter \
-H "Authorization: Bearer $ACCESS_TOKEN"