forked from PeerProducedResearch/opensurvey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds basic export task and needed variables
- Loading branch information
1 parent
2bdd049
commit c8d5368
Showing
5 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.core.management.base import BaseCommand | ||
import requests | ||
from main.helpers import get_access_token | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Exports data for all members" | ||
|
||
def handle(self, *args, **options): | ||
headers = { | ||
"Authorization": "bearer {}".format(get_access_token(download=True)), | ||
"Accept": "application/json" | ||
} | ||
url = "https://opencovid.openclinica.io/OpenClinica/pages/auth/api/clinicaldata/S_DEMO_BGT(TEST)/91048557/*/*?includeAudits=n&includeDNs=n&includeMetadata=y&showArchived=n" | ||
# download all data: | ||
# url = "https://opencovid.openclinica.io/OpenClinica/pages/auth/api/clinicaldata/S_DEMO_BGT(TEST)/*/*/*?includeAudits=n&includeDNs=n&includeMetadata=y&showArchived=n" | ||
response = requests.get(url, headers=headers) | ||
print(response.json()) | ||
|
||
# TODO: so far it doesn't process the data, next step: | ||
# - Save data to Open Humans for each member |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
from django.core.management.base import BaseCommand | ||
from main.models import SurveyAccount | ||
import datetime | ||
from main.helpers import create_openclinica_event, get_openclinica_token | ||
from main.helpers import get_openclinica_token | ||
from main.helpers import send_user_survey_link | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Updates all data for all members" | ||
|
||
def handle(self, *args, **options): | ||
for survey_account in SurveyAccount.objects.all(): | ||
#create_openclinica_event(survey_account, "SE_DAILY", str(datetime.date.today())) | ||
# we no longer create events on sending out email, it's dynamically | ||
# done when clicking the email link now | ||
# create_openclinica_event(survey_account, "SE_DAILY", str(datetime.date.today())) | ||
get_openclinica_token(survey_account) | ||
send_user_survey_link(survey_account) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters