Practice Service

A Practice is a collection of resources that provides a type of care to patients.

Each practice has a separate set of regions & hours, payment information, and a pool of caregivers to treat patients.

Currently, practices are only supported in the Virtual scheduling flow. With SDK 5.0, Practices is the only supported way to book a Virtual Visit.

Practices are planned to expand to Retail in the future.

Get Virtual Practices

In order to book through a virtual practice, you need to get a list of VirtualPracticeRegion that are available within a Practice Id. Call PracticeService.getVirtualPractice(practiceId) to information on a VirtualPractice.

For Virtual Visits, the practice id that is needed will not change. These can be provided by your DexCare contact.

  • practiceId - A string that contains the practice id you want the VirtualPractice information on

Returned will be a VirtualPractice object which will have:

  • practiceId - A UUID for the Virtual Practice. This property will be needed to book Virtual Visits.
  • displayName - A plain text string for the name of the Virtual Practice.
  • careMode - In VirtualPractice this will always be virtual.
  • payment - A PracticePaymentAvailability object showing which payment types are accepted by the VirtualPractice.
  • epicBookingEnabled - Whether or not the visit will be booked in Epic.
  • practiceRegions - A list of VirtualPracticeRegion types where the practice is supported.
  • let dexcareSDK = DexcareSDK(configuration: ...)
    
    // practiceId's will be known to you as a client before hand. It won't change, but may vary between DEV/UAT/PROD environments.
    let practiceId = "xxxxxx"
    
    dexCareSDK.practiceService.getVirtualPractice(
        practiceId: practiceId,
        success: { virtualPractice in
           // save virtualPractice to show VirtualRegions. Use for booking.
       },
       failure: { error in
           // error getting virtualPractice. Most likely an invalid practiceId string
        }
    )
    
    // Swift Concurrency
    do {
        let virtualPractice = try dexCareSDK.practiceService.getVirtualPractice(practiceId: practiceId)
    } catch {
         // error getting virtualPractice. Most likely an invalid practiceId string
    }
    
  • DexCareSDK.practiceService.getVirtualPractice(
        context.getString(R.string.practice_id) // You can hardcode the practice id in resources.  It won't change, but may vary between DEV/UAT/PROD environments.
    ).subscribe({ virtualPractice ->
        // save virtualPractice to show VirtualRegions. Use for booking.
    }, {
        // handle the error, show an error dialog, log the error, etc.
    })
    

Virtual Practices WaitTime and Availability

Before you book with a Virtual Practice, you need to make sure it is available to book against. Calling PracticeService.getWaitTimeAvailability will quickly tell you if it’s available, and if not, the reason it isn’t.

The WaitTimeAvailability object will also return the estimated wait time for the criteria that is passed in.

  • let dexcareSDK = DexcareSDK(configuration: ...)
    
    let practiceId = "12121212" // usually given to you from representative
    
    dexCareSDK.practiceService.getVirtualPracticeRegionAvailability(
        regionCodes: ["WA"], 
        assignmentQualifiers: nil, 
        visitTypeNames: nil, 
        practiceId: practiceId, homeMarket: nil,
        success: { regionAvailability in
          if regionAvailability.available {
              // you're good to book!
          } else {
            // handle the reason why it's not available and show appropriate message to the user. 
            switch regionAvailability.reason {
                case .noRegionsFound: // no regions found, contact dexcare
                case .offHours: // Region is currently closed
                case .noOncallProviders: // no providers are available to take virtual visits
                case .regionBusy: // region is experiencing high demand, user should try again later
            }
          }
    
       },
       failure: { error in
           // error - Most likely an invalid practiceId string
        }
    )
    
    do {
        let regionAvailability =  dexCareSDK.practiceService.getVirtualPracticeRegionAvailability(
        regionCodes: ["WA"], 
        assignmentQualifiers: nil, 
        visitTypeNames: nil, 
        practiceId: practiceId, homeMarket: nil)
    } catch {
        // error - Most likely an invalid practiceId string
    }
    
  • // User selects a VirtualPracticeRegion from the list returned in PracticeService.getVirtualPractice()
    val practiceRegionId = virtualPracticeRegion.practiceRegionId
    
    DexCareSDK.practiceService.getVirtualPracticeRegionAvailability(
        practiceRegionId
    ).subscribe({
        if (regionAvailability.available) {
            // you're good to book!
        } else {
            // handle the reason why it's not available and show appropriate message to the user.
            when(regionAvailability.reason) {
                RegionAvailabilityReason.OFF_HOURS -> {} // Region is currently closed
                RegionAvailabilityReason.NO_ONCALL_PROVIDERS -> {} // no providers are available to take virtual visits
                RegionAvailabilityReason.NO_REGIONS_FOUND -> {} // no regions found, contact dexcare
                RegionAvailabilityReason.REGION_BUSY -> {} // region is experiencing high demand, user should try again later
                else -> {} // unknown error
            }
        }
    }, {
        // handle the error, show an error dialog, log the error, etc.
    })