Open biblicabeebli opened 7 months ago
Current plan:
do this one
then this one
and then do this one
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.
get-data/v1
- the normal data download endpoint.get-studies/v1
- provides a researcher with the list of studies they have access to. Output is a json list.get-participant-ids/v1
- Provides a list of participants on a study. Output is a json list.get-interventions/v1
- downloads the Intevervention information for a study. Output is complex json.get-survey-history/v1
- downloads all historical changes ever made to surveys. Output is complex json.get-participant-data-info/v1
- downloads the total data quantities on each data stream for participants in a study, Output is complex json.get-participant-upload-history/v1
- downloads the history of a single participant's uploaded files with timestamps. Output is a json list ordered by timestamp.get-participant-heartbeat-history/v1
- downloads the history of when a participant's device sends pings to the server. Output is a json list ordered by timestamp.get-participant-version-history/v1
- downloads the version history (app version and os version) of any time these values changed for a participant. Output is a json list ordered by timestamp.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.)get-summary-statistics/v1
- Is a mirror of the Tableau Summary Statistics endpoint but conforms to the data access api expectations on error behavior. Supports the same list of data filters. Output is a json list of dictionaries.get-participant-device-status-history/v1
- Downloads any saved comprehensive participant tracking and debugging data, which is enabled through the Experiments page, accessible by site admins on the participant page. This data is subject to change, it differs depending on app version and whether it is ios or android. WARNING: may be enormous.Update: We are at Done v2 on The Done Scale.
@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.)
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 ..."
@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.)
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.
update: reference script with documentation and the listing in the comment above have been updated.
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
Study: GGcUUuyFVGvPwogTsGs4CeNR
Ohkhay why won't this load on my phone....
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)
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.
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'}]
@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.
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
get-data/v1
The Main Data Access API - this is the ~direct data sourced from the apps. It is files, they are downloaded as csvs in a(n uncompressed) zip file. API requests can be extensively filtered, but are limited to one study at a time.get-studies/v1
Provides a JSON list of study ids and their names. (provides only the studies the user has access to)get-users/v1
Provides a JSON list of participant ids in the queried for study.get-interventions/v1
Provides a JSON list of the data about all interventions (including history) for all participants in a study.Tableau API - this API uses the Tableau credentials, which look-like-but-are-not the Data Access Credentials
api/v0/studies/<study_id>/summary-statistics/daily/wdc
This is the boutique Tableau login page known in proprietary Tableau jargon as the Web Data Connectorapi/v0/studies/<study_id>/summary-statistics/daily
This is the API endpoint, it provides paginated data of the Daily summaries, sourced from raw uploaded data for quantity statistics, and derived Forest-generated statistics. API requests can be extensively filtered and the list of available fields grows as we add more data. (and I think like get-data it requires the study id but its hard to tell from the code)Pseudo APIs - we have some items that are accessible from the website but may not have api endpoints
get-interventions/v1
api endpoint.Summary of APIs (or pseudo APIs) to add:
survey-download-api
branch.~Related Items (this list is kept updated)
Where do we host easy access to these APIs? Mano? Probably Mano.