Schedule Appointment Flow
A patient logs in and schedules a new appointment. This flow uses the iOS ClinicKit APIs. For Android, see the Android Schedule Appointment Flow.
Precondition
- The user has logged in with a valid username and password.
Use case steps
User login
The app starts the login process. Call userLogin with the user's credentials:
public func userLogin(userName: String, password: String, success: @escaping() -> Void, failure: @escaping (Error) -> Void) {
// Perform the login process with the provided username and password.
}
Handle the success and failure cases.

Create intake information with IntakeConfig
Define an IntakeConfig with the relevant information:
let intakeConfig = IntakeConfig(reasonForVisit: "Routine check-up")
Use VisitService to create the intake with that configuration:
VisitService.shared.createIntake(with: intakeConfig, success: { intake
// Store the intake to update later
}, failure: { error in
// Handle the failure to create the intake.
})

Get the list of consultation types
Get the consultation types for the current room:
public func getConsultationList() throws -> [Consultation]

Select a consultation type and update the intake
Choose a consultation type from the list, then update the intake you created with it:
VisitService.shared.updateIntakeWithConsultation(intake: Intake,
consultation: Consultation,
success: @escaping () -> Void,
failure: @escaping (Error) -> Void)
Get available room slots for the updated intake
Use the updated intake to get the available room slots for each day:
VisitService.shared.getRoomSlotAvailableFrom(date: Date,
provider: Provider?,
intake: Intake,
success: @escaping ([RoomSlot]) -> Void,
failure: @escaping (Error) -> Void)

Select a room slot and schedule the visit
Choose a slot from the available ones. Schedule the visit with the intake, the provider (if any), and the slot:
VisitService.shared.scheduleVisit(intake: Intake,
provider: Provider?,
slot: RoomSlot,
success: @escaping (Visit?) -> Void,
failure: @escaping (Error?) -> Void)
Handle the success and failure cases.

With these steps, a patient can log in and schedule a new appointment based on their preferences and the available slots.
Try the API calls interactively
The Appointment Scheduling use case walks through the same flow with live API calls.