Trendsic Platform Service

<back to all web services

KpiV2Request

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/kpiv2
import Foundation
import ServiceStack

public class KpiV2Request : Codable
{
    public var fromDate:Date
    public var toDate:Date
    public var locationIds:[String] = []
    public var includeScope:Bool
    public var stateCode:String
    public var compare:String

    required public init(){}
}

public class KpiV2Response : Codable
{
    public var responseStatus:ResponseStatus
    public var stats:[DashboardStatTile] = []
    public var trend:[DashboardSeries] = []
    public var servicesByType:DashboardSeries
    public var locationLeaderboard:[KpiV2LocationRow] = []
    public var workerProductivity:[KpiV2WorkerRow] = []
    public var heatmap:[KpiV2HeatPoint] = []
    public var liveQueue:[KpiV2LiveRow] = []
    public var scope:SvcScope

    required public init(){}
}

public class DashboardStatTile : Codable
{
    public var key:String
    public var label:String
    public var value:Double
    public var previousValue:Double?
    public var unit:String
    public var deltaPct:Double?

    required public init(){}
}

public class DashboardSeries : Codable
{
    public var name:String
    public var points:[DashboardSeriesPoint] = []

    required public init(){}
}

public class DashboardSeriesPoint : Codable
{
    public var label:String
    public var value:Double

    required public init(){}
}

public class KpiV2LocationRow : Codable
{
    public var locationName:String
    public var walkins:Int
    public var completed:Int
    public var avgServiceMinutes:Double
    public var abandonmentPct:Double

    required public init(){}
}

public class KpiV2WorkerRow : Codable
{
    public var workerName:String
    public var completed:Int
    public var avgServiceMinutes:Double

    required public init(){}
}

public class KpiV2HeatPoint : Codable
{
    public var dow:Int
    public var hr:Int
    public var cnt:Int

    required public init(){}
}

public class KpiV2LiveRow : Codable
{
    public var locationName:String
    public var waiting:Int
    public var inProgress:Int

    required public init(){}
}

public class SvcScope : Codable
{
    public var stateCode:String
    public var branches:[SvcBranchRow] = []
    public var states:[SvcStateRow] = []
    public var total:SvcMetrics
    public var comparison:SvcComparison
    public var feesByService:[SvcServiceRow] = []
    public var byHour:[SvcHourRow] = []
    public var workers:[SvcWorkerRow] = []
    public var multiZone:Bool
    public var multiState:Bool
    public var recordingSinceUtc:Date?
    public var sessionsSinceUtc:Date?
    public var alerts:[SvcAlert] = []
    public var canSeeStaff:Bool
    public var canSeeFinancial:Bool
    public var canSeePay:Bool

    required public init(){}
}

public class SvcBranchRow : Codable
{
    public var branchId:String
    public var name:String
    public var stateCode:String
    public var zoneCode:String
    public var timeZone:String
    public var windows:Int
    public var recordingSinceUtc:Date?
    public var sessionsSinceUtc:Date?
    public var metrics:SvcMetrics

    required public init(){}
}

public class SvcMetrics : Codable
{
    public var checkins:Int
    public var walkins:Int
    public var appts:Int
    public var served:Int
    public var noShows:Int
    public var apptNoShows:Int
    public var cancelledAtWindow:Int
    public var abandoned:Int
    public var called:Int
    public var calledUp:Int
    public var abandonRate:Double?
    public var noShowRate:Double?
    public var avgServiceSec:Double?
    public var medianServiceSec:Double?
    public var avgWaitSec:Double?
    public var maxWaitSec:Int
    public var avgWalkUpSec:Double?
    public var expectedServiceSec:Double?
    public var signedSec:Int
    public var servingSec:Int
    public var pausedSec:Int
    public var idleSec:Int
    public var unstaffedSec:Int
    public var utilization:Double?
    public var idleShare:Double?
    public var pausedShare:Double?
    public var sessions:Int
    public var openDays:Int
    public var feesEarned:Double?
    public var avgFee:Double?
    public var feesPerStaffedHour:Double?
    public var expectedFeesPerStaffedHour:Double?
    public var laborCost:Double?
    public var laborPartial:Bool
    public var missingCostEmployeeIds:[String] = []
    public var missingCost:[SvcNamedTime] = []
    public var laborLocked:Bool
    public var contribution:Double?
    public var lostFees:Double?
    public var lostNoShowFees:Double?
    public var mix:[String:Int] = [:]
    public var hourlyServed:[Int] = []
    public var hourlyFees:[Double] = []
    public var hourlyCost:[Double] = []
    public var tints:[SvcTint] = []

