-
Notifications
You must be signed in to change notification settings - Fork 15
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
iOS 2.5 upload audit #66
Comments
I'm working on building these endpoints, and there's no reason I can't do uploads first. These will be going up on staging dailyish or possibly even more frequently.
|
And now it exists! This is a script that will work for the endpoint, you will need the python from datetime import datetime
from pprint import pprint
import orjson
import requests
# make a post request to the get-participant-upload-history/v1 endpoint, including the api key,
# secret key, and participant_id as post parameters.
t1 = datetime.now()
print("Starting request at", t1, flush=True)
response = requests.post(
"https://staging.beiwe.org/get-participant-upload-history/v1/",
data={
"access_key": "your key part one",
"secret_key": "your key part two",
"participant_id": "some participant id",
# "omit_keys": "true",
},
allow_redirects=False,
)
t2 = datetime.now()
print("Request completed at", t2, "duration:", (t2 - t1).total_seconds(), "seconds")
print("http status code:", response.status_code)
assert 200 <= response.status_code < 300, f"Why is it not a 200? {response.status_code} (if it's a 301 you may have cut off the s in https)"
print("Data should be a bytes object...")
assert isinstance(response.content, bytes), f"Why is it not a bytes? {type(response.content)}"
assert response.content != b"", "buuuuuut its empty."
print("cool, cool... is it valid json?")
imported_json_response = orjson.loads(response.content)
print("json was imported! Most of these endpoints return json lists...")
if isinstance(imported_json_response, list):
print("it is a list with", len(imported_json_response), "entries!")
print("\nthe first entry is:")
pprint(imported_json_response[0])
print("\nthe last entry is:")
pprint(imported_json_response[-1])
else:
print("it is not a list, it is a", type(imported_json_response), "so you will have to inspect it yourself.") |
This looks great! Going to go ahead and give it a try. Thanks! |
Speed is alright on staging, but when we get it onto production it is going to be S L O W and potentially a problem for database load. I want to brainstorm ways to reduce the amount of data.
|
I did make some of those changes.
|
Just want to check in on this briefly, brainstorm what you will want to look at. |
Some comments that may be useful:
Nothing else from me for now. |
F*ck yeah. |
Morning @biblicabeebli
Hassan has asked me to look into data uploading and if there are noticeable improvements in consistency/volume of any data streams since v2.5.
To do this, I plan to look at file uploading for all the RAs Beiwe ID for one month before the update (Feb 15 - March 15)and one month after (April 15 - May 15). Would it be possible to get the json files with the full upload histories for these users?
Studies server: Yale_Fucito_Young Adult Alcohol - Live Study
Staging server: Michelle Test Study 10.3.2023
Staging server: Zhimeng Liu - Beta Test - 2.5.24
Staging server: Jenny_Prince_Test_Study_11.30.23
Thanks so much and this is not time sensitive!
The text was updated successfully, but these errors were encountered: