Metadata-Version: 2.1
Name: iceberg_tools
Version: 0.0.7rc1
Summary: FHIR schemas tools for bioinformatics.
Home-page: https://github.com/bmeg/iceberg-schema-tools
Author: https://ellrottlab.org/
Project-URL: Bug Reports, https://github.com/bmeg/iceberg-schema-tools/issues
Project-URL: Source, https://github.com/bmeg/iceberg-schema-tools
Keywords: FHIR PFB gen3 bioinformatics graph
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12, <4
Description-Content-Type: text/markdown
Requires-Dist: click
Requires-Dist: orjson==3.9.5
Requires-Dist: inflection==0.5.1
Requires-Dist: fhir.resources==7.0.2
Requires-Dist: PyYAML
Requires-Dist: flatten-json==0.1.13
Requires-Dist: dataclass-csv==1.4.0
Requires-Dist: requests==2.31.0
Requires-Dist: requests-cache==1.1.0
Requires-Dist: joblib==1.3.2
Requires-Dist: beautifulsoup4==4.12.2
Requires-Dist: fastjsonschema==2.19.0
Requires-Dist: jsonpointer==2.4
Requires-Dist: glom==23.5.0
Requires-Dist: jsonschema==4.20.0
Requires-Dist: referencing==0.31.0
Requires-Dist: fastavro

# iceberg-schema-tools
Create and maintain central iceberg schema.  Render and validate FHIR data.

## Overview

![image](https://github.com/bmeg/iceberg-schema-tools/assets/47808/cf5f544c-081f-470f-b1d8-27f16ad21b67)



Code that generates the base schema from FHIR goes here.  Additional tools are provided to lints, validates and visualize the schema.

Note: The actual schemas are stored in [iceberg](https://github.com/bmeg/iceberg)


## Setup

```
pip install iceberg-tools
```


## Use

```
$ iceberg schema
Usage: iceberg schema [OPTIONS] COMMAND [ARGS]...

  Manage bmeg or gen3 schemas from FHIR resources.

Options:
  --help  Show this message and exit.

Commands:
  generate  Generate from FHIR resources.
  compile   Create aggregated json file from individual yaml schemas

$ iceberg data

Usage: iceberg data [OPTIONS] COMMAND [ARGS]...

  Project data (ResearchStudy, ResearchSubjects, Patient, etc.).

Options:
  --help  Show this message and exit.

Commands:
  simplify             Renders PFB friendly flattened records.
  validate             Check FHIR data for validity and conventions.
  validate-simplified  Check simplified data for validity and conventions.
  pfb                  Write simplified FHIR files to a PFB.
  migrate              Migrate from FHIR R4B to R5.0.
  report               Aggregate avro pfb files into a cytoscape tsv.

```

> Note: `pfb_fhir` and `iceberg` are synonymous in this context.

## Examples

The commands:
```commandline
pfb_fhir schema generate simplified
pfb_fhir data simplify --schema_path  iceberg/schemas/simplified/simplified-fhir.json tests/fixtures/simplify/study/ tmp/simplified
pfb_fhir data pfb tmp/simplified/ tmp/study.pfb
tree tmp

```

Will generate the following output:
```commandline
INFO:'Records with relationships': 59413
INFO:'Records': 59460
tmp
├── simplified
│   ├── Condition.ndjson
│   ├── DocumentReference.ndjson
│   ├── Encounter.ndjson
│   ├── MedicationAdministration.ndjson
│   ├── Observation.ndjson
│   ├── Patient.ndjson
│   ├── ResearchStudy.ndjson
│   ├── ResearchSubject.ndjson
│   ├── Specimen.ndjson
│   └── Task.ndjson
└── study.pfb

```

## Contributing
See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for developer notes.
