thalamus


Namethalamus JSON
Version 0.9.16 PyPI version JSON
download
home_pagehttps://www.gnuhealth.org
SummaryThe GNU Health Federation Message and Authentication Server
upload_time2024-03-25 20:07:30
maintainerNone
docs_urlNone
authorGNU Solidario
requires_pythonNone
licenseNone
keywords health api rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. SPDX-FileCopyrightText: 2017-2024 GNU Solidario <health@gnusolidario.org>
.. SPDX-FileCopyrightText: 2017-2024 Luis Falcón <falcon@gnuhealth.org>
..
.. SPDX-License-Identifier: CC-BY-SA-4.0

Thalamus: The GNU Health Federation Message and Authentication Server
=====================================================================

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

#. **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.

#. **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::

  $ pip3 install --upgrade --user thalamus

**Note on psycopg2**: The package psycopg2-binary is a source of issues, so we have replaced
it by psycopg2 since thalamus 0.9.16. You need to install the postgresql development libraries.
look for the description like *PostgreSQL shared libraries (development files)* or
*header files* in your operating system packages

 
 
Technology
----------
RESTful API: Thalamus uses a REST (Representional State Transfer) 
architectural style, powered by 
`Flask <https://en.wikipedia.org/wiki/Flask_(web_framework)>`_ 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 <https://en.wikipedia.org/wiki/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 `uWSGI <http://projects.unbit.it/uwsgi>`_ , but you can use any WSGI server. We have
also included the configuration file for Gunicorn if you prefer it instead of uWSGI.

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

  $ uwsgi --ini etc/thalamus_uwsgi.ini


For development, ff you want to run it directly from the Flask Werkzeug server,::

  $ python3 ./thalamus.py


Examples
--------
**Command-line, using httpie**

Retrieve the demographic information of person::

  $ http --verify no --auth ARGBUE111FAV:freedom https://federation.gnuhealth.org:8443/people/ESPGNU777ORG


Yields to::

    HTTP/1.1 200 OK
    Access-Control-Allow-Origin: *
    Connection: close
    Content-Length: 547
    Content-Type: application/json
    Date: Thu, 30 Jul 2020 12:01:37 GMT
    Server: gunicorn/20.0.0

    {
        "_id": "ESPGNU777ORG",
        "active": true,
        "dob": "1990-10-04",
        "education": "tertiary",
        "ethnicity": "latino",
        "gender": "f",
        "id": "ESPGNU777ORG",
        "lastname": "Betz",
        "marital_status": "married",
        "modification_info": {
            "node": "SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL",
            "timestamp": "2018-11-06 19:24:43.662846",
            "user": "ITAPYT999HON"
        },
        "name": "Ana",
        "password": "$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW",
        "profession": "teacher",
        "roles": [
            "end_user"
        ]
    }

**Retrieve the demographics information globally**::

  $ http --verify no --auth ARGBUE111FAV:freedom https://federation.gnuhealth.org:8443/people

