Trendsic Platform Service

<back to all web services

KpiV2DetailRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/kpiv2/detail
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcNamedTime:
    id: Optional[str] = None
    name: Optional[str] = None
    signed_sec: int = 0
    served: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcTint:
    field: Optional[str] = None
    tone: Optional[str] = None
    reason: Optional[str] = None
    value: Optional[float] = None
    reference: Optional[float] = None
    branch_value: Optional[float] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcMetrics:
    checkins: int = 0
    walkins: int = 0
    appts: int = 0
    served: int = 0
    no_shows: int = 0
    appt_no_shows: int = 0
    cancelled_at_window: int = 0
    abandoned: int = 0
    called: int = 0
    called_up: int = 0
    abandon_rate: Optional[float] = None
    no_show_rate: Optional[float] = None
    avg_service_sec: Optional[float] = None
    median_service_sec: Optional[float] = None
    avg_wait_sec: Optional[float] = None
    max_wait_sec: int = 0
    avg_walk_up_sec: Optional[float] = None
    expected_service_sec: Optional[float] = None
    signed_sec: int = 0
    serving_sec: int = 0
    paused_sec: int = 0
    idle_sec: int = 0
    unstaffed_sec: int = 0
    utilization: Optional[float] = None
    idle_share: Optional[float] = None
    paused_share: Optional[float] = None
    sessions: int = 0
    open_days: int = 0
    fees_earned: Optional[Decimal] = None
    avg_fee: Optional[Decimal] = None
    fees_per_staffed_hour: Optional[Decimal] = None
    expected_fees_per_staffed_hour: Optional[Decimal] = None
    labor_cost: Optional[Decimal] = None
    labor_partial: bool = False
    missing_cost_employee_ids: List[str] = field(default_factory=list)
    missing_cost: List[SvcNamedTime] = field(default_factory=list)
    labor_locked: bool = False
    contribution: Optional[Decimal] = None
    lost_fees: Optional[Decimal] = None
    lost_no_show_fees: Optional[Decimal] = None
    mix: Dict[str, int] = field(default_factory=dict)
    hourly_served: List[int] = field(default_factory=list)
    hourly_fees: List[Decimal] = field(default_factory=list)
    hourly_cost: List[Decimal] = field(default_factory=list)
    tints: List[SvcTint] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcWindowRow:
    station_id: Optional[str] = None
    name: Optional[str] = None
    clerks: List[SvcNamedTime] = field(default_factory=list)
    never_staffed: bool = False
    last_staffed_utc: Optional[datetime.datetime] = None
    last_staffed_by: Optional[str] = None
    metrics: Optional[SvcMetrics] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcClerkRow:
    employee_id: Optional[str] = None
    name: Optional[str] = None
    windows: List[SvcNamedTime] = field(default_factory=list)
    loaded_rate: Optional[Decimal] = None
    rate_set: bool = False
    rate_locked: bool = False
    metrics: Optional[SvcMetrics] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcAverage:
    count: int = 0
    served: float = 0.0
    avg_service_sec: Optional[float] = None
    median_service_sec: Optional[float] = None
    avg_wait_sec: Optional[float] = None
    utilization: Optional[float] = None
    idle_sec: float = 0.0
    paused_sec: float = 0.0
    no_shows: float = 0.0
    signed_sec: float = 0.0
    fees_earned: Optional[Decimal] = None
    fees_per_staffed_hour: Optional[Decimal] = None
    labor_cost: Optional[Decimal] = None
    contribution: Optional[Decimal] = None
    lost_no_show_fees: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcSession:
    session_id: Optional[str] = None
    station_id: Optional[str] = None
    station_name: Optional[str] = None
    employee_id: Optional[str] = None
    employee_name: Optional[str] = None
    local_in: datetime.datetime = datetime.datetime(1, 1, 1)
    local_out: datetime.datetime = datetime.datetime(1, 1, 1)
    is_open: bool = False
    end_reason: Optional[str] = None
    paused_sec: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcFeeChange:
    location_id: Optional[str] = None
    on_date: datetime.datetime = datetime.datetime(1, 1, 1)
    from_fee: Decimal = decimal.Decimal(0)
    to_fee: Decimal = decimal.Decimal(0)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcServiceRow:
    line_id: Optional[str] = None
    name: Optional[str] = None
    completed: int = 0
    avg_service_sec: Optional[float] = None
    branch_avg_service_sec: Optional[float] = None
    fees_earned: Optional[Decimal] = None
    fee_current: Optional[Decimal] = None
    fee_min: Optional[Decimal] = None
    fee_max: Optional[Decimal] = None
    fee_per_minute: Optional[Decimal] = None
    branch_fee_per_minute: Optional[Decimal] = None
    fee_changes: List[SvcFeeChange] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SvcDetail:
    kind: Optional[str] = None
    window: Optional[SvcWindowRow] = None
    clerk: Optional[SvcClerkRow] = None
    branch_metrics: Optional[SvcMetrics] = None
    per_row_average: Optional[SvcAverage] = None
    sessions: List[SvcSession] = field(default_factory=list)
    services: List[SvcServiceRow] = field(default_factory=list)
    can_see_staff: bool = False
    can_see_financial: bool = False
    can_see_pay: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class KpiV2DetailResponse:
    response_status: Optional[ResponseStatus] = None
    detail: Optional[SvcDetail] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class KpiV2DetailRequest:
    branch_id: Optional[str] = None
    station_id: Optional[str] = None
    employee_id: Optional[str] = None
    from_date: datetime.datetime = datetime.datetime(1, 1, 1)
    to_date: datetime.datetime = datetime.datetime(1, 1, 1)

