Jalal Uddin, Author at Microsoft Industry Blogs - United Kingdom http://approjects.co.za/?big=en-gb/industry/blog Fri, 04 Feb 2022 15:27:42 +0000 en-US hourly 1 Azure Healthcare Bot Service Logic App Integration (E-Mail) http://approjects.co.za/?big=en-gb/industry/blog/technetuk/2020/08/12/azure-healthcare-bot-service-logic-app-integration-e-mail/ Wed, 12 Aug 2020 14:00:29 +0000 This tutorial demonstrates how to add Logic App integration to your chatbot, specifically, adding email functionality. It may seem difficult to begin with, but once you are shown how to do it, it is actually quite simple.

The post Azure Healthcare Bot Service Logic App Integration (E-Mail) appeared first on Microsoft Industry Blogs - United Kingdom.

]]>
An illustration that represents AI, next to a drawing of Bit the Raccoon.

This tutorial demonstrates how to add Logic App integration to your chatbot, specifically, adding email functionality. It may seem difficult to begin with, but once you are shown how to do it, it is actually quite simple.

Acknowledgements:

This tutorial would not have been made possible without the guidance and support of Saranya Ravichander (CSA), and Gregory Lisiak (Architect).

 

Getting started

The tutorial is split into three parts; Healthcare Bot Scenario Set Up, Logic App Set Up and the Healthcare Bot & Logic App Integration.

I’m using the following resources: Azure Healthcare Bot Service (Azure Marketplace), Logic Apps (Portal), and an Outlook account (Office 365).

You must have:

  • a working Healthcare Bot Scenario
  • access to the Scenario Editor
  • access to the Azure Portal
  • an office 365 Outlook account

 

1. Healthcare Bot Scenario Set Up

To begin, you will need to create the representative JSON payload in order to populate the dynamic content for the Logic App to use for generating the email. This could be as simple as simply sending contact information to the Logic App to send a basic email or as detailed as sending the information collected during the bot conversation as a conversation transcript. At the end of your scenario:

1. Add an Action element to build an array containing all of the variables needed such as; It may be beneficial to save this in a text file as you will need the array information in a later step. For example:

scenario.testVar = 
{
"email":scenario.patientEmail,
"patientID":scenario.patientID,
"patientAge": scenario.patientAge,
"smokerOrNot": scenario.smokerOrNot,
"alcoholAmount": scenario.patientAlcohol.entity,
"riskLevel": scenario.riskLevel,
"riskScore": scenario.riskScore,
}

1.1 Add a Statement element that simply displays the array information which will be needed by the Logic App to build the dynamic content inventory that it will need to support. The statement element would look like this in the editor:

JSON.stringify(scenario.testVar)

1.2 Run the Bot scenario and copy the resulting statement. It will look like this:

{
"email":"johnsmith@notreal.com",
"patientID":5,
"patientAge":55,
"smokerOrNot":"non-smoker",
"alcoholAmount":"> 14 units/week",
"riskLevel":"high level",  
"riskScore":0.008245917062178134
}

Keep a copy of this. We will use this later.

1.3 You will need to use a text editor to change the quote marks to be consumable by the Logic App. For example:

A screenshot showing an edit to quotation marks to make them compatible.

Your scenario editor should now have the following new elements: 1 x Action element, 1 x Statement element and 1 x Data Connection element. Take a look at the image below for an example:

A screenshot of the scenario editor so far.

Note: You can ignore the final “Thank You” statement element.

 

2. Logic App Set Up

1. Now go to the Azure Portal and create a Logic App resource.

1.1.1 Go to the Logic Apps Designer and choose the “When a HTTP request is received” as the trigger.

A screenshot of the Logic Apps Designer website.

1.1.2 Click on “Use sample payload to generate schema”

The “Use sample payload to generate schema” in the 'When a HTTP request is received' dialogue.

1.1.3 This is where you will paste in the output you generated in the Bot scenario and cleaned up the quotes in the text editor.

The output being pasted into the JSON payload section.

Once you click done, the Request Body JSON Schema will look something like this:

A screenshot of how the Request Body JSON Schema should look.

1.1.4 Save this step, and the HTTP POST URL will be generated. You should see something like this:

A screenshot of the newly generated HTTP POST URL.

1.2 On the Logic App Designer, click on “+ New Step”

1.2.1 Search for “Outlook”.

1.2.2 Under Actions, select “Send an email (V2)” — it will ask you to sign in

A screenshot of the 'choose an action' dialog window.

A screenshot showing the need to sign in to create a connection to Office 365 Outlook.

1.2.3 Once signed in, you can format the email. The fields from the JSON payload can be selected from the Dynamic Content list.

An email being drafted in the 'Send an email' dialog.

You will notice that if you leave this composer and go back into the step, the order of the fields change. You will find that it is much easier to use Word to craft the base message and paste it into the Body before adding the dynamic content. Formatting options are a bit limited (e.g. Tables cannot be added for instance).

