Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Plantumlcloud
filenameopenIMIS-AI-Modules-Deployment.png
data%40startuml%0A%0Adatabase%20openIMISDB%0A%0Anode%20openIMISImplementation%20as%20%22openIMIS%20Implementation%22%20%7B%0A%0Acomponent%20ClaimModule%20as%20%22Claim%20Module%22%0Acomponent%20ClaimAIQualityModule%20as%20%22Claim%20AI%20Quality%20Module%22%0Acomponent%20FHIRR4Module%20as%20%22FHIR%20R4%20Module%22%0A%0A'openIMISImplementation%20%2B--%20ClaimModule%0A'openIMISImplementation%20%2B--%20ClaimAIQualityModule%20%0A'openIMISImplementation%20%2B--%20FHIRR4Module%20%0A%0AFHIRR4Module%20-%5Bdashed%5D-%3E%20ClaimModule%3A%20%3C%3Cuse%3E%3E%0AClaimAIQualityModule%20-%5Bdashed%5D-%3E%20FHIRR4Module%20%3A%20%3C%3Cuse%3E%3E%0AClaimAIQualityModule%20--%5E%20ClaimModule%0A%0A%7D%0A%0AopenIMISImplementation%20-%5Bdashed%5D-%3E%20openIMISDB%3A%20%3C%3Cuse%3E%3E%0A%0Anode%20openIMISClaimAIImplementation%20as%20%22openIMIS%20Claim-AI%20Implementation%22%20%7B%0A%0Acomponent%20ClaimAIModule%20as%20%22Claim-AI%20Module%22%0Aartifact%20ClaimAIModel%20as%20%22Claim-AI%20Model%22%0AClaimAIModule%20-%5Bdashed%5D-%3E%20ClaimAIModel%3A%20%3C%3Cuse%3E%3E%0A%0A%7D%0A%0A%0AClaimAIModule%20-0)-%20ClaimAIQualityModule%3A%20FHIR%20Claim%0AClaimAIModule%20-(0-%20ClaimAIQualityModule%3A%20FHIR%20ClaimResponse%0A%0A'openIMISImplementation%20-%5Bdashed%5D-%3E%20openIMISClaimAIImplementation%20%3A%20%3C%3Cuse%3E%3E%0A%0Anode%20ClaimAITraining%20as%20%22openIMIS%20Claim-AI%20Training%22%20%7B%0A%0Acomponent%20ClaimAIAlgorithm%20as%20%22Claim-AI%20ML%20Algorithm%22%0AClaimAIAlgorithm%20-%5Bdashed%5D-%3E%20ClaimAIModel%3A%20%3C%3Cgenerates%3E%3E%0AClaimAIAlgorithm%20-%5Bdashed%5D-%3E%20openIMISDB%3A%20%3C%3Cuse%3E%3E%0A%0A%7D%0A%0A%40enduml
width
revision1

Testing

Testing the WebSocket from JavaScript console

The following JavaScript code could be executed from your browser developer tools console.

