Accuracy Checks

Endpoints


Create accuracy check report

POST/accuracy_check

Roles:

accuracycheck:write

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time

Response

Returns created accuracy check report

{
"status": "ok",
"data": {
"id": "cba63348-2d94-4dfe-a15f-c3b34b502e9a",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"facilityIds": [],
"alertTypeIds": [],
"jobIds": [],
"start": 1614546000,
"end": 1615150799,
"status": "inprogress",
"createdAt": "2021-03-16T12:44:11Z"
}
}

Get accuracy check reports

GET/accuracy_check

Roles:

accuracycheck:read

Arguments

QUERY STRING PARAMETERS
  • facilityId Array[UUID] optional Facility ids
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • alertTypeId Array[String] required Type of alerts
  • status String optional Report status
  • page Int optional Requested result page
  • count Int optional Requested result count in a page

Response

Returns accuracy check reports in given time range with paging

{
"status": "ok",
"data": {
"page": 1,
"count": 10,
"total": 2,
"reports": [
{
"id": "cba63348-2d94-4dfe-a15f-c3b34b502e9a",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"facilityIds": [],
"alertTypeIds": [],
"jobIds": [],
"start": 1614546000,
"end": 1615150799,
"status": "inprogress",
"createdAt": "2021-03-16T12:44:11Z"
}
]
}
}

Get report

GET/accuracy_check/:reportId

Roles:

accuracycheck:read

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report

Response

Returns accuracy check report

{
"status": "ok",
"data": {
"id": "cba63348-2d94-4dfe-a15f-c3b34b502e9a",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"facilityIds": [],
"alertTypeIds": [],
"jobIds": [],
"start": 1614546000,
"end": 1615150799,
"status": "inprogress",
"createdAt": "2021-03-16T12:44:11Z"
}
}

Update report

PATCH/accuracy_check/:reportId

Roles:

accuracycheck:write

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
BODY
  • status String required Report status. Can be one of inprogress, done.

Response

Returns updated accuracy check report

{
"status": "ok",
"data": {
"id": "cba63348-2d94-4dfe-a15f-c3b34b502e9a",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"facilityIds": [],
"alertTypeIds": [],
"jobIds": [],
"start": 1614546000,
"end": 1615150799,
"status": "inprogress",
"createdAt": "2021-03-16T12:44:11Z"
}
}

Delete report

DELETE/accuracy_check/:reportId

Roles:

accuracycheck:delete

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report

Response

Returns deleted report count.

{
"status": "ok",
"message": "Accuracy check report deleted"
}

Get sample size

POST/accuracy_check/sample_size

Roles:

accuracycheck:read

Arguments

BODY
  • facilityId UUID required Facility id
  • cameraId Array[UUID] required Camera ids
  • alertTypeId Enum required Alert type
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • confidenceLevel Double required Confidence level
  • marginOfError Double required Margin of error

Response

Returns sample size

{
"status": "ok",
"data": 12
}

Create accuracy check job

POST/accuracy_check/:reportId/jobs

Roles:

accuracycheck:write

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
BODY
  • facilityId UUID required Facility id
  • cameraIds Array[UUID] required Camera ids
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • alertTypeId String required Alert type
  • confidenceLevel Double required Confidence level
  • marginOfError Double required Margin of error

Response

Returns created accuracy check job

{
"status": "ok",
"data": {
"id": "71d66feb-11a1-4f93-a08f-70a816705ea8",
"reportId": "5a4bdf1a-3e76-4442-bed0-71be61422a0f",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"a066158d-26ee-4a47-80df-9869273da21d"
],
"alertTypeId": "SOCIAL_DISTANCE",
"start": 1614546000,
"end": 1615150799,
"totalItemCount": 7,
"sampleSize": 4,
"flaggedCount": 0,
"marginOfError": 0.11038929770519285,
"confidenceLevel": 0.5,
"createdAt": "2021-03-16T13:25:55Z",
"status": "inprogress"
}
}

Get jobs in a report

GET/accuracy_check/:reportId/jobs

Roles:

accuracycheck:read

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report

Response

Returns accuracy jobs in report

