Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoints for data visualization #230

Open
pavliuc75 opened this issue Feb 26, 2025 · 2 comments
Open

Endpoints for data visualization #230

pavliuc75 opened this issue Feb 26, 2025 · 2 comments
Assignees

Comments

@pavliuc75
Copy link
Contributor

pavliuc75 commented Feb 26, 2025

A data endpoint to get specific data for UserTask type of data. Types are:

  • survey
  • health
  • cognition
  • audio
  • image
  • video

Return data for a bar chart (see below) showing the number of tasks done (i.e., measurements collected) for each task type.

Should be on a

  • study
  • deployment
  • participant

level.

Time range should be part of request, e.g. the 2 week period shown below.

Notes:

  • measurement -> device_role_name -> role_name -> participant
  • don't worry about the translation now - just use the title of the task
  • the task type is stated in the type parameter of the measurement
@pavliuc75 pavliuc75 self-assigned this Feb 26, 2025
@pavliuc75
Copy link
Contributor Author

pavliuc75 commented Feb 26, 2025

Image

endpoints should return something similar to that...

const surveyData = [
{ x: “26/02/25”, y: { q1: 0, q2: 1, q3: 0, t1: 0 } },
{ x: “27/02/25”, y: { q1: 0, q2: 1, q3: 0, t1: 0 } },
{ x: “28/02/25”, y: { q1: 0, q2: 1, q3: 0, t1: 0 } },
];

const barChartData = [
{ x: “26/02/25”, y: { min: 40, max: 50 } },
{ x: “27/02/25”, y: { min: 40, max: 50 } },
{ x: “28/02/25”, y: { min: 40, max: 50 } },
];

const pieChartData = [
{ key: "category_1", value: 40 },
{ key: "category_2", value: 20 },
{ key: "category_3", value: 30 },
];

// key acts both as an id and i18n key (for the labels)
// colors are generated on frontend

@bardram
Copy link
Collaborator

bardram commented Feb 27, 2025

Note that count can be drawn from the completedtask measurement, which contain the task name, like this:

 {
    "sequenceId": 65920,
    "studyDeploymentId": "15c12adb-b6ce-408f-99a0-f54c944416d9",
    "deviceRoleName": "Primary Phone",
    "measurement": {
      "sensorStartTime": 1737441255189091,
      "data": {
        "__type": "dk.cachet.carp.completedtask",
        "taskName": "Task #20",
        "taskData": {
          "__type": "dk.cachet.carp.survey",
          "result": {
            "__type": "RPTaskResult",

@bardram bardram changed the title enpoints for data visualization Endpoints for data visualization Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants