Dear Dr. Luis,
I was abel to make Thalamus work in accepting new user's data.
The problem was there is an extra "," on line 74 in thalamus.py. I
have also noticed the same coma in the development version of it.
I am not a python programmer but as soon as I removed it things
started to work.
Dear Luis,
Thanks for taken your time to explain the below to me. I am
making some progress and here is what I have so far:
I was able to load the database using the populate script and I
have added a record with a root role, but now when I go to the
federation queue and try to send the changes like creating new
patient record or just a person I get this
[2019-05-22 17:38:41 +0000] [30800] [DEBUG] GET
/people/IRQVSQ827RFZ
[2019-05-22 17:39:47 +0000] [30800] [DEBUG] POST
/people/IRQYPS253LUG
[2019-05-22 17:39:49 +0000] [30800] [ERROR] Exception on
/people/IRQYPS253LUG [POST]
Traceback (most recent call last):
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask/app.py",
line 1813, in full_dispatch_request
rv = self.dispatch_request()
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask/app.py",
line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_restful/__init__.py",
line 458, in wrapper
resp = resource(*args, **kwargs)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_httpauth.py",
line 104, in decorated
return f(*args, **kwargs)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask/views.py",
line 88, in view
return self.dispatch_request(*args, **kwargs)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_restful/__init__.py",
line 573, in dispatch_request
resp = meth(*args, **kwargs)
File "/opt/gnuhealth/thalamus.py", line 199, in post
if check_id('people', person_id):
File "/opt/gnuhealth/thalamus.py", line 72, in check_id
where id = %s limit(1)', (table, resid))
psycopg2.errors.SyntaxError: syntax error at or near "'people'"
LINE 1: SELECT id from 'people' where id =
'IRQYPS253LUG' li...
If I understand the above correctly it is trying to look for a
record that it does not exists in the DB which is is true since
I am trying to insert this record. What is the proper way to
insert the new record? given I have setup the federation node
correctly because when I do a test connection it comes back with
success.
Also I have ran into another problem relating to the node
configuration. when I first start thalamus I can authenticate
successfully the first time when I do the connection test, but
if I go back few minutes later and do the test it fails on
authentication and I have to restart the Thalamus server again
for it to succeed. Any idea why?
here is the log out put for the successful auth after a
restart:
[2019-05-22 17:38:36 +0000] [30797] [INFO] Starting gunicorn
19.9.0
[2019-05-22 17:38:36 +0000] [30797] [DEBUG] Arbiter booted
[2019-05-22 17:38:36 +0000] [30797] [INFO] Listening at: https://0.0.0.0:8443 (30797)
[2019-05-22 17:38:36 +0000] [30797] [INFO] Using worker: sync
[2019-05-22 17:38:36 +0000] [30800] [INFO] Booting worker with
pid: 30800
[2019-05-22 17:38:36 +0000] [30797] [DEBUG] 1 workers
[2019-05-22 17:38:41 +0000] [30800] [DEBUG] GET
/people/IRQVSQ827RFZ
here is the log output for the failed authentication
[2019-05-22 17:38:25 +0000] [30772] [DEBUG] GET
/people/IRQVSQ827RFZ
[2019-05-22 17:38:25 +0000] [30772] [ERROR] Exception on
/people/IRQVSQ827RFZ [GET]
Traceback (most recent call last):
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask/app.py",
line 1813, in full_dispatch_request
rv = self.dispatch_request()
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask/app.py",
line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_restful/__init__.py",
line 458, in wrapper
resp = resource(*args, **kwargs)
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_httpauth.py",
line 99, in decorated
if not self.authenticate(auth, password):
File
"/home/gnuhealth/.local/lib/python3.6/site-packages/flask_httpauth.py",
line 136, in authenticate
return self.verify_password_callback(username,
client_password)
File "/opt/gnuhealth/thalamus.py", line 91, in verify_password
where id = %s limit(1)', (username,))
psycopg2.errors.InFailedSqlTransaction: current transaction is
aborted, commands ignored until end of transaction block
here is the record in the DB for the user in question above:
{
"id": "IRQVSQ827RFZ",
"dob": "1972-02-10",
"name": "bahaa",
"roles": [
"root"
],
"active": true,
"gender": "Middle-East",
"lastname": "Alamood",
"password":
"$2a$15$xygR/Yu4ppHxT/xCayhewOwZ2YGWacUl7fiUEfAlOfldSv8L3EInS",
"education": "university",
"ethnicity": "latino",
"profession": "doctor",
"marital_status": "married"
}
On 5/19/19 7:37 AM, Luis Falcon
wrote:
Dear Bahaa
On Sat, 18 May 2019 13:53:12 -0400
Bahaa Alamood <address@hidden> wrote:
Dear Dr. Falcon,
First of all, thanks for the quick response and thanks for all the
work you and your team have done and still doing for the health of
all humans.
Thank you for being part of the community :)
I guess I was not clear about the problem I am having. I have
installed gnu health on one machine and configured the company and
institution as well as I have added a user as a health professional.
I have install Thalamus on another machine and it is running and
accepting request as you can see from the log output below:
2019-05-17 18:44:50 +0000] [1373] [DEBUG] GET /people/balamood
[2019-05-17 18:46:18 +0000] [1373] [DEBUG] GET /people/VSQ827RFZ
[2019-05-17 18:47:25 +0000] [1373] [DEBUG] GET /people/balamood
[2019-05-17 18:49:12 +0000] [1373] [DEBUG] GET /people/balamood
[2019-05-17 18:53:43 +0000] [1373] [DEBUG] GET /people/balamood
[2019-05-17 18:53:58 +0000] [1373] [DEBUG] GET /people/admin
[2019-05-18 16:11:46 +0000] [1373] [DEBUG] GET /people/admin
my problem is in setting the parameters for the Thalamus server from
the other node. I just need to know how to create these users and
passwords that Thalamus would accept?
Also if Thalamus is just a message relay how does it authenticate?
what does it compare the credentials to when doing the
authentication? right now I have an empty DB on the Thalamus node how
does it get populated with user credentials?
We need to differentiate between the Health Information System (HIS) and
the Hospital Management System (node)
* HIS: Thalamus + Pg Document-oriented DB (available to all nodes)
* HMIS : One node of the many nodes that can participate on the
Federation. This node is the "traditional" GNU Health HMIS that you
installed, with the "health_federation" module that allows the
connection to Thalamus.
As explained in the documentation , each node is independent. What is
important is that the Federation Account. This is a unique ID assigned
to each person, and that is part of every resource related to her /
him.
We have a simple "populate" script that fills in some demo users at
the HIS (The new development version of thalamus has a "root" user).
The HIS uses a role-based authorization model. It is up to each node to
interact with Thalamus for the different actions (retrieve, update,
create... ) on the available resources (demographics, Pages of
Life, ... ).
For instance, to make GH HMIS communicate to the Federation, we use
the "Federation Node Configuration", where we include the admin user
in control of the GH instance node. That will be responsible to
automatically send all queued requests to Thalamus.
Due to the federated model design, you need to keep in mind that the
credentials used to authenticate users on the nodes are not necessarily
the same as in the HIS.
The upcoming GNU Health Federation Portal will serve to make the
administration tasks (like creating a new federation account) simpler .
You can read more in these announcements.
* http://lists.gnu.org/archive/html/health-dev/2019-04/msg00005.html
* http://lists.gnu.org/archive/html/health-dev/2019-05/msg00000.html
It might sound a bit daunting at the beginning, but it's actually a
simple, yet very flexible and scalable model.
Hope it's clearer now. Anyways, I will be speaking about this at
openSUSE Conference this Friday in Nuremberg, Germany. It is supposed
to be streamed, so you should be able to join.
In addition, on June 3rd we'll be having a community meeting via Jitsi,
where we'll talk about the Federation, so looking forward to seeing you
there ! :)
Have a great week !
Luis
--
Bahaaldin Al-amood
Managing Director
IQ Tel: +964 (0) 780 926 2103
US tel: 540 632 1388
email: address@hidden
Skype ID: bahaa.alamood
Arc Digital Solutions and Consultancy
www.arcdsc.com
This message contains information that may be confidential
and privileged to Arc digital Solutions and Consultancy, its partners, or customers.
Unauthorized use is strictly prohibited. Unless you are the
addressee (or authorized to receive mail for the addressee),
you should not use, copy or disclose to anyone this message
or any information contained in this message. If you have
received this message in error, please so advise the sender
by reply e-mail and delete this message. Thank you for your
cooperation.