Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Ls/publish (#77)
Browse files Browse the repository at this point in the history
* delete duplicate sentence in readme

* fiw setup file

* bump version
  • Loading branch information
SaulLu authored Aug 19, 2020
1 parent 1f02c18 commit 66d1beb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
73 changes: 33 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ Transform FHIR to dataset for ML applications

## FHIR2Dataset in Detail

This project is still under development.

This repo allows to make a SQL query on a FHIR API and to retrieve tabular data.
This repo allows to make a SQL query on a FHIR API and to retrieve tabular data.

_FHIR2Dataset is still under active development!_

## Installation

### With pip

`pip install fhir2dataset`

### From source

After cloning this repository, you can install the required dependencies

```
Expand All @@ -25,7 +25,6 @@ npm install --prefix ./fhir2dataset/metadata

For usage, refer to this [turorial](https://htmlpreview.github.io/?https://github.com/arkhn/FHIR2Dataset/blob/query_tests/examples/tutorial.html) and then this [Jupyer Notebook](examples/example.ipynb)


## Getting started

Two possible ways to enter the query : as a SQL query or as a JSON config file
Expand Down Expand Up @@ -57,7 +56,7 @@ config_from_parser = parser.parse(sql_like_query)
query.from_config(config_from_parser)
query.execute()
df = query.main_dataframe
```
```

**JSON config file as entry**

Expand All @@ -73,44 +72,39 @@ query = Query(fhir_api_url, fhir_rules=fhir_rules)
config.json :

```json
{"select":{
"alias n°1":[
"a",
"b",
"c"
],
"alias n°2":[
"a"
]
},
"from":{
"alias n°1":"Resource type 1",
"alias n°2":"Resource type 2",
"alias n°3":"Resource type 3"
},
"join":{
"inner": {
"alias n°1":{
"d":"alias n°2"

},
"alias n°2":{
"b":"alias n°3"
{
"select": {
"alias n°1": ["a", "b", "c"],
"alias n°2": ["a"]
},
"from": {
"alias n°1": "Resource type 1",
"alias n°2": "Resource type 2",
"alias n°3": "Resource type 3"
},
"join": {
"inner": {
"alias n°1": {
"d": "alias n°2"
},
"alias n°2": {
"b": "alias n°3"
}
}

}
},
"where":{
"alias n°2":{
"c":"value 1",
"d":"value 2"
},
"alias n°3":{
"a":"value 3",
"b":"value 4"
"where": {
"alias n°2": {
"c": "value 1",
"d": "value 2"
},
"alias n°3": {
"a": "value 3",
"b": "value 4"
}
}
}}
}
```

```
# Enter in dirname the path of config.json
filename_config = 'config.json'
Expand All @@ -123,7 +117,6 @@ query.execute()
df = query.main_dataframe
```


## Examples

Check out examples of queries and how they are transformed in call to the FHIR api!
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.sdist import sdist

from subprocess import call

with open(
Expand All @@ -13,20 +15,26 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()


class NPMInstall(build_py):
class MyBuildCommand(build_py):
def run(self):
call(["npm", "install", "--prefix", "fhir2dataset/metadata"])
build_py.run(self)


class MySdistCommand(sdist):
def run(self):
call(["npm", "install", "--prefix", "fhir2dataset/metadata"])
sdist.run(self)


requirements = read("requirements.txt").split()

setup(
cmdclass={"build_py": NPMInstall},
cmdclass={"build_py": MyBuildCommand, "sdist": MySdistCommand},
name="fhir2dataset",
packages=find_packages(),
include_package_data=True,
version="0.1.1-a1",
version="0.1.2",
license="Apache License 2.0",
description="Transform FHIR to Dataset",
long_description=long_description,
Expand Down

0 comments on commit 66d1beb

Please sign in to comment.