Python KpiV2DetailRequest DTOs

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

HTTP + XML

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

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

<KpiV2DetailRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
  <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
  <FromDate>0001-01-01T00:00:00</FromDate>
  <StationId>00000000-0000-0000-0000-000000000000</StationId>
  <ToDate>0001-01-01T00:00:00</ToDate>
</KpiV2DetailRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<KpiV2DetailResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Detail>
    <BranchMetrics>
      <AbandonRate>0</AbandonRate>
      <Abandoned>0</Abandoned>
      <ApptNoShows>0</ApptNoShows>
      <Appts>0</Appts>
      <AvgFee>0</AvgFee>
      <AvgServiceSec>0</AvgServiceSec>
      <AvgWaitSec>0</AvgWaitSec>
      <AvgWalkUpSec>0</AvgWalkUpSec>
      <Called>0</Called>
      <CalledUp>0</CalledUp>
      <CancelledAtWindow>0</CancelledAtWindow>
      <Checkins>0</Checkins>
      <Contribution>0</Contribution>
      <ExpectedFeesPerStaffedHour>0</ExpectedFeesPerStaffedHour>
      <ExpectedServiceSec>0</ExpectedServiceSec>
      <FeesEarned>0</FeesEarned>
      <FeesPerStaffedHour>0</FeesPerStaffedHour>
      <HourlyCost xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:decimal>0</d4p1:decimal>
      </HourlyCost>
      <HourlyFees xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:decimal>0</d4p1:decimal>
      </HourlyFees>
      <HourlyServed xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:int>0</d4p1:int>
      </HourlyServed>
      <IdleSec>0</IdleSec>
      <IdleShare>0</IdleShare>
      <LaborCost>0</LaborCost>
      <LaborLocked>false</LaborLocked>
      <LaborPartial>false</LaborPartial>
      <LostFees>0</LostFees>
      <LostNoShowFees>0</LostNoShowFees>
      <MaxWaitSec>0</MaxWaitSec>
      <MedianServiceSec>0</MedianServiceSec>
      <MissingCost>
        <SvcNamedTime>
          <Id>00000000-0000-0000-0000-000000000000</Id>
          <Name>String</Name>
          <Served>0</Served>
          <SignedSec>0</SignedSec>
        </SvcNamedTime>
      </MissingCost>
      <MissingCostEmployeeIds xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:guid>00000000-0000-0000-0000-000000000000</d4p1:guid>
      </MissingCostEmployeeIds>
      <Mix xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfguidint>
          <d4p1:Key>00000000-0000-0000-0000-000000000000</d4p1:Key>
          <d4p1:Value>0</d4p1:Value>
        </d4p1:KeyValueOfguidint>
      </Mix>
      <NoShowRate>0</NoShowRate>
      <NoShows>0</NoShows>
      <OpenDays>0</OpenDays>
      <PausedSec>0</PausedSec>
      <PausedShare>0</PausedShare>
      <Served>0</Served>
      <ServingSec>0</ServingSec>
      <Sessions>0</Sessions>
      <SignedSec>0</SignedSec>
      <Tints>
        <SvcTint>
          <BranchValue>0</BranchValue>
          <Field>String</Field>
          <Reason>String</Reason>
          <Reference>0</Reference>
          <Tone>String</Tone>
          <Value>0</Value>
        </SvcTint>
      </Tints>
      <UnstaffedSec>0</UnstaffedSec>
      <Utilization>0</Utilization>
      <Walkins>0</Walkins>
    </BranchMetrics>
    <CanSeeFinancial>false</CanSeeFinancial>
    <CanSeePay>false</CanSeePay>
    <CanSeeStaff>false</CanSeeStaff>
    <Clerk>
      <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
      <LoadedRate>0</LoadedRate>
      <Metrics>
        <AbandonRate>0</AbandonRate>
        <Abandoned>0</Abandoned>
        <ApptNoShows>0</ApptNoShows>
        <Appts>0</Appts>
        <AvgFee>0</AvgFee>
        <AvgServiceSec>0</AvgServiceSec>
        <AvgWaitSec>0</AvgWaitSec>
        <AvgWalkUpSec>0</AvgWalkUpSec>
        <Called>0</Called>
        <CalledUp>0</CalledUp>
        <CancelledAtWindow>0</CancelledAtWindow>
        <Checkins>0</Checkins>
        <Contribution>0</Contribution>
        <ExpectedFeesPerStaffedHour>0</ExpectedFeesPerStaffedHour>
        <ExpectedServiceSec>0</ExpectedServiceSec>
        <FeesEarned>0</FeesEarned>
        <FeesPerStaffedHour>0</FeesPerStaffedHour>
        <HourlyCost xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:decimal>0</d5p1:decimal>
        </HourlyCost>
        <HourlyFees xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:decimal>0</d5p1:decimal>
        </HourlyFees>
        <HourlyServed xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:int>0</d5p1:int>
        </HourlyServed>
        <IdleSec>0</IdleSec>
        <IdleShare>0</IdleShare>
        <LaborCost>0</LaborCost>
        <LaborLocked>false</LaborLocked>
        <LaborPartial>false</LaborPartial>
        <LostFees>0</LostFees>
        <LostNoShowFees>0</LostNoShowFees>
        <MaxWaitSec>0</MaxWaitSec>
        <MedianServiceSec>0</MedianServiceSec>
        <MissingCost>
          <SvcNamedTime>
            <Id>00000000-0000-0000-0000-000000000000</Id>
            <Name>String</Name>
            <Served>0</Served>
            <SignedSec>0</SignedSec>
          </SvcNamedTime>
        </MissingCost>
        <MissingCostEmployeeIds xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:guid>00000000-0000-0000-0000-000000000000</d5p1:guid>
        </MissingCostEmployeeIds>
        <Mix xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfguidint>
            <d5p1:Key>00000000-0000-0000-0000-000000000000</d5p1:Key>
            <d5p1:Value>0</d5p1:Value>
          </d5p1:KeyValueOfguidint>
        </Mix>
        <NoShowRate>0</NoShowRate>
        <NoShows>0</NoShows>
        <OpenDays>0</OpenDays>
        <PausedSec>0</PausedSec>
        <PausedShare>0</PausedShare>
        <Served>0</Served>
        <ServingSec>0</ServingSec>
        <Sessions>0</Sessions>
        <SignedSec>0</SignedSec>
        <Tints>
          <SvcTint>
            <BranchValue>0</BranchValue>
            <Field>String</Field>
            <Reason>String</Reason>
            <Reference>0</Reference>
            <Tone>String</Tone>
            <Value>0</Value>
          </SvcTint>
        </Tints>
        <UnstaffedSec>0</UnstaffedSec>
        <Utilization>0</Utilization>
        <Walkins>0</Walkins>
      </Metrics>
      <Name>String</Name>
      <RateLocked>false</RateLocked>
      <RateSet>false</RateSet>
      <Windows>
        <SvcNamedTime>
          <Id>00000000-0000-0000-0000-000000000000</Id>
          <Name>String</Name>
          <Served>0</Served>
          <SignedSec>0</SignedSec>
        </SvcNamedTime>
      </Windows>
    </Clerk>
    <Kind>String</Kind>
    <PerRowAverage>
      <AvgServiceSec>0</AvgServiceSec>
      <AvgWaitSec>0</AvgWaitSec>
      <Contribution>0</Contribution>
      <Count>0</Count>
      <FeesEarned>0</FeesEarned>
      <FeesPerStaffedHour>0</FeesPerStaffedHour>
      <IdleSec>0</IdleSec>
      <LaborCost>0</LaborCost>
      <LostNoShowFees>0</LostNoShowFees>
      <MedianServiceSec>0</MedianServiceSec>
      <NoShows>0</NoShows>
      <PausedSec>0</PausedSec>
      <Served>0</Served>
      <SignedSec>0</SignedSec>
      <Utilization>0</Utilization>
    </PerRowAverage>
    <Services>
      <SvcServiceRow>
        <AvgServiceSec>0</AvgServiceSec>
        <BranchAvgServiceSec>0</BranchAvgServiceSec>
        <BranchFeePerMinute>0</BranchFeePerMinute>
        <Completed>0</Completed>
        <FeeChanges>
          <SvcFeeChange>
            <FromFee>0</FromFee>
            <LocationId>00000000-0000-0000-0000-000000000000</LocationId>
            <OnDate>0001-01-01T00:00:00</OnDate>
            <ToFee>0</ToFee>
          </SvcFeeChange>
        </FeeChanges>
        <FeeCurrent>0</FeeCurrent>
        <FeeMax>0</FeeMax>
        <FeeMin>0</FeeMin>
        <FeePerMinute>0</FeePerMinute>
        <FeesEarned>0</FeesEarned>
        <LineId>00000000-0000-0000-0000-000000000000</LineId>
        <Name>String</Name>
      </SvcServiceRow>
    </Services>
    <Sessions>
      <SvcSession>
        <EmployeeId>00000000-0000-0000-0000-000000000000</EmployeeId>
        <EmployeeName>String</EmployeeName>
        <EndReason>String</EndReason>
        <IsOpen>false</IsOpen>
        <LocalIn>0001-01-01T00:00:00</LocalIn>
        <LocalOut>0001-01-01T00:00:00</LocalOut>
        <PausedSec>0</PausedSec>
        <SessionId>00000000-0000-0000-0000-000000000000</SessionId>
        <StationId>00000000-0000-0000-0000-000000000000</StationId>
        <StationName>String</StationName>
      </SvcSession>
    </Sessions>
    <Window>
      <Clerks>
        <SvcNamedTime>
          <Id>00000000-0000-0000-0000-000000000000</Id>
          <Name>String</Name>
          <Served>0</Served>
          <SignedSec>0</SignedSec>
        </SvcNamedTime>
      </Clerks>
      <LastStaffedBy>String</LastStaffedBy>
      <LastStaffedUtc>0001-01-01T00:00:00</LastStaffedUtc>
      <Metrics>
        <AbandonRate>0</AbandonRate>
        <Abandoned>0</Abandoned>
        <ApptNoShows>0</ApptNoShows>
        <Appts>0</Appts>
        <AvgFee>0</AvgFee>
        <AvgServiceSec>0</AvgServiceSec>
        <AvgWaitSec>0</AvgWaitSec>
        <AvgWalkUpSec>0</AvgWalkUpSec>
        <Called>0</Called>
        <CalledUp>0</CalledUp>
        <CancelledAtWindow>0</CancelledAtWindow>
        <Checkins>0</Checkins>
        <Contribution>0</Contribution>
        <ExpectedFeesPerStaffedHour>0</ExpectedFeesPerStaffedHour>
        <ExpectedServiceSec>0</ExpectedServiceSec>
        <FeesEarned>0</FeesEarned>
        <FeesPerStaffedHour>0</FeesPerStaffedHour>
        <HourlyCost xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:decimal>0</d5p1:decimal>
        </HourlyCost>
        <HourlyFees xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:decimal>0</d5p1:decimal>
        </HourlyFees>
        <HourlyServed xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:int>0</d5p1:int>
        </HourlyServed>
        <IdleSec>0</IdleSec>
        <IdleShare>0</IdleShare>
        <LaborCost>0</LaborCost>
        <LaborLocked>false</LaborLocked>
        <LaborPartial>false</LaborPartial>
        <LostFees>0</LostFees>
        <LostNoShowFees>0</LostNoShowFees>
        <MaxWaitSec>0</MaxWaitSec>
        <MedianServiceSec>0</MedianServiceSec>
        <MissingCost>
          <SvcNamedTime>
            <Id>00000000-0000-0000-0000-000000000000</Id>
            <Name>String</Name>
            <Served>0</Served>
            <SignedSec>0</SignedSec>
          </SvcNamedTime>
        </MissingCost>
        <MissingCostEmployeeIds xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:guid>00000000-0000-0000-0000-000000000000</d5p1:guid>
        </MissingCostEmployeeIds>
        <Mix xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfguidint>
            <d5p1:Key>00000000-0000-0000-0000-000000000000</d5p1:Key>
            <d5p1:Value>0</d5p1:Value>
          </d5p1:KeyValueOfguidint>
        </Mix>
        <NoShowRate>0</NoShowRate>
        <NoShows>0</NoShows>
        <OpenDays>0</OpenDays>
        <PausedSec>0</PausedSec>
        <PausedShare>0</PausedShare>
        <Served>0</Served>
        <ServingSec>0</ServingSec>
        <Sessions>0</Sessions>
        <SignedSec>0</SignedSec>
        <Tints>
          <SvcTint>
            <BranchValue>0</BranchValue>
            <Field>String</Field>
            <Reason>String</Reason>
            <Reference>0</Reference>
            <Tone>String</Tone>
            <Value>0</Value>
          </SvcTint>
        </Tints>
        <UnstaffedSec>0</UnstaffedSec>
        <Utilization>0</Utilization>
        <Walkins>0</Walkins>
      </Metrics>
      <Name>String</Name>
      <NeverStaffed>false</NeverStaffed>
      <StationId>00000000-0000-0000-0000-000000000000</StationId>
    </Window>
  </Detail>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</KpiV2DetailResponse>