OnyeOne Documentation
  1. Encounters
OnyeOne Documentation
  • Overview
  • OnyeOne Use Cases
  • Authentication
  • Guides
    • OnyeOne Request Flow
  • Core EHR/EMR FHIR R4 APIs
    • Administration
      • Patients
        • Create Patient Resource
        • Update Patient Resource
      • Practitioners
        • Create Practitioner Resource
        • Update Practitioner Resource
        • Create Practitioner Role
        • Update PractitionerRole Resource
      • Locations
        • Create a Location Resource
        • Update Location Resource
      • Health Service
        • Create Health Service Resource
        • Update Health Service Resource
      • Encounters
        • Create Encounter Resource
          POST
        • Update Encounter Resource
          PUT
      • Appointments
        • Create Appointment Resource
        • Update Appointment Resource
      • Group
    • Clinical
      • AllergyIntolerance
      • Condition (Problem)
      • Procedure
      • FamilyMemberHistory
      • CarePlan
      • Goal
      • CareTeam
      • ClinicalImpression
      • AdverseEvent
      • DetectedIssue
      • RiskAssessment
    • Diagnostics
      • Observation
        • Create Observation Resource
      • DiagnosticReport
      • ServiceRequest
      • Media
      • ImagingStudy
      • MolecularSequence
      • Specimen
      • BodyStructure
    • Medications
      • MedicationRequest
      • MedicationDispense
      • MedicationAdministration
      • MedicationStatement
      • Medication
      • MedicationKnowledge
      • Immunization
      • ImmunizationEvaluation
      • ImmunizationRecommendation
    • Financial
      • Account
      • Contract
      • Coverage
      • CoverageEligibilityRequest
      • CoverageEligibilityResponse
      • EnrollmentRequest
      • EnrollmentResponse
      • Claim
      • ClaimResponse
      • PaymentNotice
      • PaymentReconciliation
      • ExplanationOfBenefit
      • VisionPrescription
  • Health Data Transformation
    • Transfrom HL7v2 to FHIR R4
      POST
    • Transform CCDA to FHIR R4
      POST
    • Transform HL7v2 to FHIR R4 and Store in Backend Database
      POST
    • Track API Request
      GET
  • Health Interoperabilty System
    • Create a Subscription
      POST
  • Webhook
  • Get Resource.
    GET
  1. Encounters

Create Encounter Resource

Developing
Testing Env
https://staging.onyeone.com/api
Testing Env
https://staging.onyeone.com/api
POST
/emr/encounter
emr
An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.

Request

