Sunday, 28 February 2021

SharePoint Syntex AI - tips for choosing between document understanding and form processing models

SharePoint Syntex, the AI-powered document understanding capability of Office 365 which was previously part of Project Cortex (we'll come to that in a second), provides two approaches to understanding your content in document understanding and form processing. I talked about document understanding in two previous articles:

However, document understanding is only 50% of the Syntex capability. Form processing is more suited to very structured documents such as invoices, receipts and order forms - but there's a lot more to the decision than that. On the surface, many of the document AI processing scenarios you might consider could use either approach - but whilst there's huge overlap, the two models have some significant differences in capability, licensing and how they are applied.

Choosing the right approach can be confusing at first, so that's the focus of this article. But first, did you know that the "Project Cortex" label is disappearing?

Microsoft's Viva - branding and naming changes

With the advent of Microsoft Viva, the "topics" part of Project Cortex has become "Viva Topics" and is part of the that product set. The retirement of the Cortex brand label also means that Syntex becomes it's own thing. Indeed the Syntex add-on for Office 365 didn't use the Cortex label once launched - so in the Microsoft 365 admin center you'll see:


So a quick summary of the original naming compared to the current naming is:

With that out of the way, let's get back to form processing. 

Form processing vs. document understanding - what to use when?

So how does form processing differ from document understanding? When would you use each one? Microsoft have a fairly useful article at Difference between document understanding and form processing models, however some of the biggest differences lie in how the AI models are trained and what they're capable of, something the article doesn't really cover. I think things can be clearer still - here are the major differences as I see them:


Aspect Document understanding Form processing
Best suited for Unstructured or less structured content - documents can be written in different ways Highly structured content - based on a specific format with high consistency
Capabilities Classify your documents/identify content types (e.g. to drive compliance policies)

Extract content
Extract content

Extract table content
Summary of AI model training Machine teaching based on flexible rules for classification and extraction (e.g. proximity rules such as "X should be within 50 characters of Y")  Machine teaching based on well-defined locations with the document
Underlying technology Native to SharePoint Syntex Power Apps AI Builder - form processing
Technical implementation Model is applied to the SharePoint library through model settings A Power Automate Flow is created and associated with the originating library - but currently cannot be applied to different libraries
How applied across your tenant Create model once, apply to multiple SharePoint libraries (one by one) Created model is tied to originating document library (today)
Licensing Syntex license only:

£3.40 or $5 per user per month

(see "Who needs a Syntex license" later)
Syntex license + AI Builder credits:

Each user needs a Syntex license, and in terms of AI Builder credits, orgs with 300+ Syntex licenses receive a bundled allowance of 1m credits (one off). 

See AI Builder calculator for examples of how many credits are consumed by different operations - but in short, 1m in credits is extremely generous even for large organizations. As a guideline, if you process 5000 documents per month that would be just 4 credits per month.

To purchase, 1 unit of AI Builder credit costs £377 or $500
Supported file types All Office file types, .eml, JPG, PNG, PDF, RTF, TIFF, txt JPG, PNG or PDF
Key limitations Office files are truncated at 64k characters

OCR-scanned files (PDF, image or TIFF) are limited to 20 pages
Tables must be simple - no nested tables or merged cells
Signatures, checkboxes and radio buttons cannot be extracted

Max 500 pages


Let's dig into more detail on a couple of these points.


Differing approaches to machine teaching 

I mention in the table above the differences in how the AI models are trained. Perhaps the images below explain it best.

In form processing, I'm very precisely teaching Syntex where to find a previously-specified element of the document I want to extract - in this case the invoice reference:


In document understanding, I can do the same thing - however, I can also add some flexibility by defining "explanations" (essentially rules) which provide some extra context about variations in the document format that the AI might need to deal with:

I can also teach the machine how specific parts of the document relate to each other with a proximity rule. In the explanation below, I'm saying "first find the 'Fees and Payment' phrase, then find 'Total' which is more than 20 tokens away but less than 100. Once there, find the thing that looks like a GBP currency value which is VERY close, in fact less than 10 tokens away:

So, these differences can rule in or out one model depending on what your documents look like.

Considerations when applying across your tenant

The current limitation of a form processing model being tied to the SharePoint library where it was created is an important factor. This means that, as of today, there's no real pathway to using one of these models across your Microsoft 365 environment - so if your invoices/order forms/receipts get stored in many different SharePoint sites or document libraries you have a lot of work on your hands to replicate the solution.

This is somewhat surprising since the implementation is a Power Automate Flow. Conceivably, you could copy and paste Flow actions to speed things up - however, I note that simply trying to repoint the Flow to another SharePoint document library (by updating references) currently fails, perhaps indicating that there are some internal references which become out of sync. Indeed, the Microsoft documentation states:

Form processing models can currently only be applied to the SharePoint document library from which you created them. This allows licensed users with access to the site to create a form processing model. Note that an admin needs to enable form processing on a SharePoint document library for it to be available to licensed users.

Hopefully Syntex form processing models become much more reusable and portable in the future. 

Other benefits with SharePoint Syntex licensing

Notably, Microsoft provide some other capabilities as part of the Syntex license. These are badged as "premium" items and include:

  • Term store analytics
    • Insights on how tags are being applied to your content - term store operations, open and closed term sets, terms without synonyms and more 
    • See Term store reports | Microsoft Docs
  • Content type push to hub
    • More control over where content types get applied to your environment. Being able to pushing from the central term store to a hub can become the first part in a chain, where the second part is the existing "push from hub to associated sites" capability. In the end, you get your content types to where they need to be without PowerShell or other roll your own approaches
    • See Push content type to hub
  • Import using SKOS format

Who needs a Syntex license?

At £3.40/$5 per user per month for the Syntex add-on, understanding exactly who in the organization requires a Syntex license becomes critical. The SharePoint Syntex FAQ states the following, though the highlighting is mine:

Anyone using, consuming, or otherwise benefiting from SharePoint Syntex capabilities requires a license. This includes the following scenarios:

  • Access a Content Center
  • Create a document understanding model in a Content Center
  • Upload content to a library where a document understanding model is associated (whether in a Content Center or elsewhere)
  • Manually execute a document understanding model
  • View a library where a document understanding model is associated
  • Create a form processing model via the entry point in a SharePoint library
  • Upload content to a library where a form processing model is associated

In summary the licensing requirements are certainly pervasive - even viewing a SharePoint library where a Syntex model is used requires a license. 

Conclusions

An organization's ability to automate processes around documents, improve findability and extract important corporate knowledge from files will be important factors in agility and effectiveness over the next few years. You can find the AI that supports this in a few different places in the Microsoft stack (and the wider cloud market), but Syntex is the easy-to-consume technology that brings this directly to where your documents are in Office 365 - SharePoint and Teams. With a little experimentation and persistence, a non-technical business user can build powerful automations and effective search tools. 

Syntex licensing means that it's likely to be used in specific use cases - perhaps for your organization it could be something around CVs/resumes, RFPs, project documents, invoices, order forms or partner details - but you may not feel it's appropriate to license every user in your organisation, at least not until the value provided is clear.  

Making the right decisions between the two Syntex approaches of document understanding and form processing is vital and this can be a confusing area. Some of the major differences include what the AI models are capable of, how easy they are to use in different places, supported file types and licensing. Hopefully this article is useful in helping you navigate this.

Sunday, 31 January 2021

Slide deck and videos - Building AI into Power Platform solutions

This is a quick post to publish some resources I created recently covering considerations for using AI in the Power Platform. They are from a talk I gave at ESPC 2020 (the European SharePoint, Microsoft 365 and Azure Conference).

For many people getting into building Power Apps and Power Automate solutions, the obvious first choice is the "AI Builder" capability which comes as part of the platform, but as I've discussed elsewhere there are certainly options beyond that - each with different costs and capabilities. 

Topics covered include:

  • What you can expect to pay for AI
  • Different implementation approaches, specifically:
    • Power Apps AI Builder
    • Use of Azure Cognitive Services from code
    • Use of Azure Cognitive Services in a Flow (Power Automate)
  • A real world scenario - building an Incident Reporting Power App which uses AI to alert a human when a serious incident is detected
One area of focus is how Microsoft 365 technologies can easily be strung together to create high value solutions with minimal effort. The slide below depicts how Power Apps, SharePoint, Power Automate, Azure Cognitive Services and Teams each play their part in my demo scenario:



We can expand on how each technology is used as follows:

The slide deck hopefully has a few more useful slides too - it can be browsed or downloaded below.

Slide deck - Building AI into Power Platform solutions:



Demo videos


Demo 1In this video we take a part-built app and integrate with Power Automate to take the photo captured from the user's phone and store it in Microsoft 365/SharePoint:


Demo 2In this video we add AI to the application by integrating image recognition from Azure Cognitive Services. We do this using Power Automate in Microsoft 365, with no code required:



Sunday, 3 January 2021

Trends and predictions - I.T. project priorities for 2021

The holiday season and start of a new year is always a good time to pause, collect thoughts and reflect on what the upcoming 12 months are likely to bring. As usual for this time of year, there's no shortage of crystal ball-gazing and there are many forecasts and prediction lists from industry watchers and analysts. However, for our work at Content+Cloud I find that some specific thinking around the components of Microsoft 365, modern workplace, security and existing in the Microsoft partner ecosystem is helpful. Whilst these aren't our only service lines by any means, a significant slice of our projects revolve around these strands - and so my list has a sprinkling of these Microsoft-specifics mixed with my general expectations for the types of organisation we work with.


A backdrop of accelerated digital transformation

Before we get to my 2021-specific list, it goes without saying of course that the general theme of accelerated digital transformation will persist and the staple projects this brings in the Microsoft space will continue. Generalised examples for us include:

  • Adoption of Microsoft 365, including SharePoint and Teams migration projects, implementation of Teams Voice etc.
  • Public cloud adoption (Azure) - either led by datacenter migrations, Windows/SQL end of life, app modernisation or greenfield development
  • Desktop refresh/Managed Desktop implementation 
  • Digital Workplace implementation
  • Cybersecurity projects
  • Cloud operating model and service design

Given that many organisations are still on the cloud modernisation journey and the more mature see digital transformation as an ongoing process rather than an individual programme or project, all these are relative constants for our era that provide a bedrock of work to address. But moving beyond this segment, let's think about what might be more distinct for this year. 

Predictions and project types for 2021

  • Zero trust and information governance projects - representing continued security prioritisation, especially implementation of technologies which support zero trust (e.g. device and identity management), policy implementation, data classification and governance (especially around external sharing), security awareness training, phishing simulation, dark web monitoring and standards accreditation.
  • "Productivity governance" projects - for organisations invested in Microsoft 365 the need for need more robust Teams, SharePoint and Power Platform controls and policies will become commonplace. Organisations failing to address this will suffer from risk and complexity from the unmanaged proliferation of workspaces and apps and the lack of a coherent experience.
  • Teams apps and solutions growth - a move towards Teams becoming the "OS for business" with organisations having an increased appetite for bringing more of their tools inside Teams. Companies will reassess their posture for Teams store apps, custom apps and integrations - driven by user demand for enhanced meeting solutions, project and sales solutions, HR and team processes, remote collaboration apps and integrated calling (i.e. Teams Voice). New custom applications will be surfaced in Teams in many cases.
  • Hybrid working excellence - indeed, some companies will adopt a "remote first" approach when considering their tools and experiences. In both cases, focal points will include:
    • Digital Workplace - this will be a priority for companies who have not yet addressed their gaps, and ready-to-go solutions truly integrated with Microsoft 365 (like our Fresh product) will provide the best overall outcomes
    • Remote collaboration - co-authoring of whiteboards, mind maps, process flows etc. Notably, Microsoft need to evolve their Whiteboard offering to compete with Miro, Lucidchart/Lucidspark, XMind, draft.io and others here.
    • Employee experience - in particular employee onboarding, communications and engagement, knowledge sharing and communities of practice.

      For most this will be Digital Workplace-oriented (see above). However, others with specific needs may look to improve their communications ability in different ways (e.g. the rise of the "employee app" for retail and field-based organisations or those with a contingent workforce). 

      For others, the focus may be on modernisation of project or CRM tools.

    • A push on "working out loud" culture - regular narration of work on an internal social tool such as Yammer, publishing team news regularly (especially short form), early sharing of plans and work, lunch and learn sessions etc.
    • Virtual events and training - building the muscle and technology support for virtual town hall or leadership connection events (internally-facing) and webinars and mini-conferences (externally-facing). Teams Live Events may be the default for most organisations invested in Microsoft 365, but Microsoft will need to continue to innovate here too.
  • Return to office execution - for many organisation this starts with dusting off their plans delayed by later lockdowns, with the implications of the vaccination schedule providing a new lens. The threat of future legal challenges (perhaps from employees suffering long-term Covid health issues), in addition to internal optics, drives the need to prove that the employer duty of care was properly discharged. This means increased record keeping and proper implementation of social distancing - with desk/room/shared space booking apps, health declarations and Covid test result tracking coming to the fore. 
  • Process improvement and automation - deeper automation of customer and supplier operations, finance and HR processes, JML (joiners/movers/leavers). Expect to see integration of digital signatures and AI into more processes, and the auto-generation of Office and PDF documents (contracts, invoices and the like) to become more commonplace.

Other trends of note


In broad terms, we'll also see other impacts from movements such as the democratisation of AI and automation, data modernisation and the rise of low code technologies.

Other specific developments mean we can also expect big changes to how documents work in the future. We all use documents yet they have huge limitations (something I discussed recently in Project Cortex - training SharePoint Syntex to read your documents like a human) - however, the near future will bring "dynamic shared content" which can be surfaced and co-authored simultaneously in a document, e-mail message, Teams chat message and/or SharePoint page. This will be powered by Microsoft's Fluid Framework and will underpin a new generation of collaboration experiences from both Microsoft and 3rd party developers.

I believe other trends will also emerge, such as increased adoption of "portable huddle" technology - a BYOD approach to meeting room tech for equipping a shared space which is NOT a city-based corporate office or high-end working hub. This will support in-person local group collaboration in less formal locations for workshops, kick-offs, team meetings and so on, whilst providing a good audio visual experience and allowing integration with Teams and collaboration tools. 


Summary


These initiatives and project types represent a focusing of the lens for ambitious organisations looking to optimise organisational effectiveness in 2021. Aside from my list above and other emerging trends, other themes such as cost reduction are certainly not going to go away - projects around asset management and cloud governance/cost optimisation in particular will persist. 

2021 will be a fascinating year for I.T. as we emerge from a tumultuous period - but transformation opportunities abound for those able to seize them! 


P.S. If you think I missed something big in the Microsoft space or my views don't chime with yours, let's discuss on Twitter or LinkedIn


Tuesday, 29 December 2020

Project Cortex - training SharePoint Syntex to read your documents like a human - part 2 (entity extractors)

In the previous article we looked at how to get started with SharePoint Syntex, covering in particular the initial steps of creating a document understanding model. In this article we'll look at how Syntex can extract content from your documents - allowing you to unlock "golden" information so people don't have to open 10 documents to find what they're looking for. Before we get into things, remember that a document understanding model can have two elements:

  • A classifier - this allows Syntex to identify what type of document it is (e.g. a "C+C Statement of Work" in the example I'm using)
  • An entity extractor - unsurprisingly, this allows Syntex to extract information once trained

We'll focus on the entity extractor today, and this is the fun part. If you remember our scenario from the last article, I'm extracting the total value from each Statement of Work document I have in Office 365. Here's what that looks like - it's the 3rd highlighted rectangle here:

If you remember, creating both a classifier and an extractor uses this process:
Syntex needs some training files to use as we're developing the AI model, but in my case I added these last time when I created the model initially and defined the classifier. As you might imagine, these are some test Statement of Work documents with one or two others thrown in there - the "others" are used to train Syntex about "negative" cases. These go into a special "Training Files" library within the Content Center, and I'll use those same files for the extractor.

Implementing an entity extractor in the AI model

The first step is to head back to the Content Center and find the model you're adding the extractor to:

Once in the model, choose the "Create and train extractors" action:

Next, name your extractor and specify if you want the data to be extracted to a new column on the SharePoint library (and the data type if so) - usually you do. Since I'm extracting the total value from each Statement of Work, so the name I use is "Engagement value": 

We're then taken into the "Label" tab, the first step of three when defining a classifier or extractor. 

Creating the extractor - labelling step

 
Accuracy requires labelling and "explanations"
When labelling your files for an extractor, you are teaching Syntex where the value is in your sample files. But as we'll see, simply showing Syntex where it is in a couple of files isn't enough. We need to create "explanations" too - the AI engine uses both pieces of info.

Here, we are dealing with the labelling step.

In the labelling tool (where all formatting is removed from the document), I find the costs table which is present in all of our Statements of Work and I highlight the value from the total row:

I then hit the "Next file" button and repeat for the next document in the training files library: 

Once I've labelled at least five files, I move to the "Train" tab.

Creating the extractor - explanations step

For the training part of the process, we create one or more explanations to help guide the AI further. When we created explanations for the classifier, we were providing Syntex with patterns to help identify and classify the document. For the extractor, we do something similar but here we are providing patterns to guide Syntex to the content we are trying to extract.

Explanations can be created from scratch or from a template:

Templates already exist in the system for common pieces of info you may want to pull out of documents - for example, dates, numbers, phone numbers, addresses and so on:

For the sake of learning I'll create my explanations from scratch, even though the first one is actually a currency value and a template exists for that. I give it a name, choose the Pattern list type and provide the variants to account for how the engagement value may be written in my documents (different number formats):

I then save this explanation and create another one. This time I'm helping the AI find the overall section within our SOW documents which the costs table can be found in - I'm simply looking for the title of that section, "Fees and Payment":




I create one more to find the phrase "Total".

Now that I have all of those, I combine them so that I can essentially say "first, please find the phrase 'Fees and Payment', then 'Total', THEN the thing that looks like a GBP currency value. I do this by creating a new explanation of type "Proximity" - and specifying how far apart each element is. Syntex uses the concept of tokens to specify proximity, and my resulting explanation looks like this:   

More accurately, I'm saying "first find the 'Fees and Payment' phrase, then find 'Total' which is more than 20 tokens away but less than 100. Once there, find the thing that looks like a GBP currency value which is VERY close, in fact less than 10 tokens away.

As you can imagine, tuning the tokens in a proximity explanation helps the accuracy of the AI and reduces the chances of Syntex being unable to find your content. My final set of explanations looks like this - it's the 3 phrase or pattern explanations AND the proximity explanation which combines the others:

Creating the extractor - training/testing step

I'm now ready to train and test. Similar to when I did this for the classifier, I select some training files which haven't been used in labelling (including one document that isn't a Statement of Work):



The "Prediction" column then tells me what Syntex predicts would be the extracted text for each document. Success! This looks good:


That's almost a 100% success rate - but you might notice that the model failed to extract content from one SOW document, and indeed Syntex tells me this:


 
Upon further inspection, this particular document seems to have a structure different to what I'm expecting - specifically, I find that the author has used a different heading for this section of the document!


So at least I understand why this is happening - I can now tweak my explanations if this is an expected case, or politely remind the project manager that they should be following our standard structure! Either way, there's a path to resolving this. 

I now finish the process by clicking on the "Exit training" button:


Seeing results - applying the model to document libraries

Our work is now done! We have a completed AI model and we can apply it to document libraries around the Microsoft 365 tenant:

A Syntex AI model does need to be applied to libraries individually, but in most cases your documents of a certain type may not be distributed that widely anyway. In the future, we can expect APIs and provisioning mechanisms to manage this at scale.

Once the model has been applied, Syntex extracts the content I trained it to - meaning I don't need to open each individual document:

Summary

We've now seen the process of creating a document understanding model in SharePoint Syntex - something that will allow us to recognise the document AND extract content from it. We can take this further too. Instead of just extracting a single piece of information (e.g. the value from a Statement of Work) we can, of course, extract multiple pieces in the same extractor.

Overall, these capabilities of Syntex provide a great leap forward in terms of how information can be found. High value information no longer needs to be buried inside documents, meaning that employees either do not see it or are forced to open many individual documents to find it. We can create mini-databases and tools from content that was previously locked away - including capabilities which provide sorting, filtering and powerful search experiences. To the future!

Sunday, 13 December 2020

Project Cortex - training SharePoint Syntex to read your documents like a human

A long time ago, when the human race started to use ink to inscribe information on parchment or papyrus, this was a great leap forward from carving into stone or clay. Information became easier to create and transport, and knowledge instantly started flowing in ways it had not done before. Today, *all* of us are closely tied with the process of creating, sharing and consuming documents - the world literally revolves around them.

But documents have their constraints of course. Critical data and knowledge gets buried within them, leading to a series of challenges that mean very few organizations truly get value from the content they create. You might be familiar with the statistic from McKinsey research that the average knowledge worker spends 20% of their time (a day per week!) just searching for information or expertise within their company. That could be conservative though - IDC's Knowledge Worker survey (behind paywall) suggests the figure could be closer to 30%.

One of the reasons for this is that documents generally need to be opened to access their information - and it's inherently time-consuming to open 20 documents to establish which one has the information you're looking for. As you might know, Project Cortex introduces AI-powered capabilities into Microsoft 365 to solve several aspects of the knowledge challenge. In this post, we'll look at SharePoint Syntex, and how to teach it to:

  • Automatically recognize different types of documents - usually from some consistent content within the document (e.g. the phrase "Statement of Work") 
    • This means the document can automatically inherit a retention policy or appear in search results in a certain way (for example), all without a human tagging each document. In Syntex, this is a Classifier
  • Pull specific information out of documents - meaning that high-value data is no longer locked inside documents, whether you have 100 or 100 million.
    • With this capability, the specific information is pulled out of each document and stored as metadata in SharePoint columns. In Syntex, this is an Extractor

An example in my company

At Content+Cloud, two of our most common document types are Proposals and Statement Of Work documents - no surprise given that we deliver projects and services. I've redacted the numbers, but here's what the costs/investment table looks like in one of our real SOWs:

I've highlighted a couple of things in the image above. When I'm opening the document to find the total value of the project, as a human my brain is instinctively following this process:

  1. Find the "Fees and Payment" section
  2. Look for the "Total" row
  3. Find the £ value that is in that row

In this article, we'll teach SharePoint Syntex to do the same thing (in addition to recognizing Statement of Work documents in the first place). Syntex can then pull out the project value from 100s or 1000s of our SOWs much faster than any human ever could. Given that we create many SOWs each week, knowing that the technology can stay on top of this unlocks further benefits. 

Creating a document understanding model in Syntex

I'm going to skip over the initial pre-requisite step of creating a Content Center as part of Project Cortex in your Microsoft 365 tenant - quite simply, this is done in the SharePoint admin center for your tenant, and "Content Center" appears as a new site type. Once you have that, you can begin creating models. We're going to do two things here:

  • Create a Classifier so that SOWs can be identified
  • Create an Extractor so that the value can be extracted
In both cases, we follow this process:

To start, navigate to your Content Center and click the "Create a model" button:

Give it a name (in my case it's a Content+Cloud Statement of Work) and choose whether you want to create a new content type or use an existing one:

Notice that you can also specify a retention label for this model. This is huge step forward in helping organizations meet their compliance needs! Once trained, not only can SharePoint Syntex automatically recognize a Statement of Work within my tenant (regardless of which site or Team is it stored in), it can ensure these documents have appropriate information governance applied. For our company, a Statement of Work is a contractual client document - and as such we should retain it for a number of years by default. Syntex makes this possible without a human needing to label each SoW - and the pattern recognition we'll see provides the power and flexibility to recognise reliably.

In this step I see all of the published retention labels in my tenant: 

Now that we've created our model, the first major configuration step is to add some files for training - we can use these to train both the Classifier and the Extractor. The training files should be a set of test files which are Statements of Work, but also at least one which isn't. I supply some files as shown:

The "Training Files" library is a special document library within the Content Center where these files go. It's common to stack up files from different models you build here (as shown below), but essentially you're adding a set of files you're previously gathered up each time you build a model:

How many training files do I need?

Syntex requires you to add at least 5 files which match the document type you're working with, and at least 1 which isn't. However, the best idea is to gather up and add more than 6 files because you'll use them in two steps:
  • Labelling at least 6 files during initial training
  • Using the remaining unlabelled files to test your model

Creating the Classifier


Now we have some training files, click the "Train classifier" button:

Creating the Classifier - labelling step


In this step we're on the first tab ("Label") and we're essentially telling Syntex which of those training files are the ones which match the content type (in my case, a C+C Statement of Work) and which are not. Within the labelling tool, the interface provides a toolbar with "Yes" and "No" buttons to do this (highlighted below):

I step through each of my training files and click the "Yes" and "No" buttons appropriately - this is how labelling is done for a Classifier. Once done, the model trains itself automatically and the "Label" column confirms the status:

Creating the Classifier - explanations step

Now move to the "Train" tab. We now need to add one of more "Explanations" - these help the model further, since just having some labelled sample documents isn't enough. Think of this as the system needing to understand more about the patterns that identify this document type.

To start, click the "New" button within the Explanations area - notice that you can start from a blank example or from a template:

Templates, in case you're wondering, are for common snippets of content which may help classify (or you may want to extract from) a document - dates, phone numbers, zip codes, currency amounts, e-mail addresses and so on):




In this case, we can create from blank. What I'm going to do is create a phrase list explanation, using a phrase which is only found in a Statement of Work - when doing this, one thing to look out for is that often you can't use the simple case alone. For example, the phrase "Statement of Work" appears in many of our other documents which aren't actually Statements of Work! So instead, I'm using something from the small print that will only be in a SOW - in the image below, you can see it used as my phrase and also on the right in the simplified document view:




Click "Save" to finish creating the explanation.
 

Creating the Classifier - training/testing step

Now it's time to test the Classifier. To do this, move to the "Test" tab and click the button to add example files:





I can now select some previously added example files - these need to be files I haven't already used in the labelling process. To test properly, I select some documents which are SOWs and some which aren't:


Click the "Add" button and the files will be used for the testing. What you should see is that the model has correctly identified the documents which are a positive match, and others show as negative:


Excellent!

At this point, the "Classifier" part of our AI model is complete - Syntex will now be able to recognize this type of document anywhere in the Microsoft 365 tenant. The model can now be applied to document libraries and the content type we created or used will be applied:


As any experienced SharePoint or Microsoft 365 practitioner knows, there are SO many possibilities now that the content type is known. From automated workflows, information protection policies, filtering and special appearance in search results through to document lifecycle aspects such as retention and disposition - the list goes on. 

But let's not stop there - before we complete the final steps of making this happen, we'll do more than just identify the document type. In the next post, we'll go back to where we started by implementing an "Extractor" in SharePoint Syntex to pull out the Statement of Work value - thus ensuring it's not buried in each document.

Monday, 16 November 2020

Automating location check-ins with Power Automate

Geofencing is the idea of a location service triggering an action whenever a device (i.e. a user's mobile device) moves in or out of an area, and there are lots of great use cases. On the personal/home automation side, you might want to automatically switch the house lights off and activate the alarm when you leave home (think IFTTT or Zapier if you're familiar with those), and on the work side your employer might provide an app which automatically checks you in (or out) of an office location dependent on your location - as just two examples. I was looking at the latter scenario for our internal desk booking app as part of our "controlled use of offices during Covid" plan. 

You can imagine lots of cases where knowing the user's location and whether it has changed can be powerful.

The Power Platform has a couple of ways to tap into this. I'd been researching the Location trigger in Power Automate, and this provides a Flow action named "When I enter or exit an area":

As is normal with geofencing, you specify a location anywhere in the world and create a radius around it. The location is approximate since GPS on the user's mobile device is used, but it works great for most purposes: 



Things were working great for a while, but then I ran into this:

The Location trigger has been removed from Power Automate!

The trigger was only ever in preview, and sadly in the few weeks since I had this article in draft (and had taken the above screenshots) it was removed. At this stage it's unclear whether it will return, and whilst there are traces of it on the internet there are no mentions of it within Microsoft documentation.

So that's a shame! To be quite honest, there was a challenge with the trigger anyway in the Power Platform - it could only ever be used for personal Flows, meaning each user who should use the capability would need to create their own Flow. Clearly this doesn't work for any kind of business solution provided by an organization, but could still be useful for personal automation.

How else can we automate based on user location?

The good news is that Power Automate is still able to understand the user's device location. A fully automated solution which is triggered simply by moving in or out of a defined region is no longer possible, but if you're happy to have users manually click a button on their device, similar automations are still possible. Indeed, in some scenarios this approach may be preferred so that there's a level of human control and opt-in - allowing the user to avoid triggering a process if the circumstances don't warrant it (e.g. leaving the area radius briefly to pick up lunch). 

So, let's take a look at how we can build Power Platform apps which account for the user's location.

Using Flow buttons to log a location visit

Flow buttons provide a great way to build a mobile app with a super-simple user interface - without having to delve into any kind of coding or the world of native iOS or Android development. In my example below, I'm using a simple button and a very simple form. But first, the prerequisites.

The first requirement for a solution like this is for users to have the Power Automate app installed on their mobile device. Your organization could push it out using a MDM or MAM solution, or it's available in both the Apple and Google app stores:

The user will need to sign-in to the app with her Microsoft 365 identity. The other important thing is that location services are enabled on the device for the Power Automate app - an obvious necessity if we are collecting and logging the location. 

Once in the app, the user would go to the "Buttons" area in app using he navigation bar along the bottom.

Any Flows which have been created using the "Manually trigger a Flow" trigger will appear in here: 



In my solution, I have a Flow to log details of a location visit - this is named "Report location status" in the image above, and you can also see some other Flows which also use the the button trigger. As you've probably gathered, these are known as "Flow buttons" and provide a really quick and easy way of manually triggering a process. No need to create and deploy a custom app - instead we can piggy back on what the Power Platform provides. 

When the button is clicked, some information can be selected to feed into the process. In my example of logging a location visit, the Flow asks for a "status" to be collected:


In the case of my solution, when the user submits this "location report" I store the details in a SharePoint list. Power Automate has done the hard work of automatically deriving the user's location at the time of pressing the button, and with a little column formatting magic I can display a small map for the location instead of just the address text:

 
 
So that's it! With fairly minimal effort in the Power Platform we have a mobile app which can collect the user's location, collect additional information and log it into a central store such as a SharePoint list in Microsoft 365.
 

How do we build that?

We've covered what the user would see, but what is needed in Power Automate to create this? We start by creating a Flow with the "Manually trigger a flow" trigger. Notice in my case I've added a single input named "Status", and supplied some help text:


You could actually stack several of these inputs and essentially create a mini-form which is presented to the user when they hit the button - which becomes quite powerful when you consider that no coding is required and we don't even need a Power App. 

The next step in the Flow is simply to log the item to SharePoint. I have a list ready to go with appropriate columns, and I just need to configure the Flow action to store the data in each:

 
The important thing is that several tokens are available from the trigger, including:
  • User name
  • User email
  • Timestamp
  • Date
  • fullAddress - this is the full address of the auto-derived location of your user
  • Many address sub-components:
    • Street
    • City
    • State
    • Postal code
    • Country
    • Latitude
    • Longitude
  • Any inputs you have added (e.g. "Status") in my case 
The final step in my Flow is to send a confirmation to the user that the report was logged successfully:


Which results in this appearing on the device:


So we've managed to capture the user's location and status report of the location, and confirmed back to them that the data was saved. 

Summary


The Power Platform has many amazing facilities for building applications, and that's especially the case for simple mobile applications. The ability to tap into device features such as location and the camera mean that you can build very capable apps quickly, without code - and certainly without all the hassles of native app development and distribution. In this post we looked at how Flow buttons can be used to quickly trigger a process from the mobile app, and how to capture the user's location at the time. 

Unfortunately the "When I enter or exit an area" Power Automate trigger that was in preview hasn't made it to release - but we hope it comes back because that would unlock some great scenarios around automation and the user's location. Come on Microsoft!