Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

The SafePaths mobile application collects points data in discreet format (one point every five minutes) while the SafePlaces contact tracing tool displays the same points data in duration format (see below). We need a centralized location to handle translation between the two formats .

Discreet Format

[
  {
    "id": 21,
    "longitude": 14.91328448,
    "latitude": 41.24060321,
    "time": "2020-05-30T18:25:00.511Z"
  },
  {
    "id": 22,
    "longitude": 14.91328448,
    "latitude": 41.24060321,
    "time": "2020-05-30T18:30:00.511Z"
  },
  {
    "id": 23,
    "longitude": 14.91328448,
    "latitude": 41.24060321,
    "time": "2020-05-30T18:35:00.511Z"
  }  
]
  

Duration Format

{
  "discreetPointIDs": [21, 22, 23],
  "longitude": 14.91328448,
  "latitude": 41.24060321,
  "time": "2020-05-30T18:25:00.511Z",
  "duration": 15
}

Database Implications

All points data will be stored in the points table in discreet format.

Service Endpoints

GET /case/points

The SafePlaces web client will utilize this endpoint to retrieve all endpoints associated with a case. The points data associated with the case will be read from the existing private database, translated in memory to duration format, and returned to the web client.

Sample Request Payload

{
  "caseId": 1
}

Sample Response Payload

{
  "concernPoints": [
    {
      "discreetPointIds": [232],
      "longitude": 14.91328448,
      "latitude": 41.24060321,
      "time": "2020-05-30T18:25:43.511Z",
      "duration": 5
    },
    {
      "discreetPointIds": [233, 234, 235, 236],
      "longitude": 15.21328448,
      "latitude": 42.44060321,
      "time": "2020-06-30T18:25:43.511Z",
      "duration": 20
    }
  ]
}

POST /case/point

The SafePlaces web client will call this endpoint when attempting to create a new point of concern. The points data in the request payload will be translated from duration format to discreet format before being persisted in the database. The new point of concern will be returned to the client in duration format.

Sample Request Payload

{
      "caseId": 12,
      "concernPoint": {
        "longitude": 14.91328448,
        "latitude": 41.24060321,
        "time": "2020-05-30T18:25:43.511Z",
        "duration": 20
      }
}

Sample Response Payload

{
      "concernPoint": {
        "discreetPointIds": [ 23, 24, 25, 26 ],
        "longitude": 14.91328448,
        "latitude": 41.24060321,
        "time": "2020-05-30T18:25:43.511Z",
        "duration": 5
    }
}

PATCH /case/point

The SafePlaces web client will call this endpoint when attempting to update an existing concern point. Concern points with ids matching the discreetPointIds in the request payload will be deleted from the private database. The rest of the data in the payload will be translated from duration format to discreet format and saved to the private database. The newly created points data will be represented in duration format in the response payload.

Sample Request Payload

{
      "concernPoint": {
        "discreetPointIds": [23, 24, 25],
        "longitude": 14.91328448,
        "latitude": 41.24060321,
        "time": "2020-05-30T18:25:43.511Z",
        "duration": 10
    }
}

Sample Response Payload

{
      "concernPoint": {
        "ids": [45, 46],
        "longitude": 14.91328448,
        "latitude": 41.24060321,
        "time": "2020-05-30T18:25:43.511Z",
        "duration": 10
    }
}
  • No labels