~glhrmfrts/hcs-sdk-py

HCS SDK Python wrapper
implement ecg finish functions
change pip version
update version and docs

clone

read-only
https://git.sr.ht/~glhrmfrts/hcs-sdk-py
read/write
git@git.sr.ht:~glhrmfrts/hcs-sdk-py

You can also use your local clone with git send-email.

#hcs-sdk-py

HCS SDK Python Wrapper

#How to use

First, you need to build the C shared library: https://git.sr.ht/~glhrmfrts/hcs-sdk-c

After that you can install the python package:

$ pip install git+https://git.sr.ht/~glhrmfrts/hcs-sdk-py@v0.4.2

You then need to call load_library with the path of the shared library (.so file) before making any other calls from the hcs module:

import hcs

hcs.load_library("/path/to/libhcs-sdk.so")

#Connection

from hcs import *

hcs_client = HCS("hcs.vikingmakt.tech", "31110", "operator name")

try:
    hcs_client.connect()
except (ConnectError, SocketError, InvalidAddress) as e:
    print("error connecting: ", e)
else:
    assert hcs_client.connected

#Using the APIs

Import the APIs you need from the hcs.api module (e.g.: create and read an exam):

import hcs.api.exam as exam

# Create new exam
exam_uid = exam.new(hcs_client, "PATIENT", "PHYSICIAN")

# Check if it exists
assert exam.exists(hcs_client, exam_uid)

# Set exam property
exam.set(hcs_client, exam_uid, "some_property", "FOOBAR")

# Get exam property
try:
    print(exam.get(hcs_client, exam_uid, "some_property"))
except NotFound:
    print("property not found")

#Custom RAID Requests

If you need to make a request which is not available in the APIs module:

from hcs import request

response = request(hcs_client, "api.action", request_body)
print(response['header'], response['body'])

#Cleanup

When connection is no longer needed, you need to call the HCS.dispose method:

# Disconnect only
hcs_client.disconnect()

# Disconnect and free resources (object is no longer valid to make any calls)
hcs_client.dispose()

#Documentation

http://nemethg.xyz/docs/hcs-sdk-py/hcs/index.html

#License

ISC