\n",
diff --git a/UseCases/Knee_Replacement/Knee_Replacement_nPath_Python.ipynb b/UseCases/Knee_Replacement/Knee_Replacement_nPath_Python.ipynb
index ae7ea89a..11f281d0 100644
--- a/UseCases/Knee_Replacement/Knee_Replacement_nPath_Python.ipynb
+++ b/UseCases/Knee_Replacement/Knee_Replacement_nPath_Python.ipynb
@@ -11,39 +11,39 @@
"
\n",
" \n",
"\n",
- "
Introduction
\n",
+ "
Introduction
\n",
"\n",
- "
Pathing is the process of discovering a sequence of antecedent actions that occur prior to a specific event of interest on sessionized data. Pathing discovers the most salient patterns across a group of individuals or entities based on which further actions are considered. Pathing allows you to provide an explanation of the relation and the relative importance of each factor.
\n",
+ "
Pathing is the process of discovering a sequence of antecedent actions that occur prior to a specific event of interest on sessionized data. Pathing discovers the most salient patterns across a group of individuals or entities based on which further actions are considered. Pathing allows you to provide an explanation of the relation and the relative importance of each factor.
\n",
"\n",
- "
The nPath
function provides a flexible pattern-matching capability that lets you specify complex patterns in the input data and define the values that are output for each matched input set.
\n",
+ "
The nPath
function provides a flexible pattern-matching capability that lets you specify complex patterns in the input data and define the values that are output for each matched input set.
\n",
"\n",
"\n",
- "
Business Value
\n",
- "
Comprehensive health predictions and a reduced number of false positive and false negative results. \n",
- "
Reduced cost to patients and hospitals. \n",
- "
Identify patterns and symptoms leading to total knee replacements. \n",
- "
Provides an understanding of various touchpoints that lead to total Knee Replacement. \n",
+ "
Business Value
\n",
+ "
Comprehensive health predictions and a reduced number of false positive and false negative results. \n",
+ "
Reduced cost to patients and hospitals. \n",
+ "
Identify patterns and symptoms leading to total knee replacements. \n",
+ "
Provides an understanding of various touchpoints that lead to total Knee Replacement. \n",
"\n",
- "
Why Vantage?
\n",
+ "
Why Vantage?
\n",
"\n",
- "
With the advantages of Vantage and ClearScape Analytics, we bring key differentiating capabilities that set us apart from the current fragmented state many of our customers and prospects face. Analyzing behavior across multiple touchpoints poses many challenges. Data is disconnected, or when it is available, typically exists in vast quantities that make timely, accurate analysis impossible. If this analysis is available, it is typically only available inside of a closed, proprietary ecosystem.
\n",
- "
Fortunately, Vantage allows users to unlock the value in their various journeys by
\n",
- "
Accessing data across multiple, disconnected silos, and \n",
- "
Applying unique, massively-scalable analytics capabilities which allows organizations to understand a complete and accurate picture of the user journey. \n",
- "
With Vantage, these analytics can be run in real-time for any data volume or number of users – providing an accurate, timely view of overall user experience. And of course, Vantage and ClearScape Analytics allow for at-scale processing across all the digital interactions that make up these journeys.
\n",
- "
Furthermore, this analysis can be passed to additional ML and AI capabilities available in ClearScape Analytics, helping to develop more accurate and actionable predictive models.
\n",
+ "
With the advantages of Vantage and ClearScape Analytics, we bring key differentiating capabilities that set us apart from the current fragmented state many of our customers and prospects face. Analyzing behavior across multiple touchpoints poses many challenges. Data is disconnected, or when it is available, typically exists in vast quantities that make timely, accurate analysis impossible. If this analysis is available, it is typically only available inside of a closed, proprietary ecosystem.
\n",
+ "
Fortunately, Vantage allows users to unlock the value in their various journeys by
\n",
+ "
Accessing data across multiple, disconnected silos, and \n",
+ "
Applying unique, massively-scalable analytics capabilities which allows organizations to understand a complete and accurate picture of the user journey. \n",
+ "
With Vantage, these analytics can be run in real-time for any data volume or number of users – providing an accurate, timely view of overall user experience. And of course, Vantage and ClearScape Analytics allow for at-scale processing across all the digital interactions that make up these journeys.
\n",
+ "
Furthermore, this analysis can be passed to additional ML and AI capabilities available in ClearScape Analytics, helping to develop more accurate and actionable predictive models.
\n",
"\n",
"\n",
- "
The goal is to prepare data using Vantage in-database analytic functions, then to visualize them in Sankey charts in order to view care pathways leading to a total knee replacement.
\n",
+ "
The goal is to prepare data using Vantage in-database analytic functions, then to visualize them in Sankey charts in order to view care pathways leading to a total knee replacement.
\n",
"\n",
- "
The data used in this demonstration represents procedures for injuries to the knee.
\n",
- "
289,839 events for various members \n",
- "
51 states/territories \n",
- "
13 procedures \n",
- "
4 months \n",
+ "
The data used in this demonstration represents procedures for injuries to the knee.
\n",
+ "
289,839 events for various members \n",
+ "
51 states/territories \n",
+ "
13 procedures \n",
+ "
4 months \n",
"\n",
"\n",
- "
In this demo, we will leverage teradataml virtual dataframes with Vantage Analytic in-database functions - Sessionize() and nPath() - to create a Sankey visualization using open source package, Plotly.
\n",
+ "
In this demo, we will leverage teradataml virtual dataframes with Vantage Analytic in-database functions - Sessionize() and nPath() - to create a Sankey visualization using open source package, Plotly.
\n",
"\n",
""
]
@@ -54,15 +54,15 @@
"tags": []
},
"source": [
- "
\n",
- "
1. Connect to Vantage.
\n"
+ "
\n",
+ "
1. Connect to Vantage.
\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
In the section, we import the required libraries and set environment variables and environment paths (if required).
"
+ "
In the section, we import the required libraries and set environment variables and environment paths (if required).
"
]
},
{
@@ -81,7 +81,7 @@
"metadata": {},
"source": [
"
\n",
- "
Note: The above statements may need to be uncommented if you run the notebooks on a platform other than ClearScape Analytics Experience that does not have the libraries installed. If you uncomment those installs, be sure to restart the kernel after executing those lines to bring the installed libraries into memory. The simplest way to restart the Kernel is by typing zero zero: 0 0
\n",
+ "
Note: The above statements may need to be uncommented if you run the notebooks on a platform other than ClearScape Analytics Experience that does not have the libraries installed. If you uncomment those installs, be sure to restart the kernel after executing those lines to bring the installed libraries into memory. The simplest way to restart the Kernel is by typing zero zero: 0 0
\n",
"
"
]
},
@@ -115,7 +115,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
We will be prompted to provide the password. We will enter the password, press the Enter key, and then use the down arrow to go to the next cell. Begin running steps with Shift + Enter keys.
"
+ "
We will be prompted to provide the password. We will enter the password, press the Enter key, and then use the down arrow to go to the next cell. Begin running steps with Shift + Enter keys.
"
]
},
{
@@ -143,9 +143,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
2. Getting Data for This Demo
\n",
- "
We have provided data for this demo on cloud storage. We have the option of either running the demo using foreign tables to access the data without using any storage on our environment or downloading the data to local storage, which may yield somewhat faster execution. However, we need to consider available storage. There are two statements in the following cell, and one is commented out. We may switch which mode we choose by changing the comment string.
\n"
+ "
\n",
+ "
2. Getting Data for This Demo
\n",
+ "
We have provided data for this demo on cloud storage. We have the option of either running the demo using foreign tables to access the data without using any storage on our environment or downloading the data to local storage, which may yield somewhat faster execution. However, we need to consider available storage. There are two statements in the following cell, and one is commented out. We may switch which mode we choose by changing the comment string.
\n"
]
},
{
@@ -164,7 +164,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Optional step – We should execute the below step only if we want to see the status of databases/tables created and space used.
"
+ "
Optional step – We should execute the below step only if we want to see the status of databases/tables created and space used.
"
]
},
{
@@ -180,10 +180,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
3. Analyze the raw data set
\n",
+ "
\n",
+ "
3. Analyze the raw data set
\n",
"\n",
- "
Let us start by creating a \"Virtual DataFrame\" that points directly to the dataset in Vantage. We then begin our analysis by checking the shape of the DataFrame and examining the data types of all its columns.
\n",
+ "
Let us start by creating a \"Virtual DataFrame\" that points directly to the dataset in Vantage. We then begin our analysis by checking the shape of the DataFrame and examining the data types of all its columns.
\n",
"\n",
"\n"
]
@@ -202,26 +202,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
There are 10 columns mentioning the procedure code , diagnosis code and shortdesc which mentions the procedure to be conducted and the amount required for the procedure along with other personal details.
\n"
+ "
There are 10 columns mentioning the procedure code , diagnosis code and shortdesc which mentions the procedure to be conducted and the amount required for the procedure along with other personal details.
\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
4. Sessionize() Function
\n"
+ "
\n",
+ "
4. Sessionize() Function
\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
The Sessionize() Function in the Advanced SQL Engine (SQLE) was originally designed to capture a sequence of web clicks by one user that are separated by at most *n* seconds. However, we've also found it useful to define a sequence of events along a longitudinal record of a member's patient journey. In this case, we will define a session as one day.
\n",
+ "
The Sessionize() Function in the Advanced SQL Engine (SQLE) was originally designed to capture a sequence of web clicks by one user that are separated by at most *n* seconds. However, we've also found it useful to define a sequence of events along a longitudinal record of a member's patient journey. In this case, we will define a session as one day.
\n",
"\n",
- "
one day = 60 seconds x 60 minutes x 24 hours = 86,400 seconds
\n",
+ "
one day = 60 seconds x 60 minutes x 24 hours = 86,400 seconds
\n",
"\n",
- "
Here we rename the column shortdesc to procedure and then use Sessionize function on that data.
"
+ "
Here we rename the column shortdesc to procedure and then use Sessionize function on that data.
"
]
},
{
@@ -253,7 +253,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Note the SESSIONID column that is appended to the end.
"
+ "
Note the SESSIONID column that is appended to the end.
"
]
},
{
@@ -269,29 +269,29 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
The result is ordered sessions per member ID.
"
+ "
The result is ordered sessions per member ID.
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
5. nPath() Function
"
+ "
\n",
+ "
5. nPath() Function
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
More insight is gained when combining the events into a path, then further analyzing a population of paths - that is, more common paths, paths with desirable or undesirable outcomes.
"
+ "
More insight is gained when combining the events into a path, then further analyzing a population of paths - that is, more common paths, paths with desirable or undesirable outcomes.
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Now let us build a path on the sessionization results.
"
+ "
Now let us build a path on the sessionization results.
"
]
},
{
@@ -313,7 +313,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Create paths ending in Total Knee Replacement
"
+ "
Create paths ending in Total Knee Replacement
"
]
},
{
@@ -354,7 +354,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Create paths starting with Range of Motion Testing, has Physical Therapy NEC in the middle, and ends in Total Knee Replacement
"
+ "
Create paths starting with Range of Motion Testing, has Physical Therapy NEC in the middle, and ends in Total Knee Replacement
"
]
},
{
@@ -370,11 +370,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
6. Sankey Charts
\n",
- "
Sankey charts can help visualize pathways and volume of events on the most common paths. Teradata Vantage Cloud does have built-in visualizations, but if users don't have access to these capabilities, or perhaps there is a preference to work in Python, the Plotly package provides Sankey charting capabilities. Below the Python function reads output from nPath as pandas dataframe and plots Sankey chart. This method will be used throughout for plotting Sankey.
\n",
+ "
\n",
+ "
6. Sankey Charts
\n",
+ "
Sankey charts can help visualize pathways and volume of events on the most common paths. Teradata Vantage Cloud does have built-in visualizations, but if users don't have access to these capabilities, or perhaps there is a preference to work in Python, the Plotly package provides Sankey charting capabilities. Below the Python function reads output from nPath as pandas dataframe and plots Sankey chart. This method will be used throughout for plotting Sankey.
\n",
"\n",
- "
**Note: The code in the below cell is just the definition of the function created for Sankey charts, so will not show any chart. The function is used later in the notebook below wherever charts are needed
"
+ "
**Note: The code in the below cell is just the definition of the function created for Sankey charts, so will not show any chart. The function is used later in the notebook below wherever charts are needed
"
]
},
{
@@ -489,14 +489,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
The TOP 3 events that led to Total Knee Replacement are Knee Arthroscopy , Knee Joint Biopsy and Other Diagnostic Physical Therapy Procedure.
\n",
+ "
The TOP 3 events that led to Total Knee Replacement are Knee Arthroscopy , Knee Joint Biopsy and Other Diagnostic Physical Therapy Procedure.
\n",
"\n",
- "
To check the details of any path or node we can move the mouse pointer over it and check details. For example if you move the pointer over the path having the largest width at the right most path going towards the right most node(Total Knee Replacement) it shows 6, source: Knee Arthroscopy, target: Total Knee Replacement. It means there were 6 cases where Knee Arthroscopy led to recommendation of Total Knee Replacement.
\n",
+ "
To check the details of any path or node we can move the mouse pointer over it and check details. For example if you move the pointer over the path having the largest width at the right most path going towards the right most node(Total Knee Replacement) it shows 6, source: Knee Arthroscopy, target: Total Knee Replacement. It means there were 6 cases where Knee Arthroscopy led to recommendation of Total Knee Replacement.
\n",
"\n",
- "
When the pointer is moved over a Node, for example when the pointer is on the long Node at the right in the middle OTH Arthrotomy-Knee it shows incoming flow count: 2 and outgoing flow count: 3 which means that there are 2 different events which lead to OTH Arthrotomy-Knee after which the next 3 events are Knee Arthoroscopy, Knee Joint Biopsy and Other Diagnostic Physical. Similarly other nodes and paths can be analyzed.
\n",
+ "
When the pointer is moved over a Node, for example when the pointer is on the long Node at the right in the middle OTH Arthrotomy-Knee it shows incoming flow count: 2 and outgoing flow count: 3 which means that there are 2 different events which lead to OTH Arthrotomy-Knee after which the next 3 events are Knee Arthoroscopy, Knee Joint Biopsy and Other Diagnostic Physical. Similarly other nodes and paths can be analyzed.
\n",
"\n",
- "
Check paths that led to Knee Arthroscopy
\n",
- "
As seen in the above analysis ,Knee replacement was suggested most number of times after knee arthroscopy, so let's try to analyze what events led to Knee Arthroscopy
"
+ "
Check paths that led to Knee Arthroscopy
\n",
+ "
As seen in the above analysis ,Knee replacement was suggested most number of times after knee arthroscopy, so let's try to analyze what events led to Knee Arthroscopy
"
]
},
{
@@ -553,12 +553,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
The TOP event that led to Knee Arthroscopy is Excis Knee Semilun Cartl .
\n",
+ "
The TOP event that led to Knee Arthroscopy is Excis Knee Semilun Cartl .
\n",
"\n",
- "
To check the details of any path or node we can move the mouse pointer over it and check details. Similarly other nodes and paths can be analyzed using similar functions.
\n",
+ "
To check the details of any path or node we can move the mouse pointer over it and check details. Similarly other nodes and paths can be analyzed using similar functions.
\n",
"\n",
- "
Now let's Check paths that led to Other Diagnostic Physical Therapy Procedure.
\n",
- "
As seen in the above analysis ,Knee replacement was suggested after these procedures also.
"
+ "
Now let's Check paths that led to Other Diagnostic Physical Therapy Procedure.
\n",
+ "
As seen in the above analysis ,Knee replacement was suggested after these procedures also.
"
]
},
{
@@ -615,12 +615,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
As seen in the above sankey diagram there are various events that led to Other Diagnostic Procedures. The TOP event being Oth Arthrotomy-Knee followed by Knee Arthroscopy.
\n",
+ "
As seen in the above sankey diagram there are various events that led to Other Diagnostic Procedures. The TOP event being Oth Arthrotomy-Knee followed by Knee Arthroscopy.
\n",
"\n",
- "
To check the details of any path or node we can move the mouse pointer over it and check details. Thus, we have seen that using the nPath function we can check on various Events that led to different procedures and finally Total Knee Replacement.
\n",
+ "
To check the details of any path or node we can move the mouse pointer over it and check details. Thus, we have seen that using the nPath function we can check on various Events that led to different procedures and finally Total Knee Replacement.
\n",
"\n",
- "
Total Cost for Knee Replacements.
\n",
- "
Let's check how we can use the nPath function to find the average cost involved in different paths that lead to Total Knee Replacement.
\n"
+ "
Total Cost for Knee Replacements.
\n",
+ "
Let's check how we can use the nPath function to find the average cost involved in different paths that lead to Total Knee Replacement.
\n"
]
},
{
@@ -691,26 +691,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
The above graph shows the Top 10 paths based on the Total Cost required for Total Knee Replacement.
\n",
+ "
The above graph shows the Top 10 paths based on the Total Cost required for Total Knee Replacement.
\n",
"\n",
- "
Conclusion
\n",
- "
Thus, using the unique analytic capabilities of Vantage for understanding customer and user behavior over time. In fact, these analytic techniques can be applied at massive scale to derive more accurate results. Then, these results can be combined with other analytics to create more advanced and accurate prediction models. Vantage also allows organizations to scale these models horizontally, by training segmented models per region, user type, etc., or vertically, by combining data from millions or billions of interactions. All of this can be deployed operationally to understand and predict actions in real-time.
"
+ "
Conclusion
\n",
+ "
Thus, using the unique analytic capabilities of Vantage for understanding customer and user behavior over time. In fact, these analytic techniques can be applied at massive scale to derive more accurate results. Then, these results can be combined with other analytics to create more advanced and accurate prediction models. Vantage also allows organizations to scale these models horizontally, by training segmented models per region, user type, etc., or vertically, by combining data from millions or billions of interactions. All of this can be deployed operationally to understand and predict actions in real-time.
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
7. Cleanup
\n"
+ "
\n",
+ "
7. Cleanup
\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "
Databases and Tables
\n",
- "
The following code will clean up tables and databases created above.
"
+ "
Databases and Tables
\n",
+ "
The following code will clean up tables and databases created above.
"
]
},
{
@@ -737,27 +737,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
- "
Resources \n",
- "
Let’s look at the elements we have available for reference for this notebook:
\n",
+ "
\n",
+ "
Resources \n",
+ "
Let’s look at the elements we have available for reference for this notebook:
\n",
"\n",
- "
Links \n",
- "
Teradata Python Package User Guide \n",
- "
Teradataml Python Reference \n",
- "
Teradata nPath Function Reference: \n",
- "
Teradata Sessionize Function Reference \n",
- "
Python Pandas Reference \n",
- "
Plotly Reference \n",
+ "
Links \n",
+ "
Teradata Python Package User Guide \n",
+ "
Teradataml Python Reference \n",
+ "
Teradata nPath Function Reference: \n",
+ "
Teradata Sessionize Function Reference \n",
+ "
Python Pandas Reference \n",
+ "
Plotly Reference \n",
" \n",
"\n",
- "
Filters:
\n",
- "
Industry: HealthCare \n",
- "
Functionality: Path Analytics\n",
- "
Use Case: Total Knee Replacement\n",
- "
Related Resources:
\n",
- "
Broken Digital Journeys CX Solution Accelerator Demo via Python Video - External - SP004183 \n",
- "
Forecasting COVID-19 Using Teradata Vantage \n",
- "
Saving Lives, Saving Costs: Predicting Heart Failure with Teradata \n",
+ "
Filters:
\n",
+ "
Industry: HealthCare \n",
+ "
Functionality: Path Analytics\n",
+ "
Use Case: Total Knee Replacement\n",
+ "
Related Resources:
\n",
+ "
Broken Digital Journeys CX Solution Accelerator Demo via Python Video - External - SP004183 \n",
+ "
Forecasting COVID-19 Using Teradata Vantage \n",
+ "
Saving Lives, Saving Costs: Predicting Heart Failure with Teradata \n",
"\n"
]
},
@@ -765,7 +765,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "
\n",
+ "\n",
" ClearScape Analytics™
\n",
"