Bulk Importing Markdown Assets

Ango Hub supports importing Markdown files in bulk using a single JSON file.

Preparing the JSON

Your JSON file will need to be in the following format:

[
    {
        "externalId":"my_external_id_1",
        "data":"<div style='font-size:13px;font-weight:500;display:flex;'><div style='width:100px;color:gray'>Serial No</div>: 1</div>"
    },
    {
        "externalId":"my_external_id_2",
        "data":"<div style='font-size:13px;font-weight:500;display:flex;'><div style='width:100px;color:gray'>Serial No</div>: 1</div>"
    }
]

Your JSON will be a list of objects. Each object will be a single asset in Ango Hub, and will need to contain an externalId property and a data property. The externalId will be used by Ango Hub to identify your asset. The data is the Markdown content itself.

You will need to flatten your markdown to fit a single line, and to convert all double quotes contained within the markdown (") to single quotes (').

Failure to do so will result in the Markdown files not being imported correctly or at all.

We strongly recommend you ensure externalIDs are unique, or you may not be able to distinguish between some assets when exporting them, or when using pre-labels.

External IDs are one of the two ways used to identify assets on Ango Hub, together with the asset's file path. However, markdowns uploaded this way (embedded) have no file path.

Embedded markdowns are being directly uploaded and stored into Ango Hub's database as strings, where the file path would normally be.

This means that the only way to distinguish between embedded Markdowns is either through their data content, or by their externalIds. As such, if you upload two embedded markdowns with the same content and the same external ID, you will not be able to distinguish between them when obtaining the export.

You will still be able to distinguish between different labeling tasks, as Ango Hub assigns a unique ID to each task.

Ango Hub will not warn you if you upload more than one asset with the same externalIdand will continue to work as usual.

Uploading the JSON

From the UI

From your project's dashboard, enter the Assets tab (1), then click on the Add Data button (2). A dialog will appear. Enter the Upload Data URL tab (3) and drag and drop your JSON in the upload box (4).

Click on Upload to upload your markdown assets.

From the SDK

Using the upload_files_cloud()function, you may upload bulk Markdowns like so:

direct_json = [
   {
      "externalId": "1",
      "data": "<MARKDOWN CONTENTS HERE>"
   },
   {
      "externalId": "2",
      "data": "<MARKDOWN CONTENTS HERE>"
   }
]

res = ango_sdk.upload_files_cloud(
   project_id='<YOUR_PROJECT_ID>',
   assets=direct_json
)

Last updated