-
Notifications
You must be signed in to change notification settings - Fork 4
Selector Verification API
Aditya Chinchure edited this page Aug 29, 2020
·
2 revisions
The Selector Verification API on LEAP provides a way to use custom verification functions from each site for sql-options
.
The REDCap External Module enables data retrieval using SQL queries. To enable that, site administrators can write custom SQL Generator functions based on this: https://github.com/leap-project/leap/wiki/SQL-Generators-for-REDCap
To verify a selector, you can simply write a new python script in the API, that uses the same distributed architecture as the rest of LEAP. An example of selector verification is:
import sys
sys.path.append("../")
import api.leap as leap
import api.register.user.registration as user_reg
def distributedVerify(sites, auth_token):
selector = {
"type": "sql",
"sql_func": "count",
"sql_options": {
"project_id": "13",
"filter" : {'pain_past3backpain': "= 1", 'yrbirth': "< 1931"}
}
}
dist_leap = leap.DistributedSelectorVerification(selector, "127.0.0.1:50000", auth_token)
result = dist_leap.get_result(sites)
print(result)
if __name__ == "__main__":
#user_reg.register_user("TestUser2", "1234561", "127.0.0.1:50000")
auth_res = user_reg.authenticate_user("TestUser", "123456", "127.0.0.1:50000")
distributedVerify([1], auth_res.token)
See the example in action by running this file: selector_verification_example.py
- Home
- Setup LEAP for development
- Configure LEAP
- API Usage
- Connecting to REDCap