Overview
Corrective actions are tasks created to address issues identified during inspections (submissions). When inspectors flag non-compliant items, those flags can be converted into actionable tasks for resolution.
Workflow:
Inspector completes a submission and flags non-compliant items
System captures flagged items with notes and photos
Manager reviews flagged items report
Tasks or work orders are created from flagged items
Issues are resolved and verified
Get Flagged Items
Retrieve all flagged (non-compliant) items from submissions.
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/submissions/flagged-items" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"checklistId": "template-uuid",
"dateFrom": "2024-12-01",
"dateTo": "2024-12-31",
"locationIds": ["location-uuid"]
}'
Request Body:
Field Type Required Description checklistIdstring No Filter by template dateFromstring No Start date (YYYY-MM-DD) dateTostring No End date (YYYY-MM-DD) locationIdsstring[] No Filter by locations flagCategoryIdsstring[] No Filter by flag categories assigneeIdsstring[] No Filter by submitter
Response:
{
"status" : "success" ,
"code" : 200 ,
"data" : [
{
"submissionId" : "submission-uuid-1" ,
"submissionDate" : "2024-12-15T10:30:00Z" ,
"submissionNumber" : "SUB-2024-001234" ,
"template" : {
"id" : "template-uuid" ,
"title" : "Daily Safety Inspection"
},
"location" : {
"id" : "location-uuid" ,
"name" : "Building A - Floor 2"
},
"submitter" : {
"id" : "user-uuid" ,
"fullName" : "John Smith"
},
"flaggedItem" : {
"id" : "item-uuid" ,
"title" : "Fire extinguisher inspection tag current?" ,
"sectionTitle" : "Fire Safety" ,
"answer" : "no" ,
"flagNote" : "Tag expired 2 months ago. Needs immediate replacement." ,
"flagCategory" : {
"id" : "category-uuid" ,
"name" : "Safety Violation"
},
"attachments" : [
"https://storage.example.com/photos/expired-tag-001.jpg"
]
}
},
{
"submissionId" : "submission-uuid-2" ,
"submissionDate" : "2024-12-16T14:00:00Z" ,
"submissionNumber" : "SUB-2024-001248" ,
"template" : {
"id" : "template-uuid" ,
"title" : "Daily Safety Inspection"
},
"location" : {
"id" : "location-uuid" ,
"name" : "Building A - Floor 2"
},
"submitter" : {
"id" : "user-uuid-2" ,
"fullName" : "Jane Doe"
},
"flaggedItem" : {
"id" : "item-uuid-2" ,
"title" : "Emergency exit clear and unobstructed?" ,
"sectionTitle" : "Fire Safety" ,
"answer" : "no" ,
"flagNote" : "Boxes blocking exit. Moved to storeroom." ,
"flagCategory" : {
"id" : "category-uuid-2" ,
"name" : "Housekeeping"
},
"attachments" : []
}
}
]
}
Flag Categories
Flag categories help classify issues for routing and reporting.
List Flag Categories
curl -X GET "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/flag-categories" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}"
Response:
{
"status" : "success" ,
"code" : 200 ,
"data" : [
{
"id" : "category-uuid-1" ,
"name" : "Safety Violation" ,
"description" : "Issues affecting personnel safety" ,
"color" : "#FF0000"
},
{
"id" : "category-uuid-2" ,
"name" : "Maintenance Required" ,
"description" : "Equipment needing repair or service" ,
"color" : "#FFA500"
},
{
"id" : "category-uuid-3" ,
"name" : "Housekeeping" ,
"description" : "Cleanliness and organization issues" ,
"color" : "#0000FF"
},
{
"id" : "category-uuid-4" ,
"name" : "Documentation" ,
"description" : "Missing or expired documentation" ,
"color" : "#808080"
}
]
}
Create Flag Category
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/flag-category" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"name": "Regulatory Compliance",
"description": "Issues requiring regulatory attention",
"color": "#9932CC"
}'
Request Body:
Field Type Required Description namestring Yes Category name descriptionstring No Category description colorstring No Hex color code for visual identification
Response:
{
"status" : "success" ,
"code" : 200 ,
"data" : {
"id" : "new-category-uuid" ,
"name" : "Regulatory Compliance" ,
"description" : "Issues requiring regulatory attention" ,
"color" : "#9932CC" ,
"createdAt" : "2024-12-20T10:00:00Z"
}
}
Update Flag Category
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/flag-category" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"id": "category-uuid",
"name": "Updated Category Name",
"description": "Updated description",
"color": "#FF6600"
}'
Include the id field to update an existing category. Without id, a new category is created.
Delete Flag Category
curl -X DELETE "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/flag-category/{categoryId}" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}"
Create Corrective Action Tasks
Convert flagged items into tasks for resolution.
Create Task from Flagged Item
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/tasks" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"title": "Replace expired fire extinguisher tag - Building A Floor 2",
"description": "Found during Daily Safety Inspection (SUB-2024-001234).\n\nIssue: Tag expired 2 months ago. Needs immediate replacement.",
"startDate": "2024-12-20T09:00:00Z",
"dueDate": "2024-12-20T17:00:00Z",
"priority": "High",
"assignees": ["maintenance-user-uuid"],
"locationIds": ["location-uuid"],
"AssetId": "fire-extinguisher-asset-uuid",
"attachment": ["https://storage.example.com/photos/expired-tag-001.jpg"]
}'
Create Work Order from Flagged Item
For issues requiring facility maintenance.
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/tasks/work-orders" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"title": "Repair emergency exit door - Building A Floor 2",
"description": "Found during Daily Safety Inspection.\n\nIssue: Door not closing properly. Safety hazard.",
"startDate": "2024-12-20T09:00:00Z",
"dueDate": "2024-12-21T17:00:00Z",
"priority": "High",
"locationIds": ["location-uuid"],
"ServiceTypeId": "maintenance-category-uuid"
}'
Common Workflows
Automated Corrective Action Processing
Daily Corrective Action Report
#!/bin/bash
# Generate daily corrective action report
WORKSPACE_ID = "your-workspace-uuid"
TODAY = $( date +%Y-%m-%d )
YESTERDAY = $( date -d "yesterday" +%Y-%m-%d )
# Get flagged items from yesterday
FLAGGED = $( curl -s -X POST "https://api.xenia.team/api/v1/ops/workspaces/${ WORKSPACE_ID }/submissions/flagged-items" \
-H "x-client-key: YOUR_KEY" \
-H "x-client-secret: YOUR_SECRET" \
-H "workspace-id: ${ WORKSPACE_ID }" \
-H "Content-Type: application/json" \
-d "{
\" dateFrom \" : \" ${ YESTERDAY } \" ,
\" dateTo \" : \" ${ TODAY } \"
}" )
# Count by category
echo "Flagged Items by Category:"
echo " $FLAGGED " | jq -r '.data | group_by(.flaggedItem.flagCategory.name) | .[] | "\(.[0].flaggedItem.flagCategory.name): \(length)"'
# Count by location
echo ""
echo "Flagged Items by Location:"
echo " $FLAGGED " | jq -r '.data | group_by(.location.name) | .[] | "\(.[0].location.name): \(length)"'
# List high-priority items (Safety Violations)
echo ""
echo "Safety Violations requiring immediate attention:"
echo " $FLAGGED " | jq -r '.data[] | select(.flaggedItem.flagCategory.name == "Safety Violation") | "\(.location.name): \(.flaggedItem.title)"'
Bulk Create Tasks from Flagged Items
#!/bin/bash
# Create corrective action tasks for all flagged items
WORKSPACE_ID = "your-workspace-uuid"
# Get unprocessed flagged items
FLAGGED = $( curl -s -X POST "https://api.xenia.team/api/v1/ops/workspaces/${ WORKSPACE_ID }/submissions/flagged-items" \
-H "x-client-key: YOUR_KEY" \
-H "x-client-secret: YOUR_SECRET" \
-H "workspace-id: ${ WORKSPACE_ID }" \
-H "Content-Type: application/json" \
-d '{
"dateFrom": "2024-12-19",
"dateTo": "2024-12-20"
}' )
# Process each flagged item
echo " $FLAGGED " | jq -c '.data[]' | while read item ; do
TITLE = $( echo " $item " | jq -r '.flaggedItem.title' )
LOCATION_ID = $( echo " $item " | jq -r '.location.id' )
LOCATION_NAME = $( echo " $item " | jq -r '.location.name' )
NOTE = $( echo " $item " | jq -r '.flaggedItem.flagNote' )
SUBMISSION_NUM = $( echo " $item " | jq -r '.submissionNumber' )
CATEGORY = $( echo " $item " | jq -r '.flaggedItem.flagCategory.name' )
# Set priority based on category
PRIORITY = "Medium"
if [ " $CATEGORY " == "Safety Violation" ]; then
PRIORITY = "High"
fi
# Create task
curl -s -X POST "https://api.xenia.team/api/v1/ops/workspaces/${ WORKSPACE_ID }/tasks" \
-H "x-client-key: YOUR_KEY" \
-H "x-client-secret: YOUR_SECRET" \
-H "workspace-id: ${ WORKSPACE_ID }" \
-H "Content-Type: application/json" \
-d "{
\" title \" : \" Corrective Action: ${ TITLE } \" ,
\" description \" : \" Source: ${ SUBMISSION_NUM } \\ nLocation: ${ LOCATION_NAME } \\ nCategory: ${ CATEGORY } \\ n \\ nIssue: ${ NOTE } \" ,
\" startDate \" : \" $( date -u +%Y-%m-%dT%H:%M:%SZ) \" ,
\" dueDate \" : \" $( date -u -d '+3 days' +%Y-%m-%dT%H:%M:%SZ) \" ,
\" priority \" : \" ${ PRIORITY } \" ,
\" locationIds \" : [ \" ${ LOCATION_ID } \" ]
}"
echo "Created corrective action for: ${ TITLE }"
done
Track Corrective Action Resolution
Monitor Open Corrective Actions
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/tasks/list" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"page": 1,
"pageSize": 50,
"sort": {
"field": "dueDate",
"direction": "ASC"
},
"searchText": "Corrective Action",
"filters": {
"taskStatus": ["Open", "In Progress", "On Hold"]
}
}'
Verify Resolution with Follow-up Inspection
Link a follow-up inspection to verify the corrective action was completed.
curl -X POST "https://api.xenia.team/api/v1/ops/workspaces/{workspaceId}/tasks/{taskId}/edit" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET" \
-H "workspace-id: {workspaceId}" \
-H "Content-Type: application/json" \
-d '{
"ChecklistId": "verification-checklist-uuid",
"isChecklistRequired": true
}'
Best Practices
Define clear flag categories
Create categories that match your operational needs (Safety, Maintenance, Compliance, etc.). Clear categories enable better routing and reporting.
Include context in corrective actions
When creating tasks from flagged items, include the source submission number, original inspector notes, and any photos. This context helps assignees understand and resolve issues.
Set appropriate priorities
Use flag categories to drive priority. Safety violations should typically be high priority; housekeeping issues may be lower priority.
Monitor how long corrective actions take to resolve. Chronic delays may indicate systemic issues or resource constraints.
For critical issues, attach a verification checklist to the corrective action task. This ensures the fix is confirmed before the task is closed.
Use scheduled jobs to automatically generate corrective action tasks from flagged items. This ensures nothing falls through the cracks.
Reporting Integration
Export Flagged Items for BI
# Extract flagged items for business intelligence
curl -s -X POST "https://api.xenia.team/api/v1/ops/workspaces/${ WORKSPACE_ID }/submissions/flagged-items" \
-H "x-client-key: YOUR_KEY" \
-H "x-client-secret: YOUR_SECRET" \
-H "workspace-id: ${ WORKSPACE_ID }" \
-H "Content-Type: application/json" \
-d '{
"dateFrom": "2024-01-01",
"dateTo": "2024-12-31"
}' | jq '[.data[] | {
date: .submissionDate,
location: .location.name,
template: .template.title,
category: .flaggedItem.flagCategory.name,
item: .flaggedItem.title,
note: .flaggedItem.flagNote
}]' > flagged_items_2024.json