{
"status": "ok",
"data": [
{
"id": "d1d1b0b0-32d6-4de6-b2cc-9ab90289e6f7",
"reportId": "5a4bdf1a-3e76-4442-bed0-71be61422a0f",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"a066158d-26ee-4a47-80df-9869273da21d"
],
"alertTypeIds": "SOCIAL_DISTANCE",
"start": 1614546000,
"end": 1615150799,
"totalItemCount": 21,
"sampleSize": 9,
"flaggedCount": 2,
"marginOfError": 0.0849777209943291,
"confidenceLevel": 0.5,
"createdAt": "2021-03-15T19:51:00Z",
"status": "done"
}
]
}

Get job in a report

GET/accuracy_check/:reportId/jobs/:jobId

Roles:

accuracycheck:read

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job

Response

Returns accuracy job in report

{
"status": "ok",
"data": {
"id": "e7aa05d3-3b6c-4419-802c-fdc726b18c0e",
"reportId": "5a4bdf1a-3e76-4442-bed0-71be61422a0f",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"a066158d-26ee-4a47-80df-9869273da21d"
],
"alertTypeId": "SOCIAL_DISTANCE",
"start": 1614546000,
"end": 1615150799,
"totalItemCount": 12,
"sampleSize": 5,
"flaggedCount": 1,
"marginOfError": 0.11519105437339393,
"confidenceLevel": 0.5,
"createdAt": "2021-03-15T20:04:41Z",
"status": "done"
}
}

Update job in a report

PATCH/accuracy_check/:reportId/jobs/:jobId

Roles:

accuracycheck:write

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job
BODY
  • status String required Report status. Can be one of inprogress, done.

Response

Returns updated accuracy job in report

{
"status": "ok",
"data": {
"id": "e7aa05d3-3b6c-4419-802c-fdc726b18c0e",
"reportId": "5a4bdf1a-3e76-4442-bed0-71be61422a0f",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"a066158d-26ee-4a47-80df-9869273da21d"
],
"alertTypeId": "SOCIAL_DISTANCE",
"start": 1614546000,
"end": 1615150799,
"totalItemCount": 12,
"sampleSize": 5,
"flaggedCount": 1,
"marginOfError": 0.11519105437339393,
"confidenceLevel": 0.5,
"createdAt": "2021-03-15T20:04:41Z",
"status": "done"
}
}

Delete job in a report

DELETE/accuracy_check/:reportId/jobs/:jobId

Roles:

accuracycheck:delete

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job

Response

Returns deleted job count.

{
"status": "ok",
"message": "Accuracy check job deleted"
}

Get alerts in a job

GET/accuracy_check/:reportId/jobs/:jobId/alerts

Roles:

accuracycheck:read

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job
QUERY STRING PARAMETERS
  • alertId UUID optional Id of alert
  • page Int optional Requested result page
  • count Int optional Requested result count in a page

Response

Returns alerts in accuracy a job

{
"status": "ok",
"data": {
"accuracyCheckJob": {
"id": "65393012-fd3d-43bc-888a-fd4f17fc70e8",
"reportId": "df7455be-5540-477f-99bf-1abeb50c8e9a",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"93542740-b842-467f-96d2-bc76a46dfd7b"
],
"alertTypeId": "UNATTENDED_OBJECT_DETECTION",
"start": 1617580800,
"end": 1618185599,
"marginOfError": 0.04994845565258412,
"confidenceLevel": 0.95,
"totalAlertCount": 434,
"sampleSize": 204,
"falsePositiveCount": 0,
"flaggedCount": 0,
"status": "inprogress",
"createdAt": 1623419216.329
},
"page": 1,
"count": 10,
"total": 204,
"alerts": [
{
"id": "3db8edcf-3331-4061-9371-bbf0e0d264d6",
"cameraId": "9693bff0-665d-40ff-9ad8-fb4d97407a82",
"name": "UNATTENDED_OBJECT_DETECTION",
"count": 0,
"createdAt": "2021-04-04T22:13:59Z",
"url": "",
"imageDimensions": {
"width": 1280,
"height": 960
},
"canvasDimensions": {
"width": 1280,
"height": 960
},
"violatingCoordinates": [],
"area": [
{
"points": [
{
"x": 141,
"y": 947
},
{
"x": 524,
"y": 476
},
{
"x": 626,
"y": 470
},
{
"x": 649,
"y": 740
},
{
"x": 464,
"y": 736
},
{
"x": 464,
"y": 788
},
{
"x": 612,
"y": 790
},
{
"x": 614,
"y": 825
},
{
"x": 657,
"y": 826
},
{
"x": 673,
"y": 947
}
]
},
{
"points": [
{
"x": 513,
"y": 786
},
{
"x": 513,
"y": 870
},
{
"x": 606,
"y": 870
},
{
"x": 606,
"y": 786
}
]
}
],
"storageClass": "S3",
"info": {},
"bookmark": false,
"alertRuleId": "e93c66db-5e47-4330-b05a-7668362cd2c8",
"localCreatedAt": "2021-04-05T01:13:59Z",
"videoUrl": "",
"workspaceId": "f213e5dd-4b92-46f0-95df-0b9dfff4e588",
"areaIds": [
"a3940798-9ae5-4772-af6f-a9a9105fcae6"
]
}
]
}
}

Delete alert from a job

DELETE/accuracy_check/:reportId/jobs/:jobId/alerts/:alertId

Roles:

accuracycheck:delete

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job
  • alertId UUID required Id of alert

Response

{
"status": "ok",
"message": "Removed"
}

Resample an alert in a job

POST/accuracy_check/:reportId/jobs/:jobId/images/:alertId/resample

Roles:

accuracycheck:write

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job
  • alertId UUID required Id of alert

Response

{
"status": "ok",
"data": "65836d77-729f-4a57-ae09-2b201e3dabe0"
}

Add alert samples to a job

PUT/accuracy_check/:reportId/jobs/:jobId/add_alert_samples

Roles:

accuracycheck:write

Arguments

PATH PARAMETERS
  • reportId UUID required Id of accuracy check report
  • jobId UUID required Id of accuracy check job
QUERY PARAMETERS
  • nMoreSamples Int required Add n more samples

Response

{
"status": "ok",
"data": [
{
"id": "4066586c-dee8-403c-acc8-92d0c719af93",
"reportId": "95d8ea2e-809b-4d75-ba78-2d18e1d1809e",
"facilityId": "156bd472-07a6-4680-8e17-11816681e14a",
"cameraIds": [
"a9714296-0891-4645-a71e-927b4f063076"
],
"alertTypeId": "UNATTENDED_OBJECT_DETECTION",
"start": 1617580800,
"end": 1618185599,
"marginOfError": 0.048808037605659695,
"confidenceLevel": 0.95,
"totalAlertCount": 434,
"sampleSize": 209,
"falsePositiveCount": 0,
"flaggedCount": 0,
"status": "inprogress",
"createdAt": 1623418867.362
},
[
"55f8744b-d60e-4a6c-adf8-0f4921d61f08",
"32b02bab-7c38-45f6-a883-15665d0fa9fe",
"ea1f5d96-181e-4c3c-a2be-bf6c2da8e88a",
"f01ae933-e649-4a45-9d0f-24f8e38165d0",
"7abb3816-60c3-47bd-8cec-8d3525b8e02c"
]
]
}

Get total flagged count

POST/accuracy_check/total_flagged_count

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Response

Returns total flagged count images grouped by same ranges

{
"status": "ok",
"data": {
"series": [
{
"value": {
"totalCount": 5604,
"sampleSize": 5604,
"falsePositiveCount": 1291,
"accuracyRate": 0.7696288365453247,
"accuracyRateOfPopulation": 0.7696288365453247
},
"start": 1616371200,
"end": 1616975999.999,
"humanStartDate": "2021-03-22T00:00:00.000Z",
"humanEndDate": "2021-03-28T23:59:59.999Z"
}
],
"comparison": {
"previous": {
"totalCount": 5195,
"sampleSize": 5195,
"falsePositiveCount": 1264,
"accuracyRate": 0.756689124157844,
"accuracyRateOfPopulation": 0.756689124157844
},
"current": {
"totalCount": 5604,
"sampleSize": 5604,
"falsePositiveCount": 1291,
"accuracyRate": 0.7696288365453247,
"accuracyRateOfPopulation": 0.7696288365453247
},
"percentageChange": {
"totalCount": 0.07872954764196342,
"sampleSize": 0.07872954764196342,
"falsePositiveCount": 0.021360759493670885,
"accuracyRate": 0.017100433948858376
}
}
}
}

Get total flagged count of last completed report

POST/accuracy_check/last_report_total_flagged_alerts

Roles:

