数据切片工具,用于从一个transmart读取数据并将其上载到另一个transmart

transmart-hyper-dicer的Python项目详细描述


Build statuscodecovPyPIPyPI - Downloads

transmart hyper dicer是一个数据切片工具,它从一个TranSMART实例读取数据并将其上载到另一个实例。

注:这是一个非常初步的版本,仍在开发中。 可在https://github.com/thehyve/transmart-hyper-dicer/issues报告问题。

配置

通过设置下面的环境变量,可以配置到keypolt身份提供程序和transmart的连接:

VariableDescription
TRANSMART_URLURL of the TranSMART back-end application e.g. https://transmart.example.com
KEYCLOAK_SERVER_URLURL of the Keycloak identity provider e.g. https://keycloak.example.com
KEYCLOAK_REALMKeycloak realm, e.g. dev
KEYCLOAK_CLIENT_IDKeycloak client ID, e.g. transmart-client
OFFLINE_TOKENAn offline token used used as a refresh token in order to communicate with TranSMART
VERIFY_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.

为了为USERNAME用户生成脱机令牌,可以使用以下curl命令。 要获取令牌,用户需要具有领域级别的角色映射:offline_access。 在使用该命令之前,必须用正确的大写单词替换。

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'

响应中的refresh_token字段的值是脱机令牌。

所有变量都可以在.env文件中指定为键值对。启动应用程序时,它们将自动设置为环境变量。.env文件的示例:

KEYCLOAK_CLIENT_ID=transmart-client
KEYCLOAK_SERVER_URL=https://keycloak.example.com
KEYCLOAK_REALM=dev
OFFLINE_TOKEN=<refresh_token value from the curl response>
TRANSMART_URL=https://transmart.example.com

安装

这个包需要Python3.6+。

要安装transmart-hyper-dicer,请执行以下操作:

pip install transmart-hyper-dicer

或来源:

git clone https://github.com/thehyve/transmart-hyper-dicer.git
cd transmart-hyper-dicer
pip install .

使用以下命令运行测试(包括覆盖率):

python setup.py test

用法

基于输入json文件中指定的约束,从配置的transmart实例读取数据子集 并以transmart-copy格式将输出写到/path/to/output。 输出目录应该是空的不存在的(然后将被创建)。

输入约束必须是valid tranSMART constraint。<;input.json>;文件内容示例:

{"type":"study_name","studyId":"EHR"}

运行:

transmart-hyper-dicer <input.json> /path/to/output

这将在output目录中生成目录i2b2metadatai2b2demodata。 生成的数据可以使用transmart-copy

# Download transmart-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
# Load data
PGUSER=tm_cz PGPASSWORD=tm_cz java -jar transmart-copy.jar -d output

包管理和依赖关系

这个项目使用pip来安装依赖项和包管理。

  • 依赖项应添加到安装要求列表中的setup.py中。

许可证

版权所有(c)2019 Hyve B.V.

Transmart超级骰子是根据麻省理工学院的许可证授权的。请参阅文件LICENSE

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JPanel不会对键绑定做出反应   当时间大于零时,不得在UI线程上调用java Await   JTextArea的java线程安全。追加   Java用户输入的字和行计数器   java以spreedsheat格式将数据保存到文件中   java构造函数的意义是什么?   java findViewById返回null,尽管组件的ID存在   java如何向按钮添加图像   java如何中断ExecutorService的线程   java如何将属性(例如枚举)绑定到不同类型的组件属性(例如每个枚举的映像)?   随机森林分类器的java实现   html使用java连接到一个站点并发布,HTTP状态代码200   从类访问属性时发生java编译错误   Java自动填充ArrayList,搜索更好的选项