---
title: Verifying the demo
weight: 20
aliases: /medical-diagnosis/demo/
---

:toc:
:imagesdir: /images
:_content-type: REFERENCE
include::modules/comm-attributes.adoc[]

[id="demo-intro"]

== Introduction
The medical diagnosis pattern integrates multiple Red Hat and Open Source technologies together to create an AI/ML workflow that is able to identify signs of pneumonia in x-ray images. Within this demo a dashboard is automatically created that provides the CPU and Memory metrics for the pod running the risk assessment application. The dashboard also provides visual representation of the AI/ML workflow from the images being generated at the remote medical facility to running through the image anonymizer, it also includes the image being scanned along with statistics from the workflow - indicating the probability in which a patient may or may not have pneumonia. 

image::../../images/medical-edge/aiml_pipeline.png[link="/images/medical-edge/aiml_pipeline.png"]


[NOTE]
====
We simulate the function of the remote medical facility with an application called the `image-generator`.
====
//Module to be included
//:_content-type: PROCEDURE
//:imagesdir: ../../../images
[id="viewing-the-grafana-based-dashboard-getting-started"]
== Enabling the Grafana based dashboard

The Grafana dashboard offers a visual representation of the AI/ML workflow, including CPU and memory metrics for the pod running the risk assessment application. Additionally, it displays a graphical overview of the AI/ML workflow, illustrating the images being generated at the remote medical facility. 

This showcase application is deployed with self-signed certificates, which are considered untrusted by most browsers. If valid certificates have not been provisioned for your OpenShift cluster, you will need to manually accept the untrusted certificates using the process below.

. Accept the SSL certificates on the browser for the dashboard. In the {ocp} web console,  go to the *Networking* > *Routes* for *All Projects*. Click the URL for the `s3-rgw`.
+
image::../../images/medical-edge/storage-route.png[s3-rgw route]
+
Ensure that you see XML and not the access denied error message.
+
image::../../images/medical-edge/storage-rgw-route.png[link="/images/medical-edge/storage-rgw-route.png"]

This showcase application does not have access to a x-ray machine hanging around that we can use for this demo, so one is emulated by creating an S3 bucket and hosting the x-ray images within it. In the "real world" an x-ray would be taken at an edge medical facility and then uploaded to an OpenShift Data Foundations (ODF) S3 compatible bucket in the Core Hospital, triggering the AI/ML workflow.

To emulate the edge medical facility we use an application called `image-generator` which when scaled up will download the x-rays from S3 and put them in an ODF S3 bucket in the cluster, triggering the AI/ML workflow. 

Turn on the image file flow. There are couple of ways to go about this.

. Go to the {ocp} web console and change the view from *Administrator* to *Developer* and select *Topology*. From there select the `xraylab-1` project.

. Right-click on the `image-generator` pod icon and select `Edit Pod count`.

. Up the pod count from `0` to `1` and save.

Alternatively, you can have the same outcome on the Administrator console.

. Go to the {ocp} web console under *Workloads*, select *Deployments* for the *Project* `xraylab-1`.

. Click `image-generator` and increase the pod count to 1.

[id="demo-dashboard"]

== Viewing the Grafana dashboard

Access the Grafana dashboard to view the AI/ML workflow. Carry out the following steps:

. In the {ocp} web console, select the nines menu and right click the *Grafana* icon.

. Within the grafana dashboard click the Dashboards icon. 

. Select the `xraylab-1` folder and the XRay Lab menu item.

image::../../images/medical-edge/dashboard.png[link="/images/medical-edge/dashboard.png"]

In the dashboard on the right we see the images that have been uploaded, processed and anonymized. Images in the processed view have been through the AI/ML pipeline and images in the lower third are images that have been stripped of Personally Identifiable Information or PII.

In the lower middle section of the dashboard we can see the distribution of images that are normal, unsure or pneumonia has been detected.  We can also see the number of risk assessment containers running as well as the cpu and memory metrics for the pods.

[id="summary"]

== Summary

You did it! You have completed the deployment of the medical diagnosis pattern! Hopefully you are getting ideas of how you can take advantage of our GitOps framework to deploy and manage your applications. 

The medical diagnosis pattern is more than just the identification and detection of pneumonia in x-ray images. It is an object detection and classification model built on top of Red Hat OpenShift and can be transformed to fit multiple use-cases within the object classification paradigm. Similar use-cases would be detecting contraband items in the Postal Service or even in luggage in an airport baggage scanner.

For more information about Validated Patterns, visit our link:https://validatedpatterns.io/[website]. 
