1. Home
  2. Sample Projects
  3. Patient Condition Detection

Patient Condition Detection

◷ Reading Time: 8 minutes

This example is about detecting the patient’s conditions. As the output, the doctor will receive an alert text message to the mobile phone. We have also used the Business Rules Mining capability of FlexRule as a part of this project.

Therefore, this example uses the Analytics Extension.

In order to receive text messages, we have used Twilio. You can create a trial account and use the account details to run the project.

We have also created a node server to simulate the GET requests from external APIs.

Project Setup

Set up Twilio account

If you don’t have an account already, you can sign up and get a trial account.

You will see your account details on the Twilio console.

Then update the values in Twilio Credentials.xml with those credentials.

  • ACCOUNT_SID: Twilio Account ID
  • AUTH_TOKEN: Twilio Auth token
  • TWILIO_PHONE_NUMBER: Phone number
  • MY_PHONE_NUMBER: The phone number you configured as the receiver’s number. Usually, this is your number.

Only for demo purposes we used this service. Therefore, you can use any other preferred messaging service.

Set up the server for REST services

This is an optional setup. You can still run the project with manual inputs if you don’t have a running server.

To set up the server, you should have Node.js installed on your machine. If not you can download and install it from this link.

You can open a command prompt and type node --version to see whether you have installed Node.js. If you have installed it successfully, you will see the version as follows.

Then to run the server,

  1. Navigate to the Patient Server folder in the command prompt. This is in your project folder.
    cd <your folder location>
  2. Then type node app.js and press enter.
  3. Now the service is running on http://localhost:3000.

Running the Sample

1. Open the file MainFlow.xml

2. Click on Logic Run Template.

3. Click on one of the given templates.

You can choose Manual input templates if you have not set up the server with the above instructions. If you have the server set up, you can also choose External sys input templates.

4. Click Debug.

5. Click Next Step to go step by step.

6. You will see the output under the Parameters window as well as receive a text message to the configured mobile number.

Video Tutorial

Process Steps

These are the process steps.

  1. Get patient test results from various laboratories
  2. Detect whether there is any condition
  3. Alert the doctor via SMS, if there is any condition

Project Description

The project contains several components that can be easily added or removed as necessary.

Generic Flows

  • MainFlow.xml: The main flow that connects the input, decision, and output.
  • Input Patient Data.xml: The flow that retrieves data from the given input source.

DRD

  • DRD.xml: The decision requirement diagram that decides whether the patient has a condition based on the test results. It also builds the text message to be sent to the doctor.

Glossaries and Concepts

  • BoxedExpressions.xml: Global Expressions used in the project.
  • BusinessTerms.xml: Global business terms used in the project.
  • Concept.xml: Patient concept file.
  • Twilio Credentials.xml: Twilio account credentials.

Patient Conditions

Currently, there are three conditions; Chronic Kidney Disease Possibility, Diabetes Possibility, Heart Attack Possibility. For each condition, there is a business term, a decision table, and a concept file.

.DecisionTable.xml and .InputOutput.Concept.xml files were created automatically by the business rule mining capability using the patient datasets.

  • <Condition>.BusinessTerms.xml: Terms in the tests of each condition
  • <Condition>.DecisionTable.xml: Decision tables of each condition
  • <Condition>.InputOutput.Concept.xml: Concept file of each condition
  • List Patient Conditions.xml: Determine the list of conditions and build the message to be sent to the doctor as a text message.

The Project Design

  • MainFlow.xml: The main flow connects the validation and the decisioning parts of the project.
    • Input patient test results (Input Patient Data.xml)
    • Determine conditions (DRD.xml)
    • Send a text message to the doctor with the patient’s conditions
  • Input Patient Data.xml: Depending on your input, this flow decides whether to get patient test results from the external sources (the server we set up in a previous step) or to continue with the manual input data.
  • DRD.xml: This decision resuirement diagram defines the decision hierarchy from different logic documents and make the final decision determining the patient conditions.
  • For each condition, there is a
    • Decision table (created by the business rule mining option): This determines whether the patient has a certain condition
    • Concept (created by the business rule mining option)
    • Business Term

Therefore, if there are more conditions in the future, you can easily add them to this folder.

We used three different datasets to build the above logic documents.

You can find them in the project folder/Dataset.

  • List Patient Conditions.xml: This decision table lists down the condition that the patient has and at the end creates the text message to be sent to the doctor.

DoctorsMessage = Create doctors message

  • BoxedExpressions.xml: It contains the expressions and values that can be reused across the project. For example, the formula Create doctors message which we used in the above decision table is defined here.

Download the project

Use the attachment at the end of the page to download the sample project.

Updated on July 21, 2021

Article Attachments

Was this article helpful?

Related Articles