Authorization
Add parameter in header
x-api-key
Example:
x-api-key: ********************
Body Params application/json
status
enum<string> 
required
Allowed values:
plannedarrivedtriagedin-progressonleavefinishedcancelledentered-in-errorunknown
class
enum<string> 
required
See http://terminology.hl7.org/ValueSet/v3-ActEncounterCode for code descriptions.
Allowed values:
AMBEMERFLDHHIMPACUTENONACOBSENCPRENCSSVR
service_type
object 
optional
Broad categorization of the service that is to be provided (e.g. cardiology).
code
string 
required
name
string 
required
priority
enum<string> 
optional
Indicates the urgency of the encounter. See http://terminology.hl7.org/ValueSet/v3-ActPriority for context.
Allowed values:
ACRCSCSPCSRELEMPPRNRRRSTUDUR
subject
object 
optional
The patient or group present at the encounter.
type
enum<string> 
required
Allowed values:
patientgroup
id
string 
required
ID of patient or group.
based_on
array[string]
optional
The request this encounter satisfies (e.g. incoming referral or procedure request). IDs of ServiceRequest
appointment
array[string]
optional
The appointment that scheduled this encounter. Appointment IDs.
period
object 
optional
The start and end time of the encounter.
start
string 
required
YYYY-MM-DD format
end
string 
required
YYYY-MM-DD format
reason_code
array [object {2}] 
optional
code
string 
required
See http://hl7.org/fhir/ValueSet/encounter-reason for codes and name.
name
string 
required
reason_reference
array [object {2}] 
optional
type
enum<string> 
required
Allowed values:
conditionprocedureobservationimmunization_recommendation
id
string 
required
participant
array [object {3}] 
optional
Role of participant in encounter.
type
enum<string> 
required
See http://hl7.org/fhir/ValueSet/encounter-participant-type.
Allowed values:
admitterattendercallback contactconsultantdischargerescortreferrersecondary performerprimary performerParticipationTranslatorEmergency
period
object 
optional
individual
object 
required
diagnosis
array [object {3}] 
optional
condition
object 
required
use
enum<string> 
optional
See http://terminology.hl7.org/CodeSystem/diagnosis-role
Allowed values:
ADDDCCCMpre-oppost-opbilling
rank
number 
optional
>= 1
account
array[string]
optional
The set of accounts that may be used for billing for this Encounter.
hospitalization
object 
optional
origin
object 
optional
ID of location/organization from which the patient came before admission.
diet_preference
array[string]
optional
Allowed values:
vegetariandairy-freenut-freegluten-freeveganhalalkosher
admit_source
enum<string> 
optional
Allowed values:
hosp-transemdoutpborngpmpnursingpsychrehabother
location
array [object {2}] 
optional
List of locations where the patient has been during this encounter.
location
string 
required
Location Resource ID
period
object 
optional
part_of
string 
optional
Another Encounter of which this encounter is a part of (administratively or in time).
Example
{
    "status": "entered-in-error",
    "class": "EMER",
    "service_type": {
        "code": "95",
        "name": "Cardiology"
    },
    "priority": "S",
    "subject": {
        "type": "patient",
        "id": "713a5ecc-632d-44f7-99bd-ab83ee45aace"
    },
    "based_on": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace"
    ],
    "appointment": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        "8983a5ecc-87uu-42f7-99bd-ab83e9iuuac7"
    ],
    "period": {
        "start": "2025-01-12",
        "end": "2025-06-11"
    },
    "reason_code": [
        {
            "code": "219006",
            "name": "Alcohol user"
        },
        {
            "code": "199004",
            "name": "Decreased lactation"
        }
    ],
    "reason_reference": [
        {
            "type": "procedure",
            "id": "ID of type above"
        },
        {
            "type": "observation",
            "id": "ID of type above"
        },
        {
            "type": "condition",
            "id": "ID of type above"
        }
    ],
    "participant": [
        {
            "type": "escort",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "relatedperson",
                "id": "ID of type above"
            }
        },
        {
            "type": "attender",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "relatedperson",
                "id": "ID of type above"
            }
        },
        {
            "type": "callback contact",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "practitionerrole",
                 "id": "ID of type above"
            }
        }
    ],
    "diagnosis": [
        {
            "condition": {
                "type": "procedure",
                "id": "ID of type above"
            },
            "use": "post-op",
            "rank": 1
        },
        {
            "condition": {
                "type": "condition",
                 "id": "ID of type above"
            },
            "use": "CC",
            "rank": 2
        }
    ],
    "account": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
    ],
    "hospitalization": {
        "origin": {
            "type": "location",
            "id":  "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        },
        "diet_preference": [
            "vegetarian",
            "gluten-free"
        ],
        "admit_source": "emd"
    },
    "location": [
        {
            "location": "713a5ecc-632d-44f7-99bd-ab83ee45aace",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            }
        }
    ],
    "part_of": "713a5ecc-632d-44f7-99bd-ab83ee45aace"
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://staging.onyeone.com/api/emr/encounter' \
--header 'Content-Type: application/json' \
--header 'x-api-key;' \
--data-raw '{
    "status": "entered-in-error",
    "class": "EMER",
    "service_type": {
        "code": "95",
        "name": "Cardiology"
    },
    "priority": "S",
    "subject": {
        "type": "patient",
        "id": "713a5ecc-632d-44f7-99bd-ab83ee45aace"
    },
    "based_on": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace"
    ],
    "appointment": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        "8983a5ecc-87uu-42f7-99bd-ab83e9iuuac7"
    ],
    "period": {
        "start": "2025-01-12",
        "end": "2025-06-11"
    },
    "reason_code": [
        {
            "code": "219006",
            "name": "Alcohol user"
        },
        {
            "code": "199004",
            "name": "Decreased lactation"
        }
    ],
    "reason_reference": [
        {
            "type": "procedure",
            "id": "ID of type above"
        },
        {
            "type": "observation",
            "id": "ID of type above"
        },
        {
            "type": "condition",
            "id": "ID of type above"
        }
    ],
    "participant": [
        {
            "type": "escort",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "relatedperson",
                "id": "ID of type above"
            }
        },
        {
            "type": "attender",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "relatedperson",
                "id": "ID of type above"
            }
        },
        {
            "type": "callback contact",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            },
            "individual": {
                "type": "practitionerrole",
                 "id": "ID of type above"
            }
        }
    ],
    "diagnosis": [
        {
            "condition": {
                "type": "procedure",
                "id": "ID of type above"
            },
            "use": "post-op",
            "rank": 1
        },
        {
            "condition": {
                "type": "condition",
                 "id": "ID of type above"
            },
            "use": "CC",
            "rank": 2
        }
    ],
    "account": [
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        "713a5ecc-632d-44f7-99bd-ab83ee45aace",
    ],
    "hospitalization": {
        "origin": {
            "type": "location",
            "id":  "713a5ecc-632d-44f7-99bd-ab83ee45aace",
        },
        "diet_preference": [
            "vegetarian",
            "gluten-free"
        ],
        "admit_source": "emd"
    },
    "location": [
        {
            "location": "713a5ecc-632d-44f7-99bd-ab83ee45aace",
            "period": {
                "start": "2025-01-12",
                "end": "2025-02-17"
            }
        }
    ],
    "part_of": "713a5ecc-632d-44f7-99bd-ab83ee45aace"
}'

