Workflow example

Here is an example how you can use the APIs and the web admin user interface to add data into CareTec.AI for processing and analysis.

1. Credentials

You will have been supplied with a username and password for the web UI. And you will also have been supplied with a bearer token. Ensure you have those to hand because you'll need them for this walk through.

You can see how to add the bearer token in Insomnia here.

2. The whoami API

To make sure you API access is working as expected, the whoami API is a useful test. The Testing the APIs section has this covered already.

3. Data types

You can also see the available data types you can use to create the Data Stream Types (DSTs) you want to use for your data. To see what data types are available, you can use Insomnia to send a GET API call:

Seeing the data types

If you need more or different data types, let us know and we will set them up for you. The data types act as a parent grouping for the DSTs you create yourself.

4. Preparing for data import

To use the raw data batch importer, the DSTs and entities must already exist in the system. There are APIs for adding both entities and DSTS. You also do it via the web admin interface.

Adding DSTs via the web UI

We will deal with the web admin interface first. Go to https://app.augmentedinsights.cloudand login with the username and password you have been provided with.

From the Moderator Tasks menu choose Manage Data Stream Types

Moderators DST

That will show you the current DSTs available in the system:

DSTs

Click the Add New Data Stream Type button to create a new DST.

The form is self explanatory but here's a summary of what is required for the fields:

  • Data Stream ID - a sensible name to identify the DST. electricity for example
  • Data Stream Type Name - The name of the DST Electricity Data for example
  • Data Type - you can choose the parent data type from the dropdown menu
  • Process Type - Here you can set the type of processing for this DST. Sum, mean, min and max are the available presets.
  • Process Parameters is now redundant and will be removed.
  • Minimum value - What is the lowest acceptable value?
  • Maximum value - What is the highest acceptable value?
  • Rounding factor - number of decimal places values will be rounded to
  • Epoch length - for example 5 minutes
  • Max samples per epoch - how many data samples can be added during a single epoch

Adding DSTs using an API call

You can use JSON to create the DST record. Here's an example:

{
  "dst": "Electricity",
  "dst_name": "Electricity Usage",
  "dt": "elec_mw",
  "pt": "sum",
  "min_value": 10.0,
  "max_value": 100.0,
  "rounding_factor": 10.0,
  "epoch_length": 5,
  "max_samples_per_epoch": 7
}

The same field structure applies. The POST endpoint is:
app.augmentedinsights.cloud/api/v1/data-stream-type

Although the API only processes one new DSt at time, you prepare multiple records and send them in through a programmatic loop.

You'll get a 200 response with the DST you've added.

Adding Entities via the web UI

From the Moderator Tasks menu you can Manage Entities:

Entities

From there, click the Add New Entity button. From there, you just need to add:

  • An ID
  • Their processing timezone in relation to GMT

Adding entities via the API

Like DSTS, you can add multiple entities via a programatic loop. The (POST) API URL is:

app.augmentedinsights.cloud//api/v1/entity

Pass JSON like this:

{
  "entity": "care-home-01",
  "processing_tz": 0
}

Which will respond with something like this:

201 Created
Content-Location https://app.augmentedinsights.cloud/api/v1/entity/care-home-01
{
    "message": "Entity added",
    "uri": "https://app.augmentedinsights.cloud/api/v1/entity/care-home-01"
}

Now that you have entities and DSTs in the system you can add data via the raw-data-batch API. Notes on that are here.