    required public init(){}
}

public class SvcNamedTime : Codable
{
    public var id:String
    public var name:String
    public var signedSec:Int
    public var served:Int

    required public init(){}
}

public class SvcTint : Codable
{
    public var field:String
    public var tone:String
    public var reason:String
    public var value:Double?
    public var reference:Double?
    public var branchValue:Double?

    required public init(){}
}

public class SvcStateRow : Codable
{
    public var stateCode:String
    public var stateName:String
    public var branches:Int
    public var metrics:SvcMetrics

    required public init(){}
}

public class SvcComparison : Codable
{
    public var mode:String
    public var fromDate:Date?
    public var toDate:Date?
    public var cutoffMinute:Int?
    public var hasData:Bool
    public var metrics:SvcMetrics

    required public init(){}
}

public class SvcServiceRow : Codable
{
    public var lineId:String
    public var name:String
    public var completed:Int
    public var avgServiceSec:Double?
    public var branchAvgServiceSec:Double?
    public var feesEarned:Double?
    public var feeCurrent:Double?
    public var feeMin:Double?
    public var feeMax:Double?
    public var feePerMinute:Double?
    public var branchFeePerMinute:Double?
    public var feeChanges:[SvcFeeChange] = []

    required public init(){}
}

public class SvcFeeChange : Codable
{
    public var locationId:String
    public var onDate:Date
    public var fromFee:Double
    public var toFee:Double

    required public init(){}
}

public class SvcHourRow : Codable
{
    public var localHour:Int
    public var served:Int
    public var feesEarned:Double?
    public var costToStaff:Double?

    required public init(){}
}

public class SvcWorkerRow : Codable
{
    public var employeeId:String
    public var branchId:String
    public var branchName:String
    public var name:String
    public var served:Int
    public var avgServiceSec:Double?
    public var utilization:Double?

    required public init(){}
}

public class SvcAlert : Codable
{
    public var level:String
    public var view:String
    public var code:String
    public var stationId:String?
    public var employeeId:String?
    public var branchId:String?
    public var lineId:String?
    public var name:String
    public var otherLineId:String?
    public var otherName:String
    public var stationIds:[String] = []
    public var values:[String:Double] = [:]

    required public init(){}
}


