1 Introduction

Today’s lifestyle has forced the people to emphasize the importance of time over health and with the current pace of advancement in technologies; this change of priorities has been supported and made it possible to live with. m-health refers to the monitoring of medical data of users using mobile devices in medical healthcare systems. With the advent of new sensors and advancement in IoT we are able to create a much more efficient system which can help regular monitoring of one’s body vitals. The response in case of emergency medical situations can be made a lot more efficient if the doctors and staff know the patient’s medical history as well as can track the live status of the patient’s vitals en-route hospital. These small can contribute to a faster, efficient, and hence a better medical facility. In today’s fast running world there also has been a slow revolution in m-healthcare systems and lead to the term 4G healthcare systems which use 4G networks in mobile technologies so that the data can be sent, stored, and analyzed ubiquitously and efficiently.

All IoT systems are composed of some elementary processes such as—data collection, data storing, data analysis, and action based on the analysis. The components used for the implementation of these processes are sensors for data collection, any cloud-based server such as firebase to store data, an algorithm to analyze data in context to the application like machine learning or deep learning models, and hence the decision making based on the result of the analysis.

In the proposed system, we are collecting data in the ambulances using sensors such as temperature, pulse, etc. sensors and sensing them to firebase using a python library like Firebase and pyserial. We also provide the facility of the green corridor for ambulances with WiFi technology using NodeMCU. We make sure as soon as the ambulance connects to the traffic signal it turns green and create a congestion less passage for the ambulance as traffic can create havoc in medical situations.

Another major issue we recognized in the emergency medical situations handling is the lack of beds and attending staff in the hospitals. So, based on the history of ambulance calling due to emergency situations, we aim to provide the hospitals with an approximation of the frequency of ambulance calls in the next 15 days and the weekly average of ambulance calls for the next 15 weeks so as to help them for the situations in advance by using time series analysis. We do so by using the SARIMAX model, RNN, and LSTM to predict and analyze the frequencies. The paper is structured with the following sections, Sect. 2 is literature survey, Sect. 3 proposed method, Sect. 4 is implementation, Sect. 5 is results and discussion, Sect. 6 is case-study and Sect. 7 is conclusion.

2 Literature Survey

2.1 A Wireless Biomedical Signal Interface System-on-Chip for Body Sensor Networks

In this paper, the author presents the concept of “m-healthcare” coined in 2004 which is for providing distance medical facilities and shows the key advances in remote healthcare and e-healthcare systems. To take the concept further with more efficient technologies the author proposes the term “4G health”. This concept will bring put the true essence of wireless communication with mobile broadband and fast internet access healthcare services. They also put forward the possible challenges that may be faced like Globalization, development of the best applicable 4G healthcare ecosystem, future mobile technologies and networks and security [1].

2.2 Guest Editorial Introduction to the Special Section: 4G Health—The Long-Term Evolution of m-health

In this paper, the author tries to propose artificial neural networks as a method to combine forecasts non-linearly. Proved by comparing the performances of three individual non-linear forecasting methods (ARIMA, Brown, Trend) and two linear combination methods (EW, MV). Using these, the paper shows a comparative study between these methods by using IBM dataset to train the models. Results clearly show that the proposed performs best and reason being the ability to capture non-linearity in forecasting [2].

2.3 Usage of DDS Data-Centric Middleware for Remote Monitoring and Control Laboratories

In recent years, there has been a demand to combine the sensor system into a small factor. With the recent development in technologies like ubiquitous computing, biosensor technology, wireless technology and system-on-chip design, with the integration of body sensor networks (BSN), these innovations become capable in analysing, healthcare diagnosis, etc. A wireless biomedical sensor interface system-on-chip (SOC) was developed that combines various functionalities of BSN in a single module. A fully customized mixed signal silicon-chip was designed for a biosensor framework with up to eight pH and temperature information channels conveying through an encoded remote interface to a remote base station. The framework includes simple sensor interface circuit, information change circuits, a microcontroller, an information encoder, and a recurrence move keying (FSK) RF transmitter. A large number of the framework squares were imported in a licensed innovation (IP) square structure; in this manner, the plan speaks to the initial moves toward a conventional BSN-on-chip [3].

2.4 Improving the Accuracy of Nonlinear Combined Forecasting Using Neural Networks

With the increasing development in IT sector, there has been a demand of distance learning. Distance learning is becoming increasingly popular from last few decades and information and communication technologies play a major role. Different types of technologies have been developed enabling the student to communicate with the lab settings through web-based communication and use of tools that provide user-friendly means. Client server technologies and middleware technologies and multi-tier enterprise architectures have enabled to perform tasks in a remote server using web browsers and also monitor the software maintenance. There has been a recent development in technology for master thesis students in remote research facility arrangement where the accentuation is set on the empowering correspondence center product innovations and how they have made conceivable the incomplete organization of the displayed instructive experience. The setting contains simple to utilize middleware advances and graphical imitating of genuine settings that have demonstrated to propel the understudy learning experience [4].

2.5 Internet of Things in industries: A Survey

There is a high demand for ubiquitous health care services due to profound increase in health conscious society we live in. Most of us have the luxury to buy sensors that could help us diagnose a disease on its on-set. In this paper they have proposed a effective yet service oriented way to handle the data using a six layer deployment architecture. Along with they have suggested a message queue cloud engine and a cloud storage formed on open source components. They have published/subscribe to plug in their algorithm as well. My inference of the system architecture is that they aim for higher concurrent transactions and shorter response time. They have used NoSQL to store a large number of semi structured and unstructured data. The plan is to execute front end on mobile as well as TV [5].

2.6 Toward Ubiquitous Healthcare Services With a Novel Efficient Cloud Platform

IoT has various devices for distinguishing proof, preparing, and correspondence and systems administration capacities. Specifically, sensors furthermore, actuators are becoming ground-breaking, more inexpensive. Businesses have a zeal for creating modern applications suing IoT, for example, robotized observer, control, the board. Because of the fast progress in innovation, IoT is expected to be broadly connected to businesses. For instance, the nourishment business is using WSN and RFID to construct mechanized frameworks for monitoring nourishment quality along with the sustenance store network so as to improve nourishment quality. This paper surveys the ongoing inquiries about IoT from the mechanical perspective. We present the foundation and SOA models of IoT and afterward discuss about the technologies used in IoT. We also present some important mechanical utilizations of IoT. A while later, we investigated the research difficulties and future patterns related to IoT. Not quite the same as other IoT review papers, the fundamental commitment of this audit paper is that it centers around modern IoT applications also, features the difficulties and conceivable research openings for future modern analysts [6].

Survey Table

A comparison between different methods that could be used for the analysis and prediction of ambulance frequency

Methods

RMSE

Trend

Seasonality

Non-linear relationship

Weekly

Daily

ARIMA

23.42

28.56

Yes

No

No

SARIMA

21.05

26.65

Yes

Yes

No

SARIMAX

9.35

25.32

Yes

No

No

RNN (LSTM)

(Not used because the data is stationary)

24.26

Yes

Yes

Yes

3 Procedures for Proposed Method with an Algorithm

Figure 1 shows how the process will take place as soon as the ambulance is in the range of the traffic signal it will get connected to the signal via a closed internet network we achieve this by using wifi modules in our project, as soon as the signal is received the traffic signal will communicate with the next traffic signal to turn itself green and it will turn itself green which will create a green corridor in between which will reduce the congestion caused due to traffic and create a green corridor for ambulance,and we have proposed a efficient way to send data from the ambulance to the hospital via internet.

Fig. 1
figure 1

Flowchart of hardware prototype

3.1 Algorithm

The algorithms used in this project are SARIMAX Model for weekly analysis and prediction of the ambulance frequency and the Recurrent Neural Network (LSTM) model for daily analysis.

3.1.1 Dataset for Model

For the analysis, we took the dataset from the internet. This dataset contains 44 columns out of which we use the column ‘RESPONSE DATE’, we calculate the frequency of each date occurring in that column so that we get the frequency of ambulance responses on a particular day.

Using this frequency, we form a separate csv file where date is the index column and frequency is another column. Final dataset is as shown in Fig. 2.

Fig. 2
figure 2

Dataset sample

3.1.2 Model Building

For analysis, we have two methods, which are daily prediction and weekly average prediction. The following pseudocode is the general steps as followed for both the analysis.

  • INPUT: CSV file containing data

  • ALGORITHM:

  • train, test ← splitting_data(data)

  • scaler ← scaling_data(train, test)

  • plot(seasonal_decompose)

  • batch ← sequence_generator(train)

  • model ← model_building(sequential)

  • model.fit

  • model.predict(test)

  • rmse(predicted, frequency)

  • OUTPUT: plot(predicted, frequency)

For weekly analysis, we form a list using rolling mean of window size seven, for time series analysis it is essential to know whether the data is stationary or non-stationary. For this purpose we use Augmented Dickey-Fuller test, it tests for stationary mean over time. Through this test we know that the weekly average list is stationary in nature. The results obtained are shown in Fig. 3.

Fig. 3
figure 3

Augmented dicky fuller test for weekly analysis

To decide on the model used for analysis we import ‘auto_arima’ library. As for the arguments in this library’s function we give seasonal as true and seasonal differencing parameter as 52 because we are analysing weekly. As a result, we get the order ‘SARIMAX (0, 1, 1) × (0, 0, 1, 52)’, this basically compares all the possible orders and gives the order with optimum AIC and BIC values which suggests the perfect balance between efficiency and resource usage. To finalise the model we check the seasonality and trend of the data by using seasonal decompose.

Figure 4 clearly shows both the components and hence we can rely on using the SARIMAX model. Then we split the dataset in ratio 80:20 for training and testing respectively. Then we fit, train the data and build a model which is used to make predictions on test set values. Based on those predicted values and true values present in the dataset, we calculate the RMSE (root mean squared error) to know the error in the predictions made by our model which comes out to be 9.35. Figure 5 represents the above process.

Fig. 4
figure 4

Seasonal decomposition of the dataset for weekly analysis

Fig. 5
figure 5

Flowchart for weekly average analysis

For daily analysis, we divide the dataset into 80:20 ratio as train and test data respectively. As we are using RNN and LSTM for it, we need to scale the values between two numbers, so we use ‘MinMaxScaler’ which scales all the values between 0 and 1. In RNN, we take certain points and predict next certain points, learn from the error made, again predict next points and this process takes place till all the data points are used and gradually the error decreases. To create the batches of these points we need to know the seasonal length which we do by plotting seasonal decompose.

By the results exhibited in Fig. 6, we know that the data is seasonal for every fifteen days, so we use ‘TimeSeriesGenerator’ to create sequences pof batch size fifteen for training purposes. We also use LSTM (Long Short Term Memory) with ReLU (Rectified Linear Unit) as the activation function because there are no negative values present, we use 250 LSTM’s and one dense layer as we need only one attribute output. We fit, train the data and build the model by running two hundred epochs, which suggests that the model goes over the data two hundred times and reduce the error. Then with the model we predict on the test set and compute RMSE using them.

Fig. 6
figure 6

Seasonal decomposition for daily analysis

For better understanding, we visualize the test values and predicted values as a line graph in both the analysis. Figure 7 represents the above procedure.

Fig. 7
figure 7

Flowchart for daily frequency analysis

4 Implementation

Our project has the following modules:

  1. 1.

    In a critical situation even seconds mean a lot hence we to create a green corridor for the ambulance as it could pass the signals without any traffic congestion. We do so by connecting the ambulance and the traffic signals. As soon as the traffic signal detects the ambulance all the signals in the way will turn green accordingly so that we could save time which in turn will save lives. We do this using Wi-Fi modules(wifi server and clients)

  2. 2.

    As an add on, we send essential data between the ambulance and the hospital so that staff in the hospital may prepare in advance. We plan on sending data like pulse rate, blood group (if possible), age, previous medical history, etc. via the wifi we are connected to. We do so by using NodeMCU and use firebase for data storage and analysis.

  3. 3.

    The third module is connecting the hardware to cloud for data storage. We use firebase for cloud storage and in the realtime database of firebase we store the timestamp at which the ambulance passes from a signal. Also, the patient information and other sensor data is stored in the firebase and visualized using thing speak.

  4. 4.

    The last part is the analysis of the dataset which contains daily frequency of the ambulance. The weekly analysis is done using the Seasonal Autoregressive Integrated Moving Average (SARIMA) model and the daily analysis is done using Recurrent Neural Network (LSTM) model. Using these models, we predict the frequency of ambulances for the next few days so that the hospitals and concerned authorities can make arrangements accordingly (Fig. 8).

    Fig. 8
    figure 8

    Visualizing sensor data in ThingSpeak

The circuit works as follows:

We are using a technique to reduce time delay caused in the commute of an ambulance. We are connecting two NodeMCUs 1.0. As soon as they are in range they connect with each other and produce a cue to the signal that an ambulance is coming which in turn makes the subsequent signal ahead in path green which causes a green corridor.

We have even implemented a http connection between thingspeak and our NodeMCU to send relay sensor data. So that the essential things such as heart rate blood group and other valuable information can be known prior and could save ample of time (Fig. 9).

Fig. 9
figure 9

Circuit of the model

5 Result and Discussion

Graph in Fig. 10 is plotted frequency versus dates and represents the analysis and prediction of weekly averages. The orange line represents the model predictions on a test set using the SARIMAX model, blue is the actual frequency and green is the prediction in the future for 15 weeks.

Fig. 10
figure 10

Graphical visualization of weekly results

Graph in Fig. 11 is plotted frequency versus dates and represents the daily analysis and prediction using RNN and LSTM. In this the blue line represents the actual frequencies and orange represents the prediction using the model on the test set which comprises 20% data of the dataset.

Fig. 11
figure 11

Graphical visualization of daily results

6 Case Studies

6.1 Design and Implementation of a Wearable Sensor Network System for IoT-Connected Safety and Health Applications

In this paper they present wearable body sensor network device to monitor physiological and environmental changes, and the devices can communicate with each other and are able to transmit the data to a gateway via a LoRa network which forms a heterogeneous IoT platform with Bluetooth devices as soon as danger in the environment is detected the sensor will notify the server and cloud. This paper has suggested to usually use this device in industrial workplaces where people usually work in harsh environments. In outdoor environments such UV ray high pollution carbon monoxide levels etc. In this paper they present a heterogeneous wearable IoT device for connected safety and health applications.

In hardware implementation they have presented the block diagram of a safe node which consists of one mcu a LoRa module and a few sensors. It is powered by a battery. The LoRa module used is rm96 from hoperf electronics. Four environmental sensors are used to rally the data.

Second they have explained the implementation of health node in which they have use an mcu and two physiological sensors such as body sensors and a temperature sensor and the software implementation is based on LoRa network. Each safe node is able to communicate with each other using LoRa networks, the data is encrypted as well as point to point for cloud implementation they hosted it in Digital ocean, they have data analysis on different sensors as well and plotted it. The sensors performance for measured. The safe node is attached to the helmet and the safe node was attached to the chest [7].

6.2 Health Monitoring Systems Using IoT and Raspberry Pi: A Review

Doctors are one of the busiest individuals on the planet right now due to ever increasing medical problems due to the unhealthy lifestyle one chooses to live in. In today’s world cardiac arrest are very prominent due to lack of healthy lifestyle. In this paper they have proposed a subtle yet simple method to monitor vitals of patients through 2G/3G/4G GSM technologies. Also in case of emergency the doctors are informed using a web page.

In this paper they have discussed the difficulties and fatalities caused due to inefficiency in the healthcare system for example like non availability of doctors and non-availability of ambulances in remote areas. They also brushed on the topic of damage of data along transmission. Hence they have proposed a remote health monitoring system controlled by raspberry Pi. In this project they have created a model which continuously collects the vitals and signal of the patients such as heart rate, blood pressure and body temperature. In this project it is stored in a cloud model and displayed on an online website. as soon there is an emergency the doctors can be alerted as soon as possible. They even say that their idea may not be very new but they aim to make the working buy introducing this model. They store the data in MySQL. They have used a temperature sensor LM35, a heartbeat sensor and a blood pressure sensor.

They connect it to a raspberry pie and with the help of a gsm module they have got gprs connection. In the end conclude that they have achieved a remote monitoring system of various health parameters. They wish to advance their project by adding AI systems to help doctors and patients out [8].

7 Conclusion

Thus, we can conclude that by using the above model a free route will be provided to the ambulance so the patient gets medical aid as soon as possible. Also, the live medical data of the patient is sent to the hospital via sensors and cloud so that doctors can monitor the patient’s condition and prepare accordingly for the treatment. Also, by the analysis of the ambulance frequency we are able to predict the number of ambulances that would be required for the next few days so that prior arrangement can be made by the concerned authorities and the patient gets help on time.

We wish to integrate our project in future with google map API in which we wish to obtain optimised results using A-Star algorithm. It is an algorithm which considers heusterics along with it, which makes it cost as well time efficient for our model.

As future self-driving cars are much in demand these days our model can be easily integrated with ambulances which could help make a self-driving ambulance which will make this model the best in class ambulance ever because machines can achieve high accuracy and margin for error will be less which will subsequently decrease the time to reach the hospitals. We can use R-CNN, yolo to achieve self-driving cars.