Yields to::

    HTTP/1.1 200 OK 
    Access-Control-Allow-Origin: * 
    Connection: close 
    Content-Length: 2715 
    Content-Type: application/json 
    Date: Mon, 20 Jul 2020 18:03:24 GMT 
    Server: gunicorn/20.0.0 

    [ 
    [ 
        { 
            "active": true, 
            "dob": "1984-10-05", 
            "education": "tertiary", 
            "ethnicity": "latino", 
            "gender": "f", 
            "id": "ITAPYT999HON", 
            "lastname": "Cordara", 
            "marital_status": "married", 
            "name": "Cameron", 
            "password": "$2b$12$Y9rX7PoTHRXhTO1H78Tan.8mVmyayGAUIveiYxu2Qeo0ZDRvJQ8/2", 
            "profession": "teacher", 
            "roles": [ 
                "end_user", 
                "health_professional" 
            ] 
        } 
    ],
    [ 
        { 
            "creation_info": { 
                "node": "SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL", 
                "timestamp": "2019-11-20 10:39:21.162731", 
                "user": "ITAPYT999HON" 
            }, 
            "dob": "1999-10-12", 
            "gender": "m", 
            "id": "DEUMOP095IDI", 
            "lastname": "Dillinger", 
            "name": "John Doe", 
            "roles": [ 
                "end_user" 
            ] 
        } 
    ],

    
    [ 
        { 
            "active": true, 
            "dob": "2008-10-12", 
            "education": "tertiary", 
            "ethnicity": "latino", 
            "gender": "f", 
            "id": "ARGBUE111FAV", 
            "lastname": "Root", 
            "marital_status": "married", 
            "name": "Admin", 
            "password": "$2b$12$McKDNgArdHKbUssD1fj64ecpdbJGMIt29ns7DGvqzqIT26W0dtJzi", 
            "profession": "System Administrator", 
            "roles": [ 
                "root" 
            ] 
        } 
    ], 
    [ 
        { 
            "_id": "ESPGNU777ORG", 
            "active": true, 
            "dob": "1990-10-04", 
            "education": "tertiary", 
            "ethnicity": "latino", 
            "gender": "f", 
            "id": "ESPGNU777ORG", 
            "lastname": "Betz", 
            "marital_status": "married", 
            "modification_info": { 
                "node": "SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL", 
                "timestamp": "2018-11-06 19:24:43.662846", 
                "user": "ITAPYT999HON" 
            }, 
            "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 on roles**
The demo user "ITAPYT999HON" is a health professional (health_professional role),
so she has global access to demographic information. 

The user "ARGBUE111FAV", password "freedom". This is the "root" user for the demo database. 

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
--------
https://www.gnuhealth.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 documentation portal:

https://docs.gnuhealth.org


:Author: Luis Falcon <falcon@gnuhealth.org>

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.gnuhealth.org",
    "name": "thalamus",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "health API REST",
    "author": "GNU Solidario",
    "author_email": "health@gnusolidario.org",
    "download_url": "https://files.pythonhosted.org/packages/87/8b/2978691a9a6bc865bde102036277ea08d0967bbdc2b5c472dbc18a892be9/thalamus-0.9.16.tar.gz",
    "platform": "any",
    "description": ".. SPDX-FileCopyrightText: 2017-2024 GNU Solidario <health@gnusolidario.org>\n.. SPDX-FileCopyrightText: 2017-2024 Luis Falc\u00f3n <falcon@gnuhealth.org>\n..\n.. SPDX-License-Identifier: CC-BY-SA-4.0\n\nThalamus: The GNU Health Federation Message and Authentication Server\n=====================================================================\n\nThe Thalamus project provides a RESTful API hub to all the GNU Health \nFederation nodes. The main functions are:\n\n#. **Message server**: A concentrator and message relay from and to  \n   the participating nodes in the GNU Health Federation and the GNU Health\n   Information System (PgSQL). Some of the participating nodes include \n   the GNU Health HMIS, MyGNUHealth mobile PHR application,\n   laboratories, research institutions and civil offices.\n\n#. **Authentication Server**: Thalamus also serves as an authentication and\n   authorization server to interact with the GNUHealth Information System\n\n\nThalamus is part of the GNU Health project, but it is a self contained, \nindependent server that can be used in different health related scenarios.\n\nInstallation\n------------\nThalamus is pip-installable::\n\n  $ pip3 install --upgrade --user thalamus\n\n**Note on psycopg2**: The package psycopg2-binary is a source of issues, so we have replaced\nit by psycopg2 since thalamus 0.9.16. You need to install the postgresql development libraries.\nlook for the description like *PostgreSQL shared libraries (development files)* or\n*header files* in your operating system packages\n\n \n \nTechnology\n----------\nRESTful API: Thalamus uses a REST (Representional State Transfer) \narchitectural style, powered by \n`Flask <https://en.wikipedia.org/wiki/Flask_(web_framework)>`_ technology\n\nThalamus will perform CRUD (Create, Read, Update, Delete) operations. They\nwill be achived via the following methods upon resources and their instances.\n\n* **GET** : Read\n \n* **POST** : Create\n \n* **PATCH** : Update\n \n* **DELETE** : Delete.\n\nThe DELETE operations will be minimal.\n  \n\nJSON: The information will be encoded in `JSON <https://en.wikipedia.org/wiki/JSON>`_ format.\n\nResources\n---------\n\nSome resources and end-points are:\n\n* People (/people)\n\n* Pages of Life (/pols)\n\n* DomiciliaryUnits (/domiciliary-units)\n\n* PersonalDocs (/personal_docs)\n\n\nRunning Thalamus from a WSGI Container\n--------------------------------------\nIn production settings, for performance reasons you should use a HTTP server.\nWe have chosen `uWSGI <http://projects.unbit.it/uwsgi>`_ , but you can use any WSGI server. We have\nalso included the configuration file for Gunicorn if you prefer it instead of uWSGI.\n\nFor example, you can run the Thalamus application from uWSGI as follows.\nThe default configuration file uses secure (SSL) connections::\n\n  $ uwsgi --ini etc/thalamus_uwsgi.ini\n\n\nFor development, ff you want to run it directly from the Flask Werkzeug server,::\n\n  $ python3 ./thalamus.py\n\n\nExamples\n--------\n**Command-line, using httpie**\n\nRetrieve the demographic information of person::\n\n  $ http --verify no --auth ARGBUE111FAV:freedom https://federation.gnuhealth.org:8443/people/ESPGNU777ORG\n\n\nYields to::\n\n    HTTP/1.1 200 OK\n    Access-Control-Allow-Origin: *\n    Connection: close\n    Content-Length: 547\n    Content-Type: application/json\n    Date: Thu, 30 Jul 2020 12:01:37 GMT\n    Server: gunicorn/20.0.0\n\n    {\n        \"_id\": \"ESPGNU777ORG\",\n        \"active\": true,\n        \"dob\": \"1990-10-04\",\n        \"education\": \"tertiary\",\n        \"ethnicity\": \"latino\",\n        \"gender\": \"f\",\n        \"id\": \"ESPGNU777ORG\",\n        \"lastname\": \"Betz\",\n        \"marital_status\": \"married\",\n        \"modification_info\": {\n            \"node\": \"SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL\",\n            \"timestamp\": \"2018-11-06 19:24:43.662846\",\n            \"user\": \"ITAPYT999HON\"\n        },\n        \"name\": \"Ana\",\n        \"password\": \"$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW\",\n        \"profession\": \"teacher\",\n        \"roles\": [\n            \"end_user\"\n        ]\n    }\n\n**Retrieve the demographics information globally**::\n\n  $ http --verify no --auth ARGBUE111FAV:freedom https://federation.gnuhealth.org:8443/people\n\nYields to::\n\n    HTTP/1.1 200 OK \n    Access-Control-Allow-Origin: * \n    Connection: close \n    Content-Length: 2715 \n    Content-Type: application/json \n    Date: Mon, 20 Jul 2020 18:03:24 GMT \n    Server: gunicorn/20.0.0 \n\n    [ \n    [ \n        { \n            \"active\": true, \n            \"dob\": \"1984-10-05\", \n            \"education\": \"tertiary\", \n            \"ethnicity\": \"latino\", \n            \"gender\": \"f\", \n            \"id\": \"ITAPYT999HON\", \n            \"lastname\": \"Cordara\", \n            \"marital_status\": \"married\", \n            \"name\": \"Cameron\", \n            \"password\": \"$2b$12$Y9rX7PoTHRXhTO1H78Tan.8mVmyayGAUIveiYxu2Qeo0ZDRvJQ8/2\", \n            \"profession\": \"teacher\", \n            \"roles\": [ \n                \"end_user\", \n                \"health_professional\" \n            ] \n        } \n    ],\n    [ \n        { \n            \"creation_info\": { \n                \"node\": \"SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL\", \n                \"timestamp\": \"2019-11-20 10:39:21.162731\", \n                \"user\": \"ITAPYT999HON\" \n            }, \n            \"dob\": \"1999-10-12\", \n            \"gender\": \"m\", \n            \"id\": \"DEUMOP095IDI\", \n            \"lastname\": \"Dillinger\", \n            \"name\": \"John Doe\", \n            \"roles\": [ \n                \"end_user\" \n            ] \n        } \n    ],\n\n    \n    [ \n        { \n            \"active\": true, \n            \"dob\": \"2008-10-12\", \n            \"education\": \"tertiary\", \n            \"ethnicity\": \"latino\", \n            \"gender\": \"f\", \n            \"id\": \"ARGBUE111FAV\", \n            \"lastname\": \"Root\", \n            \"marital_status\": \"married\", \n            \"name\": \"Admin\", \n            \"password\": \"$2b$12$McKDNgArdHKbUssD1fj64ecpdbJGMIt29ns7DGvqzqIT26W0dtJzi\", \n            \"profession\": \"System Administrator\", \n            \"roles\": [ \n                \"root\" \n            ] \n        } \n    ], \n    [ \n        { \n            \"_id\": \"ESPGNU777ORG\", \n            \"active\": true, \n            \"dob\": \"1990-10-04\", \n            \"education\": \"tertiary\", \n            \"ethnicity\": \"latino\", \n            \"gender\": \"f\", \n            \"id\": \"ESPGNU777ORG\", \n            \"lastname\": \"Betz\", \n            \"marital_status\": \"married\", \n            \"modification_info\": { \n                \"node\": \"SPAIN-LASPALMAS-GNUSOLIDARIO-GRAL_HOSPITAL\", \n                \"timestamp\": \"2018-11-06 19:24:43.662846\", \n                \"user\": \"ITAPYT999HON\" \n            }, \n            \"name\": \"Ana\", \n            \"password\": \"$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW\", \n            \"profession\": \"teacher\", \n            \"roles\": [ \n                \"end_user\" \n            ] \n        } \n    ], \n    ]\n\n\n**Using Python requests**::\n\n  >>> import requests\n  >>> person = requests.get('https://localhost:8443/people/ESPGNU777ORG', auth=('ITAPYT999HON', 'gnusolidario'), verify=False)\n  >>> person.json()\n    {'_id': 'ESPGNU777ORG', 'active': True, 'biological_sex': 'female','dob': 'Fri, 04 Oct 1985 13:05:00 GMT',\n    'education': 'tertiary', 'ethnicity': 'latino', 'gender': 'female', 'lastname': 'Betz', 'marital_status': 'married',\n    'name': 'Ana', 'password': '$2b$12$cjrKVGYEKUwCmVDCtEnwcegcrmECTmeBz526AAD/ZqMGPWFpHJ4FW', 'profession': 'teacher',\n    'roles': ['end_user']}\n\n**Note on roles**\nThe demo user \"ITAPYT999HON\" is a health professional (health_professional role),\nso she has global access to demographic information. \n\nThe user \"ARGBUE111FAV\", password \"freedom\". This is the \"root\" user for the demo database. \n\nCheck the ``roles.cfg`` file for examples information about roles and ACLs.\n\n\nDevelopment\n-----------\nThalamus is part of the GNU Health project.\n\nThe development will be done on GNU Savannah, using the Mercurial repository.\n\nTasks, bugs and mailing lists will be on health-dev@gnu.org , for development.\n\nGeneral questions can be done on health@gnu.org mailing list.\n\nHomepage\n--------\nhttps://www.gnuhealth.org\n\n\nRelease Cycle\n-------------\nThalamus, as other GNU Health components, will follow its own release process.\n\n\nDocumentation\n-------------\nThe Thalamus documentation will be at the corresponding\nchapter in the GNU Health documentation portal:\n\nhttps://docs.gnuhealth.org\n\n\n:Author: Luis Falcon <falcon@gnuhealth.org>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The GNU Health Federation Message and Authentication Server",
    "version": "0.9.16",
    "project_urls": {
        "Download": "http://ftp.gnu.org/gnu/health",
        "Homepage": "https://www.gnuhealth.org"
    },
    "split_keywords": [
        "health",
        "api",
        "rest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "894724ccd959755cd3f64fe1834363de4cc69f8b6d32682203b0905091e20bc7",
                "md5": "a0291dcfb61df4d7f3628173eb90c718",
                "sha256": "54bb4170552664753742716d99cb68fed615e87b09a3fabc0c186e41160ed4d8"
            },
            "downloads": -1,
            "filename": "thalamus-0.9.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0291dcfb61df4d7f3628173eb90c718",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 115163,
            "upload_time": "2024-03-25T20:07:27",
            "upload_time_iso_8601": "2024-03-25T20:07:27.178818Z",
            "url": "https://files.pythonhosted.org/packages/89/47/24ccd959755cd3f64fe1834363de4cc69f8b6d32682203b0905091e20bc7/thalamus-0.9.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "878b2978691a9a6bc865bde102036277ea08d0967bbdc2b5c472dbc18a892be9",
                "md5": "36f3b1a7d4aa4a9fed6ca5f75fa17733",
                "sha256": "80bcd48312f55e8804f2fd10b702277fec7cc75cfe4b1aa8b618e41958bd9f26"
            },
            "downloads": -1,
            "filename": "thalamus-0.9.16.tar.gz",
            "has_sig": false,
            "md5_digest": "36f3b1a7d4aa4a9fed6ca5f75fa17733",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 118233,
            "upload_time": "2024-03-25T20:07:30",
            "upload_time_iso_8601": "2024-03-25T20:07:30.151747Z",
            "url": "https://files.pythonhosted.org/packages/87/8b/2978691a9a6bc865bde102036277ea08d0967bbdc2b5c472dbc18a892be9/thalamus-0.9.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-25 20:07:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "thalamus"
}
        
Elapsed time: 0.23420s