UAL-RE / LD-Cool-P

Python tool to enable data curation
MIT License
4 stars 5 forks source link

Use Qualtrics API to retrieve deposit agreement information #24

Closed astrochun closed 4 years ago

astrochun commented 4 years ago

API documentation is available here.

This is within feature/qualtrics_api and feature/qualtrics2 branches.

This feature will include:

  1. [X] A Qualtrics class to retrieve basic information [4a4c219, 99d7920, ef80421, a2c9431, 830b18c, 2ca475e, bb99a63, bdaabf1, 75e110b, d0793cb, d29eaf1, e641a74, ec9ba7d, 35616de, 53b092f]
    1. [X] Ability to check if a depositor has completed the deposit agreement [297c2f2, 63a9d39, d834d69, 47f0b77]
    2. [x] Ability to retrieve the report in HTML or PDF (See below for a quick hack to make this possible) [4946c3d, ceb7970, 82d2932, bdaabf1, 4389c09]
  2. [X] Configuration settings in config/default.ini [d3b6f34, 402f632]
astrochun commented 4 years ago

I have made some cURL attempts to retrieve an HTML/PDF of an individual response, but was not successful. A link that I received from Fernando uses cookies to cache SSO credentials. Thus, a simple API token won't retrieve the file.

I've also tried creating a temporary OAuth2 token but that did not work.

astrochun commented 4 years ago

For now I'm going implement the checking of a deposit agreement, but won't be able to retrieve it. This will be part of v0.5.0 with feature/curation_workflow

astrochun commented 4 years ago

Closing for now. Additional functionality will be later revisited.

astrochun commented 4 years ago

It might be possible to open a browser tab with the desired Qualtrics URL to retrieve the deposit agreement form. Not the most ideal, but this is a workaround for now.

It would look something like:

import webbrowser
webbrowser.open(f'https://uarizona.co1.qualtrics.com/Q/Data/Ajax/GetSingleResponseReport?RID={RespondID}&{SurveyID}', new=2)

One issue is that the above link is dependent on being signed into the Qualtrics dashboard using SSO. If the original session times out, you will get a blank page. Thus, it would make sense to open a browser tab to login and then the deposit agreement form.

astrochun commented 4 years ago

Note: for 35616de, tabulate package is needed for the use of pandas to_markdown(). This would need to be included in the next release

astrochun commented 4 years ago

Closing issue for now.

zoidy commented 3 years ago

It may be possible to download without logging in using this method https://www.qualtrics.com/community/discussion/10362/is-this-possible-to-download-pdf-summary-of-responses-by-using-qualtrics-api-in-python

I tried the URL in a private browser window and it does display the result along with an option to generate a PDF.