accuracycheck:read

Arguments

BODY
  • facilityId UUID optional
  • alertTypeId Array[String] optional

Response

Returns total flagged count of last completed accuracy check report

{
"status": "ok",
"data": {
"series": [
{
"value": {
"totalCount": 625,
"sampleSize": 309,
"falsePositiveCount": 32,
"accuracyRate": 0.8975043686635945,
"accuracyRateOfPopulation": [
0.8578635706914333,
0.9371451666357558
]
},
"start": 1621900800,
"end": 1621987199.999,
"humanStartDate": "Tue, 25 May 2021 00:00:00 +0000",
"humanEndDate": "Tue, 25 May 2021 23:59:59 +0000"
}
],
"comparison": {
"previous": {
"totalCount": 2865,
"sampleSize": 792,
"falsePositiveCount": 73,
"accuracyRate": 0.9078358321856909,
"accuracyRateOfPopulation": [
0.8730136883910962,
0.9426579759802856
]
},
"current": {
"totalCount": 1123,
"sampleSize": 563,
"falsePositiveCount": 55,
"accuracyRate": 0.9023534022931777,
"accuracyRateOfPopulation": [
0.8731879958328754,
0.93151880875348
]
},
"percentageChange": {
"totalCount": -0.6080279232111693,
"sampleSize": -0.28914141414141414,
"falsePositiveCount": -0.2465753424657534,
"accuracyRate": -0.0060390102462839785
}
}
}
}

Get total flagged count of last completed report by facility id

POST/accuracy_check/last_weighted_accuracy_rates_per_alert_facility

Roles:

accuracycheck:read

Arguments

BODY
  • facilityId UUID optional
  • alertTypeId Array[String] optional

Response

Returns total flagged count of last completed accuracy check report by facility id

{
"status": "ok",
"data": {
"series": [
{
"groups": [
{
"key": "156bd472-07a6-4680-8e17-11816681e14a",
"value": {
"totalCount": 625,
"sampleSize": 309,
"falsePositiveCount": 32,
"accuracyRate": 0.8975043686635945,
"accuracyRateOfPopulation": [
0.8578635706914333,
0.9371451666357558
]
}
}
],
"start": 1621900800,
"end": 1621987199.999,
"humanStartDate": "Tue, 25 May 2021 00:00:00 +0000",
"humanEndDate": "Tue, 25 May 2021 23:59:59 +0000"
}
],
"comparison": [
{
"key": "156bd472-07a6-4680-8e17-11816681e14a",
"previous": {
"totalCount": 2865,
"sampleSize": 792,
"falsePositiveCount": 73,
"accuracyRate": 0.9078358321856909,
"accuracyRateOfPopulation": [
0.8730136883910962,
0.9426579759802856
]
},
"current": {
"totalCount": 1123,
"sampleSize": 563,
"falsePositiveCount": 55,
"accuracyRate": 0.9023534022931777,
"accuracyRateOfPopulation": [
0.8731879958328754,
0.93151880875348
]
},
"percentageChange": {
"totalCount": -0.6080279232111693,
"sampleSize": -0.28914141414141414,
"falsePositiveCount": -0.2465753424657534,
"accuracyRate": -0.0060390102462839785
}
}
]
}
}

Get weighted accuracy rates

POST/accuracy_check/weighted_accuracy_rates

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Response

Returns weighted accuracy rates grouped by same ranges

{
"status": "ok",
"data": {
"value": {
"totalCount": 5604,
"sampleSize": 5604,
"falsePositiveCount": 1291,
"accuracyRate": 0.7696288365453247,
"accuracyRateOfPopulation": 0.7696288365453247
},
"comparison": {
"previous": {
"totalCount": 5195,
"sampleSize": 5195,
"falsePositiveCount": 1264,
"accuracyRate": 0.756689124157844,
"accuracyRateOfPopulation": 0.756689124157844
},
"current": {
"totalCount": 5604,
"sampleSize": 5604,
"falsePositiveCount": 1291,
"accuracyRate": 0.7696288365453247,
"accuracyRateOfPopulation": 0.7696288365453247
},
"percentageChange": {
"totalCount": 0.07872954764196342,
"sampleSize": 0.07872954764196342,
"falsePositiveCount": 0.021360759493670885,
"accuracyRate": 0.017100433948858376
}
}
}
}

Get weighted accuracy rates per alert type

POST/accuracy_check/weighted_accuracy_rates_per_alert_type

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Response

{
"status": "ok",
"data": {
"series": [
{
"groups": [
{
"key": "APRON",
"value": {
"totalCount": 120,
"sampleSize": 120,
"falsePositiveCount": 12,
"accuracyRate": 0.9,
"accuracyRateOfPopulation": 0.9
}
}
],
"start": 1616371200,
"end": 1616975999.999,
"humanStartDate": "2021-03-22T00:00:00.000Z",
"humanEndDate": "2021-03-28T23:59:59.999Z"
}
],
"comparison": [
{
"previous": {
"totalCount": 73,
"sampleSize": 73,
"falsePositiveCount": 10,
"accuracyRate": 0.863013698630137,
"accuracyRateOfPopulation": 0.863013698630137
},
"current": {
"totalCount": 120,
"sampleSize": 120,
"falsePositiveCount": 12,
"accuracyRate": 0.9,
"accuracyRateOfPopulation": 0.9
},
"percentageChange": {
"totalCount": 0.6438356164383562,
"sampleSize": 0.6438356164383562,
"falsePositiveCount": 0.2,
"accuracyRate": 0.04285714285714287
},
"key": "APRON"
}
]
}
}

Get weighted accuracy rates per alert category

POST/accuracy_check/weighted_accuracy_rates_per_alert_category

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Response

{
"status": "ok",
"data": {
"series": [
{
"groups": [
{
"key": "ANOMALY",
"value": {
"totalCount": 1612,
"sampleSize": 1612,
"falsePositiveCount": 680,
"accuracyRate": 0.5781637717121588,
"accuracyRateOfPopulation": 0.5781637717121588
}
}
],
"start": 1616371200,
"end": 1616975999.999,
"humanStartDate": "2021-03-22T00:00:00.000Z",
"humanEndDate": "2021-03-28T23:59:59.999Z"
}
],
"comparison": [
{
"previous": {
"totalCount": 1627,
"sampleSize": 1627,
"falsePositiveCount": 696,
"accuracyRate": 0.5722188076213892,
"accuracyRateOfPopulation": 0.5722188076213892
},
"current": {
"totalCount": 1612,
"sampleSize": 1612,
"falsePositiveCount": 680,
"accuracyRate": 0.5781637717121588,
"accuracyRateOfPopulation": 0.5781637717121588
},
"percentageChange": {
"totalCount": -0.00921942224953903,
"sampleSize": -0.00921942224953903,
"falsePositiveCount": -0.022988505747126436,
"accuracyRate": 0.010389319630163431
},
"key": "ANOMALY"
}
]
}
}

Get weighted accuracy rates per alert facility

POST/accuracy_check/weighted_accuracy_rates_per_alert_facility

Arguments

BODY
  • start Long required Start time of report in Unix time
  • end Long required End time of report in Unix time
  • aggregate Enum required
    • day
    • week
    • month Aggregation identifier

Response

{
"status": "ok",
"data": {
"series": [
{
"groups": [
{
"key": "823fe749-acf8-48fd-b6ab-ba65f2251056",
"value": {
"totalCount": 206,
"sampleSize": 206,
"falsePositiveCount": 43,
"accuracyRate": 0.7912621359223301,
"accuracyRateOfPopulation": 0.7912621359223301
}
}
],
"start": 1615766400,
"end": 1616371199.999,
"humanStartDate": "2021-03-15T00:00:00.000Z",
"humanEndDate": "2021-03-21T23:59:59.999Z"
}
],
"comparison": [
{
"previous": {
"totalCount": 3,
"sampleSize": 3,
"falsePositiveCount": 1,
"accuracyRate": 0.6666666666666666,
"accuracyRateOfPopulation": 0.6666666666666666
},
"current": {
"totalCount": 680,
"sampleSize": 680,
"falsePositiveCount": 106,
"accuracyRate": 0.8441176470588235,
"accuracyRateOfPopulation": 0.8441176470588235
},
"percentageChange": {
"totalCount": 225.66666666666666,
"sampleSize": 225.66666666666666,
"falsePositiveCount": 105,
"accuracyRate": 0.26617647058823535
},
"key": "823fe749-acf8-48fd-b6ab-ba65f2251056"
}
]
}
}