Skip to main content

The GNU Health Federation Message and Authentication Server

Project description

The Thalamus project provides a RESTful API hub to all the GNU Health Federation nodes. The main functions are:

  1. Message server: A concentrator and message relay from and to the participating nodes in the GNU Health Federation and the GNU Health Information System (PgSQL). Some of the participating nodes include the GNU Health HMIS, MyGNUHealth mobile PHR application, laboratories, research institutions and civil offices.

  2. Authentication Server: Thalamus also serves as an authentication and authorization server to interact with the GNUHealth Information System

Thalamus is part of the GNU Health project, but it is a self contained, independent server that can be used in different health related scenarios.

Installation

Thalamus is pip-installable:

$ pip install --user thalamus

Technology

RESTful API: Thalamus uses a REST (Representional State Transfer) architectural style, powered by Flask technology

Thalamus will perform CRUD (Create, Read, Update, Delete) operations. They will be achived via the following methods upon resources and their instances.

  • GET : Read

  • POST : Create

  • PATCH : Update

  • DELETE : Delete.

The DELETE operations will be minimal.

JSON: The information will be encoded in JSON format.

Resources

Some resources and end-points are:

  • People (/people)

  • Pages of Life (/pols)

  • DomiciliaryUnits (/domiciliary-units)

  • PersonalDocs (/personal_docs)

Running Thalamus from a WSGI Container

In production settings, for performance reasons you should use a HTTP server. We have chosen Gunicorn , but you can use any WSGI server.

Gunicorn supports WSGI natively and it comes as Python package. We have included a simple, default config file (etc/gunicorn.cfg) to run Thalamus from Gunicorn with SSL enabled.

For example, you can run the Thalamus application from Gunicorn as follows. The default configuration file uses secure (SSL) connections:

$ gunicorn --config etc/gunicorn.cfg thalamus:app

If you want to run it directly from the Flask Werkzeug server,:

$ python ./thalamus.py

Examples

Command-line, using httpie

Retrieve the demographic information of person:

$ http --verify no --auth ITAPYT999HON:gnusolidario https://localhost:8443/people/ESPGNU777ORG

Yields to:

HTTP/1.1 200 OK
Connection: close
Content-Length: 411
Content-Type: application/json
Date: Fri, 21 Apr 2017 16:22:38 GMT
Server: gunicorn/19.7.1

{
    "_id": "ESPGNU777ORG",
    "active": true,
    "biological_sex": "female",
    "dob": "Fri, 04 Oct 1985 13:05:00 GMT",
    "education": "tertiary",
    "ethnicity": "latino",
    "gender": "female",
    "lastname": "Betz",
    "marital_status": "married",
    "name": "Ana",
    "password": "$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW",
    "profession": "teacher",
    "roles": [
    "end_user"
    ]

}

Retrieve the demographics information globally:

$ http --verify no --auth ITAPYT999HON:gnusolidario https://localhost:8443/people

Yields to:

HTTP/1.1 200 OK
Connection: close
Content-Length: 933
Content-Type: application/json
Date: Fri, 21 Apr 2017 16:31:23 GMT
Server: gunicorn/19.7.1

[
    {
        "_id": "ITAPYT999HON",
        "active": true,
        "biological_sex": "female",
        "dob": "Fri, 05 Oct 1984 09:00:00 GMT",
        "education": "tertiary",
        "ethnicity": "latino",
        "gender": "female",
        "lastname": "Cordara",
        "marital_status": "married",
        "name": "Cameron",
        "password": "$2b$12$Y9rX7PoTHRXhTO1H78Tan.8mVmyayGAUIveiYxu2Qeo0ZDRvJQ8/2",
        "profession": "teacher",
        "roles": [
        "end_user",
        "health_professional"
        ]

    },

    {
        "_id": "ESPGNU777ORG",
        "active": true,
        "biological_sex": "female",
        "dob": "Fri, 04 Oct 1985 13:05:00 GMT",
        "education": "tertiary",
        "ethnicity": "latino",
        "gender": "female",
        "lastname": "Betz",
        "marital_status": "married",
        "name": "Ana",
        "password": "$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW",
        "profession": "teacher",
        "roles": [
        "end_user"
        ]

    }

]

Using Python requests:

>>> import requests
>>> person = requests.get('https://localhost:8443/people/ESPGNU777ORG', auth=('ITAPYT999HON', 'gnusolidario'), verify=False)
>>> person.json()
  {'_id': 'ESPGNU777ORG', 'active': True, 'biological_sex': 'female','dob': 'Fri, 04 Oct 1985 13:05:00 GMT',
  'education': 'tertiary', 'ethnicity': 'latino', 'gender': 'female', 'lastname': 'Betz', 'marital_status': 'married',
  'name': 'Ana', 'password': '$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW', 'profession': 'teacher',
  'roles': ['end_user']}

Note: The demo user “ITAPYT999HON” is a health professional (health_professional role), so she has global access to demographic information. Check the roles.cfg file for examples information about roles and ACLs.

Development

Thalamus is part of the GNU Health project.

The development will be done on GNU Savannah, using the Mercurial repository.

Tasks, bugs and mailing lists will be on health-dev@gnu.org , for development.

General questions can be done on health@gnu.org mailing list.

Homepage

http://health.gnu.org

Release Cycle

Thalamus, as other GNU Health components, will follow its own release process.

Documentation

The Thalamus documentation will be at the corresponding chapter in the GNU Health Wikibook

https://en.wikibooks.org/wiki/GNU_Health

Author:

Luis Falcon <lfalcon@gnusolidario.org>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thalamus-0.9.8.tar.gz (87.6 kB view details)

Uploaded Source

Built Distribution

thalamus-0.9.8-py3-none-any.whl (86.0 kB view details)

Uploaded Python 3

File details

Details for the file thalamus-0.9.8.tar.gz.

File metadata

  • Download URL: thalamus-0.9.8.tar.gz
  • Upload date:
  • Size: 87.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for thalamus-0.9.8.tar.gz
Algorithm Hash digest
SHA256 7378cb7d96ae4bfa87ddbd65eddfb7a8aaeed3ba3f2005cc36162c0bcb101f46
MD5 8de495825b4b825b676a322195d5949c
BLAKE2b-256 31b8920e614cb91ac6c16f261b4b90050429c5d7b3ef1999bde13a73e2b85eb5

See more details on using hashes here.

File details

Details for the file thalamus-0.9.8-py3-none-any.whl.

File metadata

  • Download URL: thalamus-0.9.8-py3-none-any.whl
  • Upload date:
  • Size: 86.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for thalamus-0.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 27d10687c9651ec698e6231fbb455883edf5aee6280d730a57b1737770834578
MD5 1f1c233782ffd5253bf649dd574cc767
BLAKE2b-256 8442b884dd389e37c3415e0656b40b99d52171f0c5787503a0289c82cf6d55f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page