Package: openimis-be-claim-ai
openimis-be-claim-ai_pyopenIMIS Backend Claim AI reference moduleThis repository holds the files of the openIMIS Backend Claim AI reference module.
It is dedicated to be deployed as a module ofopenimis-be_py.ORM mapping:NoneDocker Setup:For setting up dockerized instance.envfile have to be added to openimis-be-claim_ai_py.env file must provide following variables:CHANNELS_HOST=<rabbitmq host used by channels layer>
ASGI_PORT=<Port on which the application is available>If local instance of rabbitmq is used thenamqp://guest:guest@127.0.0.1/can be used as CHANNELS HOST.In openimis-be-claim_ai_py directory files regarding model evaluation - Scaler, Encoder and Model
have to be added.
By default, expected file names are:Scaler.objEncoder.objjoblib_Voting_Model.pklUsed files can be changed by adjusting variables inmodule_config.json.
For the default files a hot reload is applied. If files other than defaults are used,
hot reload can be added by adjustingvolumepaths inclaim-aiservice in docker-compose.Listened Django SignalsNoneServicesClaimConsumer, websocket service responsible for AI evaluationWebsocket connection is available atclaim_ai/ws/Claim/<process_id>/. It accepts bytes which payloads which after
decoding utf-8 decoding are in format:{'type':<type>,'content':<payload_content>}Payload types:'claim.bundle.payload'Request:{'type':'claim.bundle.payload','content':<FHIRClaimBundle>,'bundle_id':<bundle_id>// Optional argument with bundle id used for bundle distinction}Response:{'type':'claim.bundle.payload','content':<FHIRClaimResponseBundle>,'index':<bundle_id>// bundle_id if it was given in request, subsequent numbers otherwise}Used for claim evaluation, request payload have to contain claim bundle in FHIR format,
after request was accepted'claim.bundle.acceptance'is sent. After evaluation
proper 'claim.bundle.payload' response with evaluation result is sent.'claim.bundle.acceptance'Request:{'type':'claim.bundle.acceptance','content':<bundle_id>// index receieved from claim.bundle.payload}Response:{'type':'claim.bundle.acceptance','content':'Accepted','index':<bundle_id>// bundle_id if it was given in request, subsequent numbers otherwise}Request is expected to be receieved from client after FHIR claim repsonse bundle was correctly
receieved. Response is sent after claim.bundle.payload was receieved from the server.'claim.bundle.authentication_exception'Response:{'type':'claim.bundle.authentication_exception','content':'Invalidauthenticationtoken'}If token authentication is used and invalid token was provided by client this payload
is sent and connection is closed immediately.'claim.bundle.authentication_exception'Response:{'type':'claim.bundle.evaluation_exception','content':<error_message>,'index':<bundle_id>}If any exceptions occurred during the evaluation exception message is returned to client.Reports (template can be overloaded via report.ReportDefinition)NoneGraphQL QueriesNoneGraphQL Mutations - each mutation emits default signals and return standard error lists (cfr. openimis-be-core_py)NoneConfiguration options (can be changed via core.ModuleConfiguration)authentication: list of allowed tokens, when new connection is established client have
to send token in auth-token header, if authentication is empty list then all connection
request are allowed. Empty by default.claim_response_url: url used in FHIR response as resource 'fullUrl' prefix,claim_response_organization: organization used in FHIR response, by default 'openIMIS-Claim-AI',date_format: date format used in FHIR response, by default YYYY-mm-ddopenIMIS Modules DependenciesThe module is independent of the others.