1.2.4 Enter whatever you want in the email body/subject/recipient. Regarding the dynamic content, all the blocks you can see in the image below are classed as dynamic content. It will be dependant on the values you input in the bot conversation. The way you input dynamic content is simple: Clicking anywhere in the body/subject/to sections leads to a pop-up section on the right-hand side. You can then search for fields that you specified in the sample payload. Now in the email, those fields will show whatever you input in the bot conversation. Here is an example of “Send an email (V2)” step:

An example email, featuring numerous blocks of dynamic content.

Once you complete the email template, you are ready to return to Bot. Don’t forget to copy the HTTP Post URL before leaving the Logic App Designer.

 

3. Healthcare Bot & Logic App Integration

1. Add a Data Connection element to your Bot scenario, choose “POST” and paste your Base URL (this is the HTTP Post URL we just copied) into the Data Connection Call. If you copied your array assignment to a text file, find it and copy it into the Payload section. If you didn’t, you can save the Data Connection Call, go to the Action Block and copy it and come back to the Data Connection. Assign the variables for the response and error and click OK. For example:

A screenshot of the Data Connection Call dialog.

1.1 If you haven’t done so already, you can delete the Statement Block created in step 2 and connect the Action Block from Step 1 to your Data Connection Call.

A screenshot showing the connection between the Action Block from Step 1 and the Data Connection Call.

1.2 Here is a sample email:

A sample email, populated by dynamic content.

 

Going Forward

Using this tutorial, you should now be able to send a variety of different emails for your use cases. Logic Apps makes the integration and flow between these Azure services incredibly simple, yet effective.

If there are any questions or ideas for a follow up blog, please drop a message.

 

Useful Resources

More from Jalal Uddin:

The post Azure Healthcare Bot Service Logic App Integration (E-Mail) appeared first on Microsoft Industry Blogs - United Kingdom.

]]>
Introducing Event Hubs Data Generator http://approjects.co.za/?big=en-gb/industry/blog/technetuk/2020/02/20/introducing-event-hubs-data-generator/ http://approjects.co.za/?big=en-gb/industry/blog/technetuk/2020/02/20/introducing-event-hubs-data-generator/#comments Thu, 20 Feb 2020 14:00:46 +0000 Event Hub Data Generator (EHDG) is a tool which generates realistic fake data based on a provided schema and sends it to Azure Event Hubs. The purpose is to remove the pain of initial set up that is faced by many developers.

The post Introducing Event Hubs Data Generator appeared first on Microsoft Industry Blogs - United Kingdom.

]]>
An image representing Azure Event Hubs, next to an illustration of Bit the Raccoon.

Event Hub Data Generator (EHDG) is a tool which generates realistic fake data based on a provided schema and sends it to Azure Event Hubs. The purpose is to remove the pain of initial set up that is faced by many developers. For instance, if someone is trying to demonstrate streaming data sets in PowerBI, they likely need to set up a stream analytics job, and in order for them to set up a stream analytics job, they need data; in particular hot data. Setting up this stream of hot data, particularly data that is useful for your use case, can be a tedious and lengthy process. Even if they had access to real data they could stream, real data is often messy – requiring endless cleaning. Event Hub Data Generator (EHDG) is here to make simplify this process and allow the developer to work on the later parts of the pipeline sooner.

Event Hubs

Azure Event Hubs, a Platform-as-a-Service offering, is a big data streaming platform and event ingestion service. Highly scalable and reliable, it can receive and process millions of events per second with low latency.

Event Hubs can be used for a number of different scenarios, such as:

  • Anomaly detection
  • Device telemetry streaming
  • Live dashboarding

Fake Data

Not every developer has the time to generate a tool to populate their databases or ingestion services. This is where fake data, otherwise known as test or dummy data comes in. Fake data serves to exist where real data is normally present, acting as a placeholder for testing purposes in a non-production environment.

JSON-Faker-Schema

Event Hub Data Generator (EHDG) is heavily based on the work of JSON-Schema-Faker’s JavaScript library. JSON-Faker-Schema can generate realistic fake data in JSON format for many areas, including people, address, finance, and company etc. The data generated will be based on the schema provided by the user. JSON-Faker-Schema adheres to the JSON Schema, which is a standard for a valid JSON file.

A very simple example of valid schema;

{
  "firstName": {
    "type": "string",
    "faker": "name.firstName"
  }
}

Given that Event Hubs Data Generator makes use of a library called JSON-Faker-Schema – it would be wise to refer to the documentation provided on their Github when you’re getting started. Their website includes a playground environment that is especially useful when testing whether your schema is valid.

Providers

The concept of providers is an important one in JSON-Faker-Schema – providers are the generator attributes that are packaged together. For instance, generator attributes such as firstName, lastName are packaged into a Provider called Person. Providers can be thought of as logical groupings of attributes. A complete and exhaustive list of providers can be found on the Faker Github Wiki.

How EHDG Works

This tool is web based, and as such, the implementation differs slightly from the documentation in the Github repository for the library we are using. We are using HTML forms (index.html) to pass data into the JavaScript file (index.js) which includes the Faker logic.

On the HTML page, index.html, the textbox field ‘method’ you are to insert a valid schema:

{
  "firstName": {
    "type": "string",
    "faker": "name.firstName"
  }
}

