{ "cells": [ { "cell_type": "code", "execution_count": 13, "id": "4ae6950a-eb83-4428-abdf-87e3e28830fa", "metadata": {}, "outputs": [], "source": [ "import sys\n", "import os\n", "sys.path.append('../')\n", "import labkeyInterface\n", "import labkeyDatabaseBrowser\n", "import labkeyFileBrowser" ] }, { "cell_type": "code", "execution_count": 14, "id": "af1c70b6-a8eb-444f-b3ae-e2c9072a8d73", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "User: andrej studen CSRF: 3aa04ecf14774120b594fc9a451afe71\n" ] }, { "data": { "text/plain": [ "'3aa04ecf14774120b594fc9a451afe71'" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "net=labkeyInterface.labkeyInterface()\n", "db=labkeyDatabaseBrowser.labkeyDB(net)\n", "fconfig=os.path.join(os.path.expanduser('~'),'.labkey','labkey-public.json')\n", "net.init(fconfig)\n", "\n", "#this reports the certificate used\n", "try:\n", " print('Using: {}'.format(net.connectionConfig['SSL']['user']))\n", "except KeyError:\n", " pass\n", "\n", "#This gets a deafult CSRF code; It should report user name plus a long string of random hex numbers\n", "net.getCSRF()" ] }, { "cell_type": "code", "execution_count": 12, "id": "bafb076a-a860-4884-b124-ed1dab42aa27", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[{'propertyId': 7323, 'propertyURI': 'urn:lsid:labkey.com:IntList.Folder-61:comorbidities#Key', 'container': '1268c77b-7cf6-103a-9533-9caba13bc053', 'ontologyURI': None, 'name': 'Key', 'description': None, 'rangeURI': 'http://www.w3.org/2001/XMLSchema#int', 'conceptURI': None, 'label': None, 'searchTerms': None, 'semanticType': None, 'format': None, 'required': False, 'hidden': False, 'lookupContainer': None, 'lookupSchema': None, 'lookupQuery': None, 'defaultValueType': None, 'defaultValue': None, 'defaultDisplayValue': '[none]', 'mvEnabled': False, 'importAliases': None, 'url': None, 'shownInInsertView': True, 'shownInUpdateView': True, 'shownInDetailsView': True, 'measure': False, 'dimension': False, 'recommendedVariable': False, 'defaultScale': 'LINEAR', 'facetingBehaviorType': 'AUTOMATIC', 'phi': 'NotPHI', 'scale': 4000, 'redactedText': None, 'conditionalFormats': [], 'propertyValidators': [], 'excludeFromShifting': False, 'setDimension': True, 'setMeasure': True, 'setExcludeFromShifting': True, 'typeEditable': True, 'preventReordering': False, 'disableEditing': False, 'lookupDescription': '(none)', 'fileType': False}, {'propertyId': 7324, 'propertyURI': 'urn:lsid:labkey.com:IntList.Folder-61:comorbidities#crfRef', 'container': '1268c77b-7cf6-103a-9533-9caba13bc053', 'ontologyURI': None, 'name': 'crfRef', 'description': None, 'rangeURI': 'http://www.w3.org/2001/XMLSchema#string', 'conceptURI': None, 'label': None, 'searchTerms': None, 'semanticType': None, 'format': None, 'required': False, 'hidden': False, 'lookupContainer': None, 'lookupSchema': None, 'lookupQuery': None, 'defaultValueType': 'FIXED_EDITABLE', 'defaultValue': None, 'defaultDisplayValue': '[none]', 'mvEnabled': False, 'importAliases': None, 'url': None, 'shownInInsertView': True, 'shownInUpdateView': True, 'shownInDetailsView': True, 'measure': False, 'dimension': False, 'recommendedVariable': False, 'defaultScale': 'LINEAR', 'facetingBehaviorType': 'AUTOMATIC', 'phi': 'NotPHI', 'scale': 4000, 'redactedText': None, 'conditionalFormats': [], 'propertyValidators': [{'rowId': 3030, 'errorMessage': None, 'new': True, 'expression': '~lte=4000', 'type': 'Length', 'description': None, 'name': 'Text Length', 'properties': {}}], 'excludeFromShifting': False, 'setDimension': True, 'setMeasure': True, 'setExcludeFromShifting': True, 'typeEditable': True, 'preventReordering': False, 'disableEditing': False, 'lookupDescription': '(none)', 'fileType': False}, {'propertyId': 7325, 'propertyURI': 'urn:lsid:labkey.com:IntList.Folder-61:comorbidities#submissionDate', 'container': '1268c77b-7cf6-103a-9533-9caba13bc053', 'ontologyURI': None, 'name': 'submissionDate', 'description': None, 'rangeURI': 'http://www.w3.org/2001/XMLSchema#dateTime', 'conceptURI': None, 'label': None, 'searchTerms': None, 'semanticType': None, 'format': None, 'required': False, 'hidden': False, 'lookupContainer': None, 'lookupSchema': None, 'lookupQuery': None, 'defaultValueType': 'FIXED_EDITABLE', 'defaultValue': None, 'defaultDisplayValue': '[none]', 'mvEnabled': False, 'importAliases': None, 'url': None, 'shownInInsertView': True, 'shownInUpdateView': True, 'shownInDetailsView': True, 'measure': False, 'dimension': False, 'recommendedVariable': False, 'defaultScale': 'LINEAR', 'facetingBehaviorType': 'AUTOMATIC', 'phi': 'NotPHI', 'scale': 4000, 'redactedText': None, 'conditionalFormats': [], 'propertyValidators': [], 'excludeFromShifting': False, 'setDimension': True, 'setMeasure': True, 'setExcludeFromShifting': True, 'typeEditable': True, 'preventReordering': False, 'disableEditing': False, 'lookupDescription': '(none)', 'fileType': False}, {'propertyId': 7326, 'propertyURI': 'urn:lsid:labkey.com:IntList.Folder-61:comorbidities#comorbiditiesFlag', 'container': '1268c77b-7cf6-103a-9533-9caba13bc053', 'ontologyURI': None, 'name': 'comorbiditiesFlag', 'description': None, 'rangeURI': 'http://www.w3.org/2001/XMLSchema#int', 'conceptURI': None, 'label': 'Significant comorbidities', 'searchTerms': None, 'semanticType': None, 'format': None, 'required': False, 'hidden': False, 'lookupContainer': None, 'lookupSchema': 'lists', 'lookupQuery': 'enumBoolFlag', 'defaultValueType': 'FIXED_EDITABLE', 'defaultValue': None, 'defaultDisplayValue': '[none]', 'mvEnabled': False, 'importAliases': None, 'url': None, 'shownInInsertView': True, 'shownInUpdateView': True, 'shownInDetailsView': True, 'measure': False, 'dimension': True, 'recommendedVariable': False, 'defaultScale': 'LINEAR', 'facetingBehaviorType': 'AUTOMATIC', 'phi': 'NotPHI', 'scale': 4000, 'redactedText': None, 'conditionalFormats': [], 'propertyValidators': [], 'excludeFromShifting': False, 'setDimension': True, 'setMeasure': True, 'setExcludeFromShifting': True, 'typeEditable': True, 'preventReordering': False, 'disableEditing': False, 'lookupDescription': 'lists.enumBoolFlag', 'fileType': False}]\n" ] } ], "source": [ "#specific tests\n", "project='hypoAfrica/Study'\n", "schema='lists'\n", "query='comorbidities'\n", "ds=db.getQueryDesign(project,schema,query)\n", "print(ds['fields'])" ] }, { "cell_type": "code", "execution_count": null, "id": "83418c1c-eec8-4439-b049-996bbc05321e", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }