My Journey into the World of Codes

After years of being afraid, I finally resolved to face my fears; my fears of understanding and writing codes that held me back from exploring the world of codes. The designs and alignment of the…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




High Volume Prediction at Hospital Clinics

Recently one of my customers came up with an idea. He wanted to build an advanced Analytics and AI solution that measures and predicts high load at hospitals clinics. The motivation was to decrease clinic queues length and total patient waiting time. The clinic operation-manager will be able to respond early enough to prevent or decrease high load situations by taking data driven decisions for better human resource allocation & utilization in real time.

[For example: the system can recommend in advance to reinforce sub-department#2 by switching two nurses, one doctor and one secretary from sub-department#3 two hours before high load is occurring and by so to actually prevent very long waiting time for sub-department#2's patients.]

PAIN/PROBLEM DEFINITION + POTENTIAL FEATURES:

Many hospital clinics are experiencing unexpected heavy patients loads. There are often situations where patients are experiencing long waiting time, while some of the personnel are idle.
In many cases reallocation is taking place too late. After several days of investigation by staying inside the clinics we considered and pointed out the following reasons:

To sum it up , we concluded these are the major unexpected and indeterministic factors that are making the pre-planning process and ad-hoc realtime response so challenging for the clinic operation manager and we thought we can start and validate these features as candidates for our machine learning model.

PROPOSED SOLUTION:
Realtime visualization system with high volume prediction (60–120 minutes before occurrence) with advanced analytics tracking of highly significant measurements.

HIGH VOLUME DEFINITION SUGGESTION:
We can-not escape from it. We must clarify what high load means, so let’s:

Now we can mark our prediction results as p(n, pt, st, wt)

For example: p(n, 120, ‘ref2’, 0) is the predicted number of waiting patients for ‘reference-2’ waiting list, 120 minutes from now, that are expected to wait at least 0 minutes. (which means all waiting patients at that point of time)

Please note: we didn’t define ’n’ yet as this parameter will be a composition of our realtime features vectors list and this will be discovered only after data exploration and data preparation phases.

Now, if at least one of the followings is true we will mark this prediction as high load:

PROOF OF CONCEPT:
We selected one of the clinics we inspected, then took the following steps:

2. Data Exploration.

3. Data Prep and Feature Engineering.

5. DeployML — Regression Model Deployment.

6. Visualization — Streaming datasets visualization in realtime including ML results.

Our customer have applications hosted on on-premise environments. For the first step we wanted to replicate the data to their azure subscription, continuously.

The second step was to stream the data into a visualize dataset in (near) realtime. We provisioned Recurrence Logic App that query the data and stream it into EventHub.

clinic loads heat-map

Now we have ingested and explored the data. The next thing we can do is Feature Engineering.

Feature Engineering is basically a technique for finding Feature or Data from the currently available data. There are several ways to do this technique. More often, it is simply a matter of common sense.

At this stage we thought to divide the working hours in each day (Sunday — Friday) to 15 minutes buckets, where we mark in each bucket 0 or 1 to indicate that the patient is waiting.

actual checkin-checkout joined by patients metadata

Next thing was to group by date column and aggregate by summing up each bucket.

data divided to 15 minutes buckets

Now, we would like to add into each bucket a vector with patient “demographics” data, such as: Sex, Age, Duration of stay, previous diagnostics, previous admission days, etc .

adding the vectors for each feature

Now again group by date and sum up all these vectors.

At this point I wanted to FlatMap each vector within a bucket so each column will be divided into 8 columns (one for each cell in the vector). After the separation we need to rearrange the columns to organize the features f1,.., fn with the relevant label.

generate regression models list ordered by performance

Azure ML Studio:

In this step I uploaded the prepared dataset to azure ml studio and with not so much effort I created the experiment and ran it.

predictions results versus reality results (label)

After the ML deployment was done, we combined the online data with the predicted data into a single sql view with another LogicApp, then had the view streamed as a streaming data set into the previously mentioned flow.
(LogicApp => EventHub => Stream Analytics => PowerBI)

60 and 120 minutes forward predications results flow

Another thing worse mentioning is that we had built with the customer another view that holds the last eight snapshots of the required parameters. each row for each 15 minutes bucket.

Realtime dashboard plus predicted results

Open Weather is quite simple and you can get 60 calls per minutes with no charge.

Full Source code:
Databricks notebook source code can be found here.

Avi Paz,
Cloud Solution Architect — Data & AI
Avi.Paz@microsoft.com

Add a comment

Related posts:

Grandma

Could death be a happy ending?. “Grandma” is published by Yash Joshi in Literally Literary.

MINING INFRASTRUCTURE BY FACITE FOUNDATION

The construction of a new mining area initiated by the Facite Foundation is a form of effort to renew mining land in previous countries which has been less effective. Apart from considering the very…

Retail Investor Challenges

Investments for any county, company or individual is bases for their growth. Without investment, they can’t attain the financial stimulus and stability they want most of the times. Individuals lack…