Package: transmart-loader
This package contains classes that represent the core domain objects stored in theTranSMARTplatform,
an open source data sharing and analytics platform for translational biomedical research.It also provides a utility that writes such objects to tab-separated files that can be loaded into
a TranSMART database using thetransmart-copytool.⚠️ Note: this is a development version.
Issues can be reported athttps://github.com/thehyve/python_transmart_loader/issues.Installation and usageTo install transmart_loader, do:pip install transmart-loaderor from sources:git clone https://github.com/thehyve/python_transmart_loader.git
cd python_transmart_loader
pip install .UsageDefine a TranSMART data collection, using the classes intransmart_loader/transmart.py, e.g.,# Create the dimension elementsage_concept=Concept('test:age','Age','\\Test\\age',ValueType.Numeric)concepts=[age_concept]studies=[Study('test','Test study')]trial_visits=[TrialVisit(studies[0],'Week 1','Week',1)]patients=[Patient('SUBJ0','male',[])]visits=[Visit(patients[0],'visit1',None,None,None,None,None,None,[])]# Create the observationsobservations=[Observation(patients[0],age_concept,visits[0],trial_visits[0],date(2019,3,28),None,NumericalValue(28))]Create a hierarchical ontology for the concepts, e.g., to create the following structure:└ Ontology
  └ Age# Create an ontology with one top node and a concept nodetop_node=TreeNode('Ontology')top_node.add_child(ConceptNode(concepts[0]))ontology=[top_node]Write the data collection to a format that can be loaded usingtransmart-copy:collection=DataCollection(concepts,[],[],studies,trial_visits,visits,ontology,patients,observations)# Write collection to a temporary directory# The generated files can be loaded into TranSMART with transmart-copy.output_dir=mkdtemp()copy_writer=TransmartCopyWriter(output_dir)copy_writer.write_collection(collection)Checkexamples/data_collection.pyfor a complete example.Usage examples can be found in these projects:fhir2transmart: a tool that translates coreHL7 FHIRresources to the TranSMART data model.claml2transmart: a tool that translates ontologies inClaMLformat (e.g., ICD-10, available fromDIMDI)
to TranSMART ontologies.csr2transmart: a custom data transformation
and loading pipeline for a Dutch center for pediatric oncology.transmart-hyper-dicer: a tool that reads a selection of data from a TranSMART instance using its REST API
and loads it into another TranSMART instance.DocumentationFull documentation of the package is available atRead the Docs.DevelopmentFor a quick reference on software development, we refer tothe software guide checklist.Python versionsThis packages is tested with Python versions >= 3.7.Package management and dependenciesThis project usespipfor installing dependencies and package management.Dependencies should be added tosetup.pyin theinstall_requireslist.Testing and code coverageTests are in thetestsfolder.Thetestsfolder contains:A test if files fortransmart-copyare generated for fake data (file:test_transmart_loader)A test that checks whether your code conforms to the Python style guide (PEP 8) (file:test_lint.py)The testing framework used isPyTestPyTest introductionTests can be run withpython setup.py testDocumentationDocumentation should be put in thedocsfolder.To generate html documentation runpython setup.py build_sphinxCoding style conventions and code qualityCheck your code style withprospectorYou may need runpip install .[dev]first, to install the required dependenciesLicenseCopyright (c) 2019 The Hyve B.V.The TranSMART loader is licensed under the MIT License. See the fileLICENSE.CreditsThis project was funded by the German Ministry of Education and Research (BMBF) as part of the project
DIFUTURE - Data Integration for Future Medicine within the German Medical Informatics Initiative (grant no. 01ZZ1804D).This package was created withCookiecutterand theNLeSC/python-template.