Exercise - Set up and use a container
Exercise - Create a language resource
In this exercise, you'll create an Azure subscription and a language resource, and then you'll copy the key and endpoint of the language resource that you created.
Task - Create an Azure subscription and a resource group
If you already have an Azure subscription, skip to the next task.
Go to Discover AI services with an Azure free account and Sign in.
Select Start free.
Fill out the form and then select Next.
Provide payment information and then select Sign up.
After creating an Azure subscription, select Resource groups.
Select Create.
Select the subscription that you created, enter DemoLanguageGroup for the Resource group, select your Region, and then select Review + create.
Select Create.
Task - Create a language resource
If you've already created a language resource, skip to the next task.
Go to Language Studio and sign in.
Select your Azure directory and Azure subscription and then select Create a new language resource.
Select your Azure subscription, select the Azure resource group that you created, and then enter DemoLanguageResourceFL (replace FL with your initials) for the Azure resource name. Select your Location, select S for Pricing Tier, and then select Done.
After you've created the language resource, select Done.
Task - Copy the key and endpoint
Your next task is to copy the key and endpoint by following these steps:
Go to the Microsoft Azure portal and sign in.
Locate and open the language resource that you created.
Select Keys and Endpoint.
Copy Key 1 to the clipboard.
Save the key you that copied on a notepad. You'll need this key in future tasks.
Copy the Endpoint URL.
Save the URL on a notepad. You'll need this URL in future steps.
Exercise - Install WSL and Docker
In this exercise, you'll install the Windows Subsystem for Linux and Docker on Windows 10 or 11. If you aren't using Windows, go to Get Docker | Docker Documentation and follow the instructions for the operating system that you're using.
If you already have Docker installed on your machine, skip to the next exercise.
Task - Install Windows Subsystem for Linux
To install the Windows Subsystem for Linux, follow these steps:
Locate your Command Prompt and select Run as administrator.
Select Yes.
Run the following command to install Windows Subsystem for Linux. This command will install the default Ubuntu distribution.
wsl --install
Select Yes and then wait for the installation to complete.
Ensure that Ubuntu is installed successfully.
Task - Install Docker for Windows
Follow these steps to install Docker for Windows:
Select the operating system that you're using. In this exercise, you'll install Docker Desktop for Windows.
Select to download Docker Desktop for Windows.
Run the Docker Desktop Installer that you downloaded.
Select Yes if prompted.
Select OK.
Wait for the installation to complete.
Select Close and restart.
Docker should launch after your computer restarts.
Read the agreement and select Accept if you agree.
Select Sign in.
Select Sign Up for personal account if you don't have a Docker account.
Exercise - Set up and run Docker
In this exercise, you'll set up and run Docker.
Task - Download and run the latest Docker version
To download and run the latest Docker version, follow these steps:
Open Command Prompt.
Run the following command, which will install the latest container version of Text Analytics for health.
docker pull mcr.microsoft.com/azure-cognitive-services/textanalytics/healthcare:latest
Wait for the installation to complete.
In the command prompt, run the following command. Replace
{ENDPOINT_URL}
and{API_KEY}
with the URL and key that you copied from Azure.docker run --rm -it -p 5000:5000 mcr.microsoft.com/azure-cognitive-services/textanalytics/healthcare:latest Eula=accept rai_terms=accept Billing={ENDPOINT_URI} ApiKey={API_KEY}
Select Allow access if Windows Defender prompts you.
Exercise - Use the container
This example shows you how to use the container to analyze single documents by using a demo user interface.
Task - Use the container
Follow these steps to use the container:
Go to the Docker app and select Containers.
Open the Port link.
Add /demo to the end of the URL and then press the ENTER key.
Enter Patient doesn't suffer from high blood pressure, or provide your own text, and then select Analyze.
The result should resemble the following image.
Provide the following in-depth text and then select Analyze.
HISTORY OF PRESENT ILLNESS: The patient is a 54-year-old gentleman with a history of progressive angina over the past several months. The patient had a cardiac catheterization in July of this year revealing total occlusion of the RCA and 50% left main disease, with a strong family history of coronary artery disease with a brother dying at the age of 52 from a myocardial infarction and another brother who is status post coronary artery bypass grafting. The patient had a stress echocardiogram done in July, 2001, which showed no wall motion abnormalities, but this was a difficult study due to body habitus. The patient went for six minutes with minimal ST depressions in the anterior lateral leads, thought due to fatigue and wrist pain, his anginal equivalent. Due to the patient's increased symptoms and family history and history left main disease with total occasional of his RCA was referred for revascularization with open heart surgery.
The result will resemble the following image. Hover your mouse pointer on the relation arrows to view the type of relation. Select the entities that have a UMLS value attached to them and then you can view the normalized name of the entity. The show JSON button allows you to view the raw results.
Exercise - Explore available endpoints
In this exercise, you'll explore the available endpoints for the container.
Task - Explore endpoints
To explore the available endpoints, follow these steps:
Go to
http://localhost:5000/swagger
to view the available API for the container.Scroll down to the Health section, and then locate and expand
/text/analytics/v3.1/entities/health
.Select Try it out.
Review the Request body and then select the Execute button.
Review the Response body.
Exercise - Call the container from the .NET application
In this exercise, you'll use the API from the .NET application that you created. If you don't have a .NET application, use the application from Cloud Service Lab or in the resources folder.
Task - Explore the application
To explore the application, follow these steps:
Start Visual Studio and then open the .NET application.
If you're using the application that you created, edit the application by providing space as the -credentials and
http://localhost:5000
as the -endPoint.Run the application.
View the results, as shown in the following image.
Stop the application.