Metadata-Version: 2.1
Name: fhir_kindling
Version: 0.7.0
Summary: Generates synthetic FHIR resources.
Home-page: https://github.com/migraf/fhir-kindling
Author: Michael Graf
Author-email: michael.graf@uni-tuebingen.de
License: MIT license
Keywords: fhir_kindling,fhir,pydantic,health,data,hl7
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

[![CI](https://github.com/migraf/fhir-kindling/actions/workflows/main_ci.yml/badge.svg?branch=main)](https://github.com/migraf/fhir-kindling/actions/workflows/main_ci.yml)
[![codecov](https://codecov.io/gh/migraf/fhir-kindling/branch/main/graph/badge.svg?token=FKQENFXACB)](https://codecov.io/gh/migraf/fhir-kindling)
[![PyPI version](https://badge.fury.io/py/fhir-kindling.svg)](https://badge.fury.io/py/fhir-kindling)

# :fire: FHIR Kindling

CRUD library for fhir servers, with resource validation and parsing powered by
the [pydantic](https://github.com/samuelcolvin/pydantic)
models created by [fhir.resources](https://github.com/nazrulworld/fhir.resources). More details in
the [Documentation](https://migraf.github.io/fhir-kindling/).

## Features

- Create, Read, Update, Delete using a server's REST API
- Bundle creation, validation and data management on a FHIR server via the REST API
- Supports Hapi, Blaze and IBM FHIR servers

## Installation

Install the package using pip:

```shell
pip install fhir-kindling --user
```

## Usage

### Connecting to a FHIR server

```python
from fhir_kindling import FhirServer

# Connect with basic auth 
basic_auth_server = FhirServer("https://fhir.server/fhir", username="admin", password="admin")
# Connect with static token
token_server = FhirServer("https://fhir.server/fhir", token="your_token")

# Connect using oauth2/oidc
oidc_server = FhirServer("https://fhir.server/fhir", client_id="client_id", client_secret="secret",
                         oidc_provider_url="url")

# Print the server's capability statement
print(basic_auth_server.capabilities)

```

### Query resources from the server

```python
from fhir_kindling import FhirServer
from fhir.resources.patient import Patient

# Connect using oauth2/oidc
oidc_server = FhirServer("https://fhir.server/fhir", client_id="client_id", client_secret="secret",
                         oidc_provider_url="url")

# query all patients on the server
query = oidc_server.query(Patient, output_format="json").all()
print(query.response)

# Query resources based on name of resource
query = oidc_server.query("Patient", output_format="json").all()
print(query.response)

```

## Credits

This package was created with Cookiecutter and
the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter) project template.





# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.6.0] - 2022-01-19
Query Response with included resources. Reworked Generators

### Added
 - [x] Query response now stores and parses included resources
 - [x] Generator parameters for Resources and Fields
 - [x] Field generators for generating resource fields based on probabilistic choices or a generator function
 - [x] Resource generator field values based on static value or list
 - [x] Patient based data set generator 

### Changed
- Query interface `where, include, has` now can add query parameters based on method arguments or parameter objects.




## [0.5.0] - 2021-11-12

Query Parameters, include/revinclude, reverse chaining.  

### Added
 - [x] Query Parameters classes, for regular queries, including resources and reverse chaining
 - [x] Support for `_include` and `_revinclude` via `query.include()`
 - [x] Reverse chaining support via `query.has()`
 - [x] Parsing parameters from given URL/ coverting parameters to query url

### Changed
- Query interface `where, include, has` now can add query parameters based on method arguments or parameter objects.




## [0.4.0] - 2021-11-12

Server summary, deleting resources, removed initial CLI.

### Added

- [x] Getting a list of all resources on the server based on capabilities
- [x] Plots for server and resource summary
- [x] `server.delete()` method to delete resources based on ids

## [0.3.0] - 2021-10-30

Response classes, reference parsing and basic xml support

### Added

XML output format and resolving xml pagination. Response objects containig resources and references

### Changed

Outsourced resolving of response pagination into response classes

### Fixed

## [0.2.0] - 2021-09-18

FHIR server and query API

### Added

Classes for fhir servers and queries. Oauth2/OIDC support.

### Changed

Moved location of cli

### Fixed

## [0.1.0] - 2021-08-24

Initial cli

### Added

### Changed

### Fixed

Hashing order guarantees the right index of the query.json file in the hash


