Package: transmart-hyper-dicer
transmart-hyper-dicer is a data slicing tool that reads data from oneTranSMARTinstance and uploads it to another.⚠️ Note: this is a very preliminary version, still under development.
Issues can be reported athttps://github.com/thehyve/transmart-hyper-dicer/issues.ConfigurationConnection to Keycloak identity provider and tranSMART is configured by setting the environment variables below:VariableDescriptionTRANSMART_URLURL of the TranSMART back-end application e.g.https://transmart.example.comKEYCLOAK_SERVER_URLURL of the Keycloak identity provider e.g.https://keycloak.example.comKEYCLOAK_REALMKeycloak realm, e.g.devKEYCLOAK_CLIENT_IDKeycloak client ID, e.g.transmart-clientOFFLINE_TOKENAn offline token used used as a refresh token in order to communicate with TranSMARTVERIFY_CERTEither a boolean, in which case it controls whether the server’s
TLS certificate is verified, or a string, in which case it must be a path
to a CA bundle to use. Defaults to True.In order to generate an offline token forUSERNAMEuser, the followingcurlcommand can be used.
To get the token the user needs to have the role mapping for the realm-level:offline_access.
Before using the command you have to substitute words in uppercase with proper ones.curl\-d'client_id=KEYCLOAK_CLIENT_ID'\-d'username=USERNAME'\-d'password=PASSWORD'\-d'grant_type=password'\-d'scope=offline_access'\'https://KEYCLOAK_SERVER_URL/auth/realms/KEYCLOAK_REALM/protocol/openid-connect/token'The value of therefresh_tokenfield in the response is the offline token.All the variables can be specified in the.envfile as key-value pairs. They will be automatically set as environment variables, when starting the application. Example of the.envfile:KEYCLOAK_CLIENT_ID=transmart-clientKEYCLOAK_SERVER_URL=https://keycloak.example.comKEYCLOAK_REALM=devOFFLINE_TOKEN=<refresh_tokenvaluefromthecurlresponse>TRANSMART_URL=https://transmart.example.comInstallationThe package requires Python 3.6+.To installtransmart-hyper-dicer, do:pipinstalltransmart-hyper-dicerOr from source:gitclonehttps://github.com/thehyve/transmart-hyper-dicer.gitcdtransmart-hyper-dicerpipinstall.Run tests (including coverage) with:pythonsetup.pytestUsageRead subset of data from the configured tranSMART instance, based on the constraint specified in an input JSON file
and write the output intransmart-copyformat to /path/to/output.
The output directory should be empty of not existing (then it will be created).Input constraint has to be avalid tranSMART constraint. Example of <input.json> file content:{"type":"study_name","studyId":"EHR"}Run:transmart-hyper-dicer<input.json>/path/to/outputThis generates the directoriesi2b2metadataandi2b2demodatain theoutputdirectory.
The generated data can be loaded usingtransmart-copy:#Downloadtransmart-copy:curl -f -L https://repo.thehyve.nl/service/local/repositories/releases/content/org/transmartproject/transmart-copy/17.1-HYVE-6.2/transmart-copy-17.1-HYVE-6.2.jar -o transmart-copy.jar#LoaddataPGUSER=tm_cz PGPASSWORD=tm_cz java -jar transmart-copy.jar -d outputPackage management and dependenciesThis project usespipfor installing dependencies and package management.Dependencies should be added tosetup.pyin theinstall_requireslist.LicenseCopyright (c) 2019 The Hyve B.V.The Transmart Hyper Dicer is licensed under the MIT License. See the fileLICENSE.