Responses

🟢200Success
application/json
Body
message
string 
required
resource_name
string 
required
resource_id
string 
required
full_resource
object 
required
resourceType
string 
required
id
string 
required
meta
object 
required
status
string 
optional
class
object 
optional
serviceType
object 
optional
priority
object 
optional
period
object 
optional
reasonCode
array [object {2}] 
optional
serviceProvider
object 
optional
Example
{
    "message": "Resource created successfully",
    "resource_name": "Encounter",
    "resource_id": "e59f43ba-e124-588e-b70d-da3c5025273c",
    "full_resource": {
        "resourceType": "Encounter",
        "id": "e59f43ba-e124-588e-b70d-da3c5025273c",
        "meta": {
            "versionId": "1",
            "lastUpdated": "2024-12-23T07:40:12.590+00:00",
            "source": "#z3GsOUoB6Gmtf0kk",
            "tag": [
                {
                    "system": "http://onyeone.com/facility-tags/origination",
                    "code": "1",
                    "display": "Green Group Hospital"
                }
            ]
        },
        "status": "in-progress",
        "class": {
            "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
            "code": "EMER",
            "display": "Emergency"
        },
        "serviceType": {
            "coding": [
                {
                    "system": "http://hl7.org/fhir/ValueSet/service-type",
                    "code": "20",
                    "display": "Candace Stokes"
                }
            ],
            "text": "Candace Stokes"
        },
        "priority": {
            "coding": [
                {
                    "system": "http://terminology.hl7.org/CodeSystem/v3-ActPriority",
                    "code": "S",
                    "display": "stat"
                }
            ],
            "text": "stat"
        },
        "period": {
            "start": "2025-01-12",
            "end": "2025-06-11"
        },
        "reasonCode": [
            {
                "coding": [
                    {
                        "system": "http://hl7.org/fhir/ValueSet/encounter-reason",
                        "code": "219006",
                        "display": "Alcohol user"
                    }
                ],
                "text": "Alcohol user"
            },
            {
                "coding": [
                    {
                        "system": "http://hl7.org/fhir/ValueSet/encounter-reason",
                        "code": "199004",
                        "display": "Decreased lactation"
                    }
                ],
                "text": "Decreased lactation"
            }
        ],
        "serviceProvider": {
            "reference": "Organization/5abe99ee-0928-546b-93e9-0207ba8a556b",
            "display": "Green Group Hospital"
        }
    }
}
Previous
Update Health Service Resource
Next
Update Encounter Resource
Built with