Code Block
languagejs
var msg = {
    type: "claim.bundle.payload",
    content: `{
    "resourceType": "Bundle",
    "entry": [
        {
            "fullUrl": "http://127.0.0.1:8001/api_fhir_r4/Claim/FCD34CB1-2630-4E21-88EE-C38521C09F0D",
            "resource": {
                "resourceType": "Claim",
                "billablePeriod": {
                    "end": "2016-05-16",
                    "start": "2016-05-16"
                },
                "created": "2016-05-16",
                "diagnosis": [
                    {
                        "diagnosisReference": {
                            "identifier": 5367,
                            "reference": "Condition/5367",
                            "type": "Condition"
                        },
                        "sequence": 1,
                        "type": [
                            {
                                "coding": [
                                    {
                                        "code": "icd_0"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "enterer": {
                    "identifier": {
                        "type": {
                            "coding": [
                                {
                                    "code": "UUID"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "73371CFC-9C4D-4F71-B64E-6C858E0B9876"
                    },
                    "reference": "Practitioner/73371CFC-9C4D-4F71-B64E-6C858E0B9876",
                    "type": "Practitioner"
                },
                "facility": {
                    "identifier": {
                        "type": {
                            "coding": [
                                {
                                    "code": "UUID"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "36ECB0DB-E942-4A2D-A0C5-33ED4D00419D"
                    },
                    "reference": "P7101752/36ECB0DB-E942-4A2D-A0C5-33ED4D00419D",
                    "type": "P7101752"
                },
                "id": "FCD34CB1-2630-4E21-88EE-C38521C09F0D",
                "identifier": [
                    {
                        "type": {
                            "coding": [
                                {
                                    "code": "UUID"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "FCD34CB1-2630-4E21-88EE-C38521C09F0D"
                    },
                    {
                        "type": {
                            "coding": [
                                {
                                    "code": "MR"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "601"
                    }
                ],
                "insurance": [
                    {
                        "coverage": {
                            "identifier": {
                                "type": {
                                    "coding": [
                                        {
                                            "code": "UUID"
                                        }
                                    ]
                                },
                                "use": "usual",
                                "value": "8B18153E-2A42-4AEA-85B8-8603E89928B8"
                            },
                            "reference": "Coverage/8B18153E-2A42-4AEA-85B8-8603E89928B8",
                            "type": "Coverage"
                        },
                        "focal": true,
                        "sequence": 0
                    }
                ],
                "item": [
                    {
                        "category": {
                            "text": "service"
                        },
                        "extension": [
                            {
                                "url": "ActivityDefinition",
                                "valueReference": {
                                    "identifier": {
                                        "type": {
                                            "coding": [
                                                {
                                                    "code": "UUID"
                                                }
                                            ]
                                        },
                                        "use": "usual",
                                        "value": "5b9e5be3-6da1-40eb-b4a0-6588122e5f53"
                                    },
                                    "reference": "ActivityDefinition/5b9e5be3-6da1-40eb-b4a0-6588122e5f53",
                                    "type": "ActivityDefinition"
                                }
                            }
                        ],
                        "productOrService": {
                            "text": "OPD 1"
                        },
                        "quantity": {
                            "value": 1.0
                        },
                        "sequence": 1,
                        "unitPrice": {
                            "currency": "$",
                            "value": 80.0
                        }
                    }
                ],
                "patient": {
                    "identifier": {
                        "type": {
                            "coding": [
                                {
                                    "code": "UUID"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "39418469-FC67-4363-BB51-B59B19FDBB47"
                    },
                    "reference": "92260E4F/39418469-FC67-4363-BB51-B59B19FDBB47",
                    "type": "92260E4F"
                },
                "priority": {
                    "coding": [
                        {
                            "code": "normal"
                        }
                    ]
                },
                "provider": {
                    "identifier": {
                        "type": {
                            "coding": [
                                {
                                    "code": "UUID"
                                }
                            ]
                        },
                        "use": "usual",
                        "value": "73371CFC-9C4D-4F71-B64E-6C858E0B9876"
                    },
                    "reference": "PractitionerRole/73371CFC-9C4D-4F71-B64E-6C858E0B9876",
                    "type": "PractitionerRole"
                },
                "status": "active",
                "total": {
                    "currency": "$",
                    "value": 80.0
                },
                "type": {
                    "text": "O"
                },
                "use": "claim"
            }
        }        
    ],
    "total": 531900,
    "type": "searchset"
  }`
};
  
const ENCODING = 'utf-8';
var ws = new WebSocket('ws://localhost:8001/claim_ai/ws/Claim/process1/');

ws.binaryType = 'arraybuffer';
ws.onmessage = event => {
  let str = '';
  if (typeof event.data === "string") {
    str = event.data;
  } else {
    str = new TextDecoder(ENCODING).decode(event.data);
  }
  let json = JSON.parse(str);
  console.log('received', json);
};
ws.onopen = () => {
  let json = msg,
    str = JSON.stringify(json);
  console.log('sent',json);
  ws.send(new TextEncoder(ENCODING).encode(str));
}