将数据导入i2b2数据库架构
i2b2-import的Python项目详细描述
i2b2导入
简介
此库提供将数据导入i2b2数据库架构的函数。
安装
运行:pip install i2b2_import
使用量
要从csv文件导入大脑特征(和/或其他观察结果), 使用:
features_csv_import.csv2db(file_path, i2b2_conn, dataset, config): Import brain features and other observation facts data from a CSV file into the I2B2 DB schema. * param file_path: Path to the CSV file. * param i2b2_db_url: URL of the I2B2 DB. * param dataset: Data set name. * param config: A few settings. It is a dictionary that accepts the following fields: - pid_in_vid: Rarely, a data set might mix patient IDs and visit IDs. E.g. : LREN data. In such a case, you to enable this flag. This will try to split PatientID into VisitID and PatientID. - sid_by_patient: Rarely, a data set might use study IDs which are unique by patient (not for the whole study). E.g.: LREN data. In such a case, you have to enable this flag. This will use PatientID + StudyID as a sessionID. * param regions_name_file: CSV file containing the abbreviated regions name in the first column and the full names in the second column.
或从文件夹:
features_csv_import.folder2db(folder, i2b2_conn, dataset, config): Import brain features and other observation facts data from a folder containing CSV files into the I2B2 DB schema. * param folder: Folder path * param i2b2_db_url: URL of the I2B2 DB. * param dataset: Data set name. * param config: A few settings. It is a dictionary that accepts the following fields: - pid_in_vid: Rarely, a data set might mix patient IDs and visit IDs. E.g. : LREN data. In such a case, you to enable this flag. This will try to split PatientID into VisitID and PatientID. - sid_by_patient: Rarely, a data set might use study IDs which are unique by patient (not for the whole study). E.g.: LREN data. In such a case, you have to enable this flag. This will use PatientID + StudyID as a sessionID. * param regions_name_file: CSV file containing the abbreviated regions name in the first column and the full names in the second column.
要从数据目录数据库导入元数据,请使用:
data_catalog_import.catalog2i2b2(data_catalog_conn, i2b2_conn): Import meta data from the Data Catalog DB to the I2B2 schema. * param data_catalog_conn: Connection to the Data Catalog DB. * param i2b2_db_url: URL of the I2B2 DB.
要从额外文件(xml、json,…)导入元数据,请使用:
ppmi_xml_import.meta2i2b2(file_path, db_conn, dataset): Import meta-data from a file into the I2B2 schema. * param file_path: File (XML, JSON, ...) containing meta-data for a given dataset (PPMI, EDSD, ...). * param i2b2_db_url: Connection to the I2B2 DB. * param dataset: Dataset ID (each dataset uses its own meta-data files format)
或从文件夹:
ppmi_xml_import.folder2db(folder, db_conn, dataset): Import meta-data from files from a given folder (recursive) and for a given dataset into the I2B2 schema. * param folder: Folder containing meta-data files for a given dataset. * param i2b2_db_url: URL of the I2B2 DB. * param dataset: Dataset ID (each dataset uses its own meta-data files format)
测试
打开tests目录并运行./test.sh。
注意:需要Docker。
建造
运行./build.sh。
推动Pypi
运行./publish.sh。
(这将在推送项目之前构建项目)。