onnela-lab / beiwe-backend

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe backend code
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
63 stars 43 forks source link

New APIs - platform improvement - extremely useful overlooked datapoints #354

Open biblicabeebli opened 7 months ago

biblicabeebli commented 7 months ago

There are several new datasets and data APIs that have been proposed and discussed, this issue serves as the final engineering-level issue required to coordinate us to get these built. These discussions are coming out of meetings, emails, and over in the private Onnela Lab discussions repo (so if anyone external is watching and has any ideas feel free to discuss in comments here.)

Summary of current APIs (before making additions):

Data Access APIs - all of these APIs that use the Data Access API Credentials

Tableau API - this API uses the Tableau credentials, which look-like-but-are-not the Data Access Credentials

Pseudo APIs - we have some items that are accessible from the website but may not have api endpoints

Summary of APIs (or pseudo APIs) to add:

Related Items (this list is kept updated)

Where do we host easy access to these APIs? Mano? Probably Mano.

biblicabeebli commented 6 months ago
biblicabeebli commented 6 months ago

Current plan:

do this one

then this one

and then do this one

biblicabeebli commented 4 months ago

2 more over in

implemented

biblicabeebli commented 3 months ago

A list of all data api endpoints after finished everything I can find across all issues. There may be additional endpoints and/or refinements. This is not full documentation but it is a start.

~TODO: Document!~ Documented! (see following post for link)

biblicabeebli commented 3 months ago
biblicabeebli commented 3 months ago

Update: We are at Done v2 on The Done Scale.

image

hydawo commented 2 months ago

@biblicabeebli

Let's include "1st registration date/time" as an additional output field in this API get-participant-table-data/v1 - downloads an extended version of the table as displayed on the View Study page. Has multiple formats - Json dictionary, json table, and csv format options. (Output is same as the button on the download page.)

MMel099 commented 2 months ago

Just thought of a useful extension for get-users. Two subqueries: get-users-no-data and get-users-data. Think this would be helpful for general study monitoring and to avoid Forest bugs like "no chunked data ..."

biblicabeebli commented 2 months ago

@hydawo @MMel099 I have added the first participant registration field to the participant table CSV and API

(The first registration value is not incorporated as an intervention Thing at this time, that's not part of this work.)

biblicabeebli commented 2 months ago

Just thought of a useful extension for get-users. Two subqueries: get-users-no-data and get-users-data. Think this would be helpful for general study monitoring and to avoid Forest bugs like "no chunked data ..."

I understand the idea and the need, I disagree that get-users, is the appropriate place for that.

biblicabeebli commented 2 months ago

update: reference script with documentation and the listing in the comment above have been updated.

MMel099 commented 1 month ago

Just wanted to add some more details about my comments on the /get-interventions endpoint testing. I used the script available here to do the testing.

Original comment: "Returns an empty json - tested on 2 staging studies with confirmed interventions" Study: kt3TqoCqJzGaEebqxkwZIXrQ

image

image

Study: GGcUUuyFVGvPwogTsGs4CeNR

image

image

biblicabeebli commented 1 month ago

Ohkhay why won't this load on my phone....

biblicabeebli commented 1 month ago

Can you compare your output with The output of the download interventions button in studies settings? (Sometimes I get page names wrong for complex and tedious reasons, and I'm on my phone at the moment. I'm not sure if this is in study settings or somewhere else)

MMel099 commented 1 month ago

Thanks Eli, and no urgency on this, just wanted to document! I'll take another look on my end - It may very well be my error.

jprince127 commented 1 month ago

Hello!

I wanted to update on something I found when testing the /get-participant-version-history/v1 endpoint of the API. I used the same script as Max above.

On my beta study on the staging server, I found that there are duplicated outputs when I call the API endpoint. I have never unregistered then reregistered my device to this study, so am unsure why this may be.

Server: staging.beiwe.org Name: Jenny_Prince_Test_Study_11.30.23 Study ID: gb0AnPbXW8GswPz767ZgMu0r Participant ID: 966u1cd7

The output is copy-pasted below:

Starting request at 2024-08-07 13:51:51.875640 Request completed at 2024-08-07T13:51:52.334537 duration: 0.458897 seconds http status code: 200 Testing whether it is valid json... JSON successfully loaded into variable json_response [{'app_version_code': '2.5', 'app_version_name': '2024.21', 'os_version': '17.3.1'}, {'app_version_code': '2.5', 'app_version_name': '2024.21', 'os_version': '17.3.1'}, {'app_version_code': '2.5.1', 'app_version_name': '2024.23', 'os_version': '17.3.1'}, {'app_version_code': '2.5.1', 'app_version_name': '2024.23', 'os_version': '17.3.1'}]

biblicabeebli commented 3 weeks ago

@jprince127 prettified:

[
    {
        "app_version_code": "2.5",
        "app_version_name": "2024.21",
        "os_version": "17.3.1"
    },
    {
        "app_version_code": "2.5",
        "app_version_name": "2024.21",
        "os_version": "17.3.1"
    },
    {
        "app_version_code": "2.5.1",
        "app_version_name": "2024.23",
        "os_version": "17.3.1"
    },
    {
        "app_version_code": "2.5.1",
        "app_version_name": "2024.23",
        "os_version": "17.3.1"
    }
]

OH WOOPS those should Definitiely have timestamps. some time passes Ok I have pushed an update to staging that makes that include timestamps. Please hit the endpoint again and post that output please.

One of these is happening:

So post that output and if its only in ~march? it's fine, if it is very occasional but not limited to march then we update the docs.