Skip to content

Commit

Permalink
Merge pull request #159 from smart-on-fhir/mikix/re-org
Browse files Browse the repository at this point in the history
Reorganize a little bit: add ./docs, ./demos, and MAINTAINERS.md
  • Loading branch information
mikix authored Jul 17, 2024
2 parents 64fe3f6 + 292d1cd commit c7b325f
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 69 deletions.
42 changes: 42 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Maintainer Notes

## Building Distribution

pip install -U build
python3 -m build

### Incrementing the lib version

- Edit `fhirclient/client.py` and change the `__version__` field.
- Edit `docs/Doxyfile` and change the `PROJECT_NUMBER` field.

## Docs Generation

Docs are generated with [Doxygen](https://www.doxygen.nl/)
and [doxypypy](https://github.com/Feneric/doxypypy).
You can install doxypypy via pip: `pip install doxypypy`.
Then you can just run Doxygen. Configuration is stored in `docs/Doxyfile`.

Running Doxygen will put the generated HTML documentation into `docs/html`.
Those files make up the content of the `gh-pages` branch.
I usually perform a second checkout of the _gh-pages_ branch and copy the HTML files over, with:

doxygen docs/Doxyfile
rsync -a docs/html/ ../client-py-web/

## PyPi Publishing (notes for SMART team)

Using flit (*Note*: Alternatively, you can use [twine](https://twine.readthedocs.io/)):

### Make sure that you have the PyPi account credentials in your account

copy server.smarthealthit.org:/home/fhir/.pypirc to ~/.pypirc

### Test the build

python3 -m build

### Upload the packages to PyPi

pip install -U flit
flit publish
70 changes: 15 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,69 +152,29 @@ patient.name[0].given

### Flask App

Take a look at [`flask_app.py`][flask_app] to see how you can use the client in a simple (Flask) app.
This app starts a web server, listening on [_localhost:8000_](http://localhost:8000), and prompts you to log in to our sandbox server and select a patient.
It then retrieves the selected patient's demographics and med prescriptions and lists them on a simple HTML page.
Take a look at
[flask_app.py](https://github.com/smart-on-fhir/client-py/blob/main/demos/flask/flask_app.py)
to see how you can use the client in a simple (Flask) app.
This app starts a web server,
listening on [_localhost:8000_](http://localhost:8000),
and prompts you to log in to our sandbox server and select a patient.
It then retrieves the selected patient's demographics and med prescriptions
and lists them on a simple HTML page.

The Flask demo app has separate requirements.
Clone the _client-py_ repository, then create a virtual environment (not compulsory but recommended) and install the needed packages as shown:
Clone the _client-py_ repository,
then create a virtual environment (not compulsory but recommended)
and install the needed packages as shown:

git clone https://github.com/smart-on-fhir/client-py.git
cd client-py
virtualenv -p python3 env
cd client-py/demos/flask
python3 -m venv env
. env/bin/activate
pip install -r requirements_flask_app.txt
python flask_app.py


## Building Distribution

pip install -U build
python3 -m build


### Incrementing the lib version

- Edit `fhirclient/client.py` and change the `__version__` field.
- Edit `Doxyfile` and change the `PROJECT_NUMBER` field.


## Docs Generation

Docs are generated with [Doxygen][] and [doxypypy][].
You can install doxypypy via pip: `pip install doxypypy`.
Then you can just run Doxygen. Configuration is stored in the `Doxyfile`.

Running Doxygen will put the generated documentation into `docs`, the HTML files into `docs/html`.
Those files make up the content of the `gh-pages` branch.
I usually perform a second checkout of the _gh-pages_ branch and copy the html files over, with:

doxygen
rsync -a docs/html/ ../client-py-web/


## PyPi Publishing (notes for SMART team)

Using flit (*Note*: Alternatively, you can use [twine](https://twine.readthedocs.io/)):

### Make sure that you have the PyPi account credentials in your account

copy server.smarthealthit.org:/home/fhir/.pypirc to ~/.pypirc

### Test the build

python3 -m build

### Upload the packages to PyPi

pip install -U flit
flit publish
pip install -r requirements.txt
./flask_app.py


[fhir]: http://www.hl7.org/implement/standards/fhir/
[smart]: http://docs.smarthealthit.org
[fhir-parser]: https://github.com/smart-on-fhir/fhir-parser
[docs]: https://smart-on-fhir.github.io/client-py
[flask_app]: https://github.com/smart-on-fhir/client-py/blob/main/flask_app.py
[doxygen]: http://www.stack.nl/~dimitri/doxygen
[doxypypy]: https://github.com/Feneric/doxypypy
2 changes: 1 addition & 1 deletion flask_app.py → demos/flask/flask_app.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python3

import logging
from fhirclient import client
Expand Down
3 changes: 0 additions & 3 deletions flaskbeaker.py → demos/flask/flaskbeaker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask.sessions import SessionInterface
from beaker.middleware import SessionMiddleware

Expand Down
3 changes: 3 additions & 0 deletions demos/flask/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
beaker>=1.13.0
fhirclient>=4
flask>=2.3.2
4 changes: 2 additions & 2 deletions Doxyfile → docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ INPUT_FILTER =
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.

FILTER_PATTERNS = *.py=Doxyfilter
FILTER_PATTERNS = *.py=./docs/Doxyfilter

# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER ) will also be used to filter the input files that are used for
Expand Down Expand Up @@ -1140,7 +1140,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET = Doxystyle.css
HTML_EXTRA_STYLESHEET = ./docs/Doxystyle.css

# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 0 additions & 8 deletions requirements_flask_app.txt

This file was deleted.

0 comments on commit c7b325f

Please sign in to comment.