Swift KpiV2Request DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/dashboard/kpiv2 HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"FromDate":"0001-01-01T00:00:00.0000000","ToDate":"0001-01-01T00:00:00.0000000","LocationIds":["00000000000000000000000000000000"],"IncludeScope":false,"StateCode":"String","Compare":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Stats":[{"Key":"String","Label":"String","Value":0,"PreviousValue":0,"Unit":"String","DeltaPct":null}],"Trend":[{"Name":"String","Points":[{"Label":"String","Value":0}]}],"ServicesByType":{"Name":"String","Points":[{"Label":"String","Value":0}]},"LocationLeaderboard":[{"LocationName":"String","Walkins":0,"Completed":0,"AvgServiceMinutes":0,"AbandonmentPct":0}],"WorkerProductivity":[{"WorkerName":"String","Completed":0,"AvgServiceMinutes":0}],"Heatmap":[{"Dow":0,"Hr":0,"Cnt":0}],"LiveQueue":[{"LocationName":"String","Waiting":0,"InProgress":0}],"Scope":{"StateCode":"String","Branches":[{"BranchId":"00000000000000000000000000000000","Name":"String","StateCode":"String","ZoneCode":"String","TimeZone":"String","Windows":0,"RecordingSinceUtc":"0001-01-01T00:00:00.0000000","SessionsSinceUtc":"0001-01-01T00:00:00.0000000","Metrics":{"Checkins":0,"Walkins":0,"Appts":0,"Served":0,"NoShows":0,"ApptNoShows":0,"CancelledAtWindow":0,"Abandoned":0,"Called":0,"CalledUp":0,"AbandonRate":0,"NoShowRate":0,"AvgServiceSec":0,"MedianServiceSec":0,"AvgWaitSec":0,"MaxWaitSec":0,"AvgWalkUpSec":0,"ExpectedServiceSec":0,"SignedSec":0,"ServingSec":0,"PausedSec":0,"IdleSec":0,"UnstaffedSec":0,"Utilization":0,"IdleShare":0,"PausedShare":0,"Sessions":0,"OpenDays":0,"FeesEarned":0,"AvgFee":0,"FeesPerStaffedHour":0,"ExpectedFeesPerStaffedHour":0,"LaborCost":0,"LaborPartial":false,"MissingCostEmployeeIds":["00000000000000000000000000000000"],"MissingCost":[{"Id":"00000000000000000000000000000000","Name":"String","SignedSec":0,"Served":0}],"LaborLocked":false,"Contribution":0,"LostFees":0,"LostNoShowFees":0,"Mix":{"00000000000000000000000000000000":0},"HourlyServed":[0],"HourlyFees":[0],"HourlyCost":[0],"Tints":[{"Field":"String","Tone":"String","Reason":"String","Value":0,"Reference":0,"BranchValue":0}]}}],"States":[{"StateCode":"String","StateName":"String","Branches":0,"Metrics":{"Checkins":0,"Walkins":0,"Appts":0,"Served":0,"NoShows":0,"ApptNoShows":0,"CancelledAtWindow":0,"Abandoned":0,"Called":0,"CalledUp":0,"AbandonRate":0,"NoShowRate":0,"AvgServiceSec":0,"MedianServiceSec":0,"AvgWaitSec":0,"MaxWaitSec":0,"AvgWalkUpSec":0,"ExpectedServiceSec":0,"SignedSec":0,"ServingSec":0,"PausedSec":0,"IdleSec":0,"UnstaffedSec":0,"Utilization":0,"IdleShare":0,"PausedShare":0,"Sessions":0,"OpenDays":0,"FeesEarned":0,"AvgFee":0,"FeesPerStaffedHour":0,"ExpectedFeesPerStaffedHour":0,"LaborCost":0,"LaborPartial":false,"MissingCostEmployeeIds":["00000000000000000000000000000000"],"MissingCost":[{"Id":"00000000000000000000000000000000","Name":"String","SignedSec":0,"Served":0}],"LaborLocked":false,"Contribution":0,"LostFees":0,"LostNoShowFees":0,"Mix":{"00000000000000000000000000000000":0},"HourlyServed":[0],"HourlyFees":[0],"HourlyCost":[0],"Tints":[{"Field":"String","Tone":"String","Reason":"String","Value":0,"Reference":0,"BranchValue":0}]}}],"Total":{"Checkins":0,"Walkins":0,"Appts":0,"Served":0,"NoShows":0,"ApptNoShows":0,"CancelledAtWindow":0,"Abandoned":0,"Called":0,"CalledUp":0,"AbandonRate":0,"NoShowRate":0,"AvgServiceSec":0,"MedianServiceSec":0,"AvgWaitSec":0,"MaxWaitSec":0,"AvgWalkUpSec":0,"ExpectedServiceSec":0,"SignedSec":0,"ServingSec":0,"PausedSec":0,"IdleSec":0,"UnstaffedSec":0,"Utilization":0,"IdleShare":0,"PausedShare":0,"Sessions":0,"OpenDays":0,"FeesEarned":0,"AvgFee":0,"FeesPerStaffedHour":0,"ExpectedFeesPerStaffedHour":0,"LaborCost":0,"LaborPartial":false,"MissingCostEmployeeIds":["00000000000000000000000000000000"],"MissingCost":[{"Id":"00000000000000000000000000000000","Name":"String","SignedSec":0,"Served":0}],"LaborLocked":false,"Contribution":0,"LostFees":0,"LostNoShowFees":0,"Mix":{"00000000000000000000000000000000":0},"HourlyServed":[0],"HourlyFees":[0],"HourlyCost":[0],"Tints":[{"Field":"String","Tone":"String","Reason":"String","Value":0,"Reference":0,"BranchValue":0}]},"Comparison":{"Mode":"String","FromDate":"0001-01-01T00:00:00.0000000","ToDate":"0001-01-01T00:00:00.0000000","CutoffMinute":0,"HasData":false,"Metrics":{"Checkins":0,"Walkins":0,"Appts":0,"Served":0,"NoShows":0,"ApptNoShows":0,"CancelledAtWindow":0,"Abandoned":0,"Called":0,"CalledUp":0,"AbandonRate":0,"NoShowRate":0,"AvgServiceSec":0,"MedianServiceSec":0,"AvgWaitSec":0,"MaxWaitSec":0,"AvgWalkUpSec":0,"ExpectedServiceSec":0,"SignedSec":0,"ServingSec":0,"PausedSec":0,"IdleSec":0,"UnstaffedSec":0,"Utilization":0,"IdleShare":0,"PausedShare":0,"Sessions":0,"OpenDays":0,"FeesEarned":0,"AvgFee":0,"FeesPerStaffedHour":0,"ExpectedFeesPerStaffedHour":0,"LaborCost":0,"LaborPartial":false,"MissingCostEmployeeIds":["00000000000000000000000000000000"],"MissingCost":[{"Id":"00000000000000000000000000000000","Name":"String","SignedSec":0,"Served":0}],"LaborLocked":false,"Contribution":0,"LostFees":0,"LostNoShowFees":0,"Mix":{"00000000000000000000000000000000":0},"HourlyServed":[0],"HourlyFees":[0],"HourlyCost":[0],"Tints":[{"Field":"String","Tone":"String","Reason":"String","Value":0,"Reference":0,"BranchValue":0}]}},"FeesByService":[{"LineId":"00000000000000000000000000000000","Name":"String","Completed":0,"AvgServiceSec":0,"BranchAvgServiceSec":0,"FeesEarned":0,"FeeCurrent":0,"FeeMin":0,"FeeMax":0,"FeePerMinute":0,"BranchFeePerMinute":0,"FeeChanges":[{"LocationId":"00000000000000000000000000000000","OnDate":"0001-01-01T00:00:00.0000000","FromFee":0,"ToFee":0}]}],"ByHour":[{"LocalHour":0,"Served":0,"FeesEarned":0,"CostToStaff":0}],"Workers":[{"EmployeeId":"00000000000000000000000000000000","BranchId":"00000000000000000000000000000000","BranchName":"String","Name":"String","Served":0,"AvgServiceSec":0,"Utilization":0}],"MultiZone":false,"MultiState":false,"RecordingSinceUtc":"0001-01-01T00:00:00.0000000","SessionsSinceUtc":"0001-01-01T00:00:00.0000000","Alerts":[{"Level":"String","View":"String","Code":"String","StationId":"00000000000000000000000000000000","EmployeeId":"00000000000000000000000000000000","BranchId":"00000000000000000000000000000000","LineId":"00000000000000000000000000000000","Name":"String","OtherLineId":"00000000000000000000000000000000","OtherName":"String","StationIds":["00000000000000000000000000000000"],"Values":{"String":0}}],"CanSeeStaff":false,"CanSeeFinancial":false,"CanSeePay":false}}