Trendsic Platform Service

<back to all web services

SafetyComplianceRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/safety/compliance
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 SafetyComplianceKpis:
    participation_pct: int = 0
    open_incidents: int = 0
    overdue_c_as: int = 0
    recordables12mo: int = 0
    days_without_recordable: int = 0
    projects_with_talk_today: int = 0
    projects_with_crew_today: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyComplianceProject:
    project_i_d: int = 0
    project_u_i_d: Optional[str] = None
    project_name: Optional[str] = None
    branch: Optional[str] = None
    crew_count: int = 0
    has_talk_today: bool = False
    talk_ack_pct: int = 0
    open_incidents: int = 0
    overdue_c_as: int = 0
    recordables12mo: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyTrendWeek:
    week_start: Optional[str] = None
    acks: int = 0
    roster: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyIncidentMixRow:
    severity: Optional[str] = None
    cnt: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyMissingTalk:
    project_i_d: int = 0
    project_u_i_d: Optional[str] = None
    project_name: Optional[str] = None
    crew_count: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyComplianceResponse:
    response_status: Optional[ResponseStatus] = None
    kpis: Optional[SafetyComplianceKpis] = None
    projects: List[SafetyComplianceProject] = field(default_factory=list)
    trend: List[SafetyTrendWeek] = field(default_factory=list)
    incident_mix: List[SafetyIncidentMixRow] = field(default_factory=list)
    missing_talks: List[SafetyMissingTalk] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SafetyComplianceRequest:
    days: int = 0

Python SafetyComplianceRequest DTOs

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

HTTP + JSV

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

GET /v1/safety/compliance HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Kpis: 
	{
		ParticipationPct: 0,
		OpenIncidents: 0,
		OverdueCAs: 0,
		Recordables12mo: 0,
		DaysWithoutRecordable: 0,
		ProjectsWithTalkToday: 0,
		ProjectsWithCrewToday: 0
	},
	Projects: 
	[
		{
			ProjectID: 0,
			ProjectUID: String,
			ProjectName: String,
			Branch: String,
			CrewCount: 0,
			HasTalkToday: False,
			TalkAckPct: 0,
			OpenIncidents: 0,
			OverdueCAs: 0,
			Recordables12mo: 0
		}
	],
	Trend: 
	[
		{
			WeekStart: String,
			Acks: 0,
			Roster: 0
		}
	],
	IncidentMix: 
	[
		{
			Severity: String,
			Cnt: 0
		}
	],
	MissingTalks: 
	[
		{
			ProjectID: 0,
			ProjectUID: String,
			ProjectName: String,
			CrewCount: 0
		}
	]
}