diff --git a/healthchain/service/soap/icdsservices.py b/healthchain/service/soap/cdsservices.py similarity index 63% rename from healthchain/service/soap/icdsservices.py rename to healthchain/service/soap/cdsservices.py index e739de7..819b6f0 100644 --- a/healthchain/service/soap/icdsservices.py +++ b/healthchain/service/soap/cdsservices.py @@ -3,11 +3,14 @@ from spyne import rpc, Service, Unicode, ByteArray from typing import Callable +from .models.notereaderresponse import Response + log = logging.getLogger(__name__) -class ICDSServices(Service): +class CDSServices(Service): + # Ugh WHY did Epic name it like this - I'm not sure if this is something you can change so I will keep it like this def __init__(self, service_func: Callable) -> None: super().__init__() self._service_func = service_func @@ -24,11 +27,11 @@ def __init__(self, service_func: Callable) -> None: "document": "Document", }, _wsdl_part_name="parameters", - # _returns=Response + _returns=Response, # _faults=[ClientFault, ServerFault] ) - def ProcessDocument(ctx, sessionId, workType, organizationId, document): + def ProcessDocument(self, ctx, sessionId, workType, organizationId, document): # will this work? - # response = ctx._service_func(document) + response = self._service_func(document) - pass + return response diff --git a/healthchain/service/soap/models/notereaderresponse.py b/healthchain/service/soap/models/notereaderresponse.py new file mode 100644 index 0000000..f5440c4 --- /dev/null +++ b/healthchain/service/soap/models/notereaderresponse.py @@ -0,0 +1,8 @@ +from spyne import ComplexModel +from spyne import Unicode, ByteArray + + +class NoteReaderResponse(ComplexModel): + __namespace__ = "urn:epic-com:Common.2013.Services" + Document = ByteArray + Error = Unicode diff --git a/healthchain/service/soap/wsgi.py b/healthchain/service/soap/wsgi.py index 33f6221..c23ba5f 100644 --- a/healthchain/service/soap/wsgi.py +++ b/healthchain/service/soap/wsgi.py @@ -2,12 +2,12 @@ from spyne.protocol.soap import Soap11 from spyne.server.wsgi import WsgiApplication -from .icdsservices import ICDSServices +from .cdsservices import CDSServices -def start_wsgi(): +def start_wsgi(service_func): application = Application( - [ICDSServices], + [CDSServices(service_func=service_func)], name="ICDSServices", tns="urn:epic-com:Common.2013.Services", in_protocol=Soap11(validator="lxml"), diff --git a/healthchain/templates/soap_envelope.xml b/healthchain/templates/soap_envelope.xml new file mode 100644 index 0000000..6ce1371 --- /dev/null +++ b/healthchain/templates/soap_envelope.xml @@ -0,0 +1,25 @@ + + + + + + + 0000-0000-0000-0000 + + + UCLH + + + 2 + + + + + + + + + diff --git a/pyproject.toml b/pyproject.toml index e106a41..d3a4930 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Artificial Intelligence", ] +include = ["healthchain/templates/*"] [project.urls] "Homepage" = "https://dotimplement.github.io/HealthChain/"