In our index.js file we can pass these values from the form using the Express library. Here’s an example of how it works:

var method = req.body.method;

Once we have the form values we can then perform our Faker logic:

var dataJSON = JSON.parse(method);
        var data = fakerSchema.generate(dataJSON);
        const eventData = {body: data};
        client.send(eventData);

Outputting ‘eventData’ to console would look like this:

{
  "firstName": "Oswald"
}

Using EHDG

Instructions to set up this tool to run locally can be found here.

Below is a short, simple guide on how to use the tool. A more detailed guide on the form is available here.

  1. Set up an Event Hub through the Azure Portal
  2. Go into the Event Hub’s SAS settings and copy the Event Hub’s Connection String and Namepace.
  3. Paste those aforementioned values into the web UI into the respective fields.
  4. Specify number of messages you want produced.
  5. Input a valid schema.
  6. Press submit.
  7. Check your Event Hub’s monitor to see incoming messages.

Going Forward

The possibilities are endless. As mentioned earlier, you can use Event Hub for live dashboarding, and anomaly detection amongst other things. For instance, you can set up a pipeline that includes the following: Event Hub, Stream Analytics and PowerBI and set data alerts in the PowerBI dashboard, which is effectively a way to carry out anomaly detection.

If there are any further questions, please take a look at the Github.

The post Introducing Event Hubs Data Generator appeared first on Microsoft Industry Blogs - United Kingdom.

]]>
http://approjects.co.za/?big=en-gb/industry/blog/technetuk/2020/02/20/introducing-event-hubs-data-generator/feed/ 1
How to visualise geospatial data by location to inform better decision making http://approjects.co.za/?big=en-gb/industry/blog/cross-industry/2020/01/21/how-to-using-powerbi-shape-map-tool/ Tue, 21 Jan 2020 12:43:02 +0000 Data visualisation can be used to provide more insight than traditional descriptive statistics can’t. This allows companies to make faster, informed decisions in an increasingly competitive market.

The post How to visualise geospatial data by location to inform better decision making appeared first on Microsoft Industry Blogs - United Kingdom.

]]>
Organisations produce so much data these days that it can be difficult to manage and make sense of it all – especially for those who aren’t data scientists. But using data visualisation helps communicate data insights in a way that makes it easy for everyone in the business to understand data and its importance.

Data visualisation can be used to provide more insight than traditional descriptive statistics can’t. It can also be used to see distinct patterns and observations that won’t be immediate if you wade through data line-by-line.

This allows companies to gather and quickly act on their data. Faster, informed decision making makes organisations more responsive in an increasingly competitive market.

I’ve put together a very short tutorial on how to use the PowerBI preview tool called Shape Map to help you visualise data across regions. Shape Maps are unique in its ability to use custom maps based on TOPOJSON files. It distinguishes the different regions of the map by using different colours in a way that’s easy on the eye.

Prerequisites

  • Enable the preview feature Shape Map Visual
  • The UK-Counties TOPOJSON file – download it here
  • The sample use case data – download it here

Enable Shape Map Visual

Once you have PowerBI go to Options by clicking on File, then Options and settings, then finally Options:

Enable Shape Map Visual

Clicking on Options will lead to the window as seen below. Ensure that Shape Map Visual is ticked. Once this is done, restart PowerBI for the changes to take effect.

Ensure that Shape Map Visual is ticked.

All set! You should now see the Shape Map icon Shape map buttonin your Visualisation tab.

Importing Sample Data

In a new PowerBI window click on Get Data and select Text/CSV.

Importing Sample Data

Once the select file dialog appears, choose the provided file countydata.csv.

choose the provided file countydata.csv.

Click on Transform Data on the new window.

Click on Transform Data on the new window

Now rename the top two columns to County and Value as shown below. Once you’ve done that click Save and Apply.

Showing a visual of Now renaming the top two columns to County and Value.

Shape Map Visual

On the Visualizations pane select the Shape Map icon – the one that has a red ring around it in the below picture:

Select the Shape Map icon in the Visualizations pane

You will end up with something plain looking like this.

First map visual.

Not very eye-catching is it? Let’s fix that, shall we!

On the fields pane, select County and Value.

The fields pane

Now under the Format tab in the Visualizations pane, select Add Map and choose the uk-counties.json file from whatever directory you saved it in. Your subsequent pane should look something like this:

The Format tab in the Visualizations pan

Your Shape Map should be complete. As specified by the data source, the following counties are represented in the map; Bedfordshire, Berkshire and West Midlands. I highly recommend you add more county and subsequent values in the CSV file to make the map look more distinct.

Shape map visual.

This map will help you visual data in a way that will help your business make more informed decisions, gains actionable insights, and quickly respond to a competitive market.

Special thanks to Matthew Stephen.

Jalal Uddin headshot

About the author

Jalal Uddin is a Cloud Solution Architect Intern at Microsoft, UK. He is passionate about empowering customers to learn how to use data to discover actionable insights to be more productive, more profitable, and more competitive. Jalal is completing a Computer Science Degree at Aston University.

The post How to visualise geospatial data by location to inform better decision making appeared first on Microsoft Industry Blogs - United Kingdom.

]]>