ClinicKit Mobile SDK / iOS

iOS Intake & Visit API

Intake

An intake is the registration information collected from a patient when they visit a healthcare facility.

Intake configuration

IntakeConfig holds the information used to create an intake.

Properties

  • type: the type of intake. Defaults to .walkin.
  • reasonForVisit: the reason for the visit.
  • room: the room for the intake. Defaults to the default room from VCNetworkManager.shared().

Initialization

  • init(reasonForVisit:): creates an IntakeConfig with the given reason for visit.

Create an intake

Creates an intake from the given configuration.

public func createIntake(with config: IntakeConfig,
                         sucesss: @escaping (Intake) -> Void,
                         failure: @escaping (Error) -> Void)
ParameterTypeDescription
configIntakeConfigThe intake configuration.
successClosureCalled when the intake is created. Receives the Intake.
failureClosureCalled when creating the intake fails. Receives an Error.

Update an intake

Updates the current intake with the given parameters.

public func updateIntake(with params: [String: Any],
                        sucesss: @escaping () -> Void,
                        failure: @escaping (Error) -> Void)
ParameterTypeDescription
params[String: Any]The parameters to update on the intake.
successClosureCalled when the intake is updated.
failureClosureCalled when updating the intake fails. Receives an Error.

Visit

A visit is an appointment or session of patient care. It stores details such as the appointment time, the provider and the intake.

Create a visit from an intake

Creates a visit for the given intake.

public func createVisitWithIntake(_ intake: Intake,
                                  success: @escaping (Visit) -> Void,
                                  failure: @escaping (Error) -> Void)
ParameterTypeDescription
intakeIntakeThe intake for the visit.
successClosureCalled when the visit is created. Receives the Visit.
failureClosureCalled when creating the visit fails. Receives an Error.

Schedule a visit

For the complete booking flow, see Schedule an appointment.

Get the consultation list

Returns the consultations the patient can see.

The function gets the current room from VCNetworkManager, loads the room's consultations, and filters out those that aren't visible to the patient.

public func getConsultationList() throws -> [Consultation]?

Returns: an optional array of the Consultation objects visible to the patient, or nil if there are no valid consultations.

Throws: a ClinicError if the current room is unavailable or the consultations can't be loaded.

Example usage

let visibleConsultations = VisitService.shared.getConsultationList()

Update an intake with a consultation

Updates the given intake on the server with the details of the chosen consultation.

public func updateIntakeWithConsultation(intake: Intake,
                                             consultation: Consultation,
                                             sucesss: @escaping () -> Void,
                                             failure: @escaping (Error) -> Void)
ParameterTypeDescription
intakeIntakeThe intake to update.
consultationConsultationThe consultation whose details are added to the intake.
successClosureCalled when the update succeeds.
failureClosureCalled when the update fails. Receives an Error with the details.

Example usage

let intake = Intake.createOnServer(with: config) // The intake to update
let selectedConsultation = // the consultation the patient chose
VisitService.shared.updateIntakeWithConsultation(intake: intake,
consultation: selectedConsultation, success: {
    // Intake updated
    print("Intake updated successfully")
}, failure: { error in
    // Handle the error
    print("Failed to update intake: \(error)")
})

Schedule a visit for an intake

Schedules a visit with the given intake, an optional provider, and a room slot.

public func scheduleVisit(intake: Intake,
                          provider: Provider?,
                          slot: RoomSlot,
                          sucesss: @escaping (Visit?) -> Void,
                          failure: @escaping (Error?) -> Void)
ParameterTypeDescription
intakeIntakeThe intake for the scheduled visit.
providerProviderOptional. The provider for the visit.
slotRoomSlotThe time slot to book. A RoomSlot holds the visit's start and end times and whether the slot is booked or open.
successClosureCalled when the visit is scheduled. Receives the created Visit.
failureClosureCalled when scheduling fails. Receives an Error with the cause.

Example usage

let intake = Intake.createOnServer(with: config)
let selectedProvider = Provider() // the provider chosen from the list
let selectedSlot = RoomSlot() // the slot chosen from the room's open slots

VisitService.shared.scheduleVisit(intake: intake,
 provider: selectedProvider,
  slot: selectedSlot, success: { visit in
    // Visit scheduled
}, failure: { error in
    // Handle the error
})

List visits

Get the current visit

Gets the visit that is in progress.

ParameterTypeDescription
successClosureCalled when the current visit is loaded. Receives the in-progress Visit.
failureClosureCalled when loading fails. Receives an Error with the cause.

Example usage

VisitService.shared.getCurrentVisit(success: { visit in
    // Handle the current visit
    print("Current Visit: \(visit)")
}, failure: { error in
    // Handle the error
    print("Failed to retrieve current Visit with error: \(error)")
})

Get upcoming visits

Gets the list of upcoming visits.

ParameterTypeDescription
successClosureCalled when the upcoming visits are loaded. Receives an array of Visit objects.
failureClosureCalled when loading fails. Receives an Error with the cause.

Example usage

VisitService.shared.getUpcomingVisit(success: { visits in
    // Handle the upcoming visits
    print("Upcoming Visits: \(visits)")
}, failure: { error in
    // Handle the error
    print("Failed to retrieve upcoming Visits with error: \(error)")
})

Get past visits

Gets the list of past visits.

ParameterTypeDescription
successClosureCalled when the past visits are loaded. Receives an array of Visit objects.
failureClosureCalled when loading fails. Receives an Error with the cause.

Example usage

VisitService.shared.getPastVisit(success: { visits in
    // Handle the past visits
    print("Past Visits: \(visits)")
}, failure: { error in
    // Handle the error
    print("Failed to retrieve past Visits with error: \(error)")
})

Enter the waiting room

For the complete flow, see Enter waiting room.

Enter the waiting room with the native view

Starts the visit in a native view.

public func enterWaitingRoomByNativeViewWithVisit(_ visit: Visit)
ParameterTypeDescription
visitVisitThe visit whose waiting room to enter.

Example usage

let visit = // the Visit to start

// Start the visit and go to the waiting room
VisitService.shared.enterWaitingRoomByNativeViewWithVisit(visit)

Enter the waiting room with a browser call

Starts the visit as a browser call. See Communication with BrowserCall UI for how the call reports events back to your app.

public func enterWaitingRoomByBrowserCallWithVisit(_ visit: Visit)
ParameterTypeDescription
visitVisitThe visit whose waiting room to enter.

Example usage

let visit = // the Visit to start

// Start the visit and go to the waiting room
VisitService.shared.enterWaitingRoomByBrowserCallWithVisit(visit)