Export HTML annotations

How to export HTML data and sample export formats.

Open this Colab for an interactive tutorial on exporting annotations.

Export JSON annotations

# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed 
export_params= {
  "attachments": True,
  "metadata_fields": True,
  "data_row_details": True,
  "project_details": True,
  "label_details": True,
  "performance_details": True
}

# You can set the range for last_activity_at and label_created_at. 
# For context, last_activity_at captures the creation and modification of labels, metadata, status, comments and reviews.
# Note: This is an AND logic between the filters, so usually using one filter is sufficient.

filters= {
  "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
  "workflow_status": "Done"
}

export_task = project.export_v2(params=export_params, filters=filters)
export_task.wait_till_done()

if export_task.errors:
  print(export_task.errors)

export_json = export_task.result
print("results: ", export_json)
labels = project.export_labels(download=True)

# Optionally, provide a date range as an optional parameter
# This will export only labels created between the supplied dates
# Date range can be formatted as "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss"
labels = project.export_labels(download=True, start="2022-09-28", end="2022-10-04")

Annotation export formats

Classification - Radio

{
  "feature_id": "cldnz8i9j00013b6jbip0hpfn",
  "name": "radio",
  "radio_answer": {
    "feature_id": "cldnz8i9j00003b6jaimfixs3",
    "name": "radio_1",
    "classifications": []
  }
}
{
  "featureId": "ckmuuwmp4000a3g68rmku827s",
  "schemaId": "ckmuuvs5p5nj40y629l1570bi",
  "title": "Is it daytime?",
  "value": "is_it_daytime?",
  "answer": {
    "featureId": "ckmuuwmp400093g68qof3hnt8",
    "schemaId": "ckmuuvs7u5njg0y629iiuc216",
    "title": "Yes",
    "value": "yes"
  }
}

Classification - Checklist

{
  "feature_id": "cldnz8iw500033b6jafid2v6v",
  "name": "checklist",
  "checklist_answers": [
    {
      "feature_id": "cldnz8iw400023b6jvsrgj2mx",
      "name": "checklist_1",
      "classifications": []
    },
    {
      "feature_id": "cldnz8j6400053b6jkayk82z9",
      "name": "checklist_2",
      "classifications": []
    }
  ]
}
{
  "featureId": "cl89b1d3g00013b6k8388lpol",
  "schemaId": "cl89b186w0xg107xkga0fdf4j",
  "scope": "global",
  "title": "Attributes",
  "value": "attributes",
  "answers": [
    {
      "featureId": "cl89b1dln00033b6ky6j9cb62",
      "schemaId": "cl89b186w0xg407xk4yvkf3o8",
      "title": "Crowded",
      "value": "crowded"
    },
    {
      "featureId": "cl89b1e3z00063b6kll28e559",
      "schemaId": "cl89b186w0xg607xk8ogy304a",
      "title": "Foot traffic",
      "value": "foot_traffic"
    },
    {
      "featureId": "cl89b1ekd000a3b6kbiipqxi7",
      "schemaId": "cl89b186w0xg807xke5kg606w",
      "title": "Vehicle traffic",
      "value": "vehicle_traffic"
    }
  ]
}

Classification - Free-form text

{
  "feature_id": "cldnz8mp800063b6j3rc62rea",
  "name": "free_text",
  "text_answer": {
    "content": "production"
  }
}
{
    "featureId": "ckmuzkkhw000a3g68xegct9wz",
    "schemaId": "ckmuzjtfa64bq0y839bn8ci4l",
    "title": "Free-form text",
    "value": "free-form_text",
    "answer": "Correct text answer"
}

Sample project export

{
  "data_row": {
    "id": "clgvcafgs00280746af51fini",
    "global_key": "new_global_key",
    "row_data": "new_row_data_url",
    "details": {
      "dataset_id": "clgvcaetv088l071chv5cans8",
      "created_at": "2023-04-24T21:17:36.000+00:00",
      "updated_at": "2023-05-03T15:23:03.000+00:00",
      "last_activity_at": "2023-05-03T15:23:03.000+00:00",
      "created_by": "[email protected]"
    }
  },
  "media_attributes": {
    "mime_type": "text/plain"
  },
  "attachments": [],
  "metadata_fields": [],
  "projects": {
    "clgvcahpb01jq07yz0xns24dl": {
      "name": "HTML Import Annotation Demo",
      "labels": [
        {
          "label_kind": "Default",
          "version": "1.0.0",
          "id": "clgvcbh1w00kq14zk482ffoni",
          "label_details": {
            "created_at": "2023-04-24T21:18:26.000+00:00",
            "updated_at": "2023-04-24T21:18:26.000+00:00",
            "created_by": "[email protected]",
            "reviews": []
          },
          "performance_details": {
            "seconds_to_create": 0,
            "seconds_to_review": 20,
            "skipped": false
          },
          "annotations": {
            "objects": [],
            "classifications": [
              {
                "feature_id": "clgvcbh1900kc14zkmchcm1vp",
                "name": "text_html",
                "text_answer": {
                  "content": "sample text"
                }
              },
              {
                "feature_id": "clgvcbh1900kd14zksg73zodz",
                "name": "checklist_html",
                "checklist_answers": [
                  {
                    "feature_id": "clgvcbh1900ke14zk660j5scq",
                    "name": "first_checklist_answer",
                    "classifications": []
                  },
                  {
                    "feature_id": "clgvcbh1a00kf14zkmnswk3cf",
                    "name": "second_checklist_answer",
                    "classifications": []
                  }
                ]
              },
              {
                "feature_id": "clgvcbh1a00kg14zkdcfv01i5",
                "name": "radio_html",
                "radio_answer": {
                  "feature_id": "clgvcbh1a00kh14zk4tfbfp5u",
                  "name": "second_radio_answer",
                  "classifications": []
                }
              },
              {
                "feature_id": "clgvcbh1a00ki14zkzuc9xi86",
                "name": "nested_checklist_question",
                "checklist_answers": [
                  {
                    "feature_id": "clgvcbh1a00kj14zk8whf6uqf",
                    "name": "first_checklist_answer",
                    "classifications": [
                      {
                        "feature_id": "clgvcbh1a00kk14zk82bcnw5s",
                        "name": "sub_checklist_question",
                        "checklist_answers": [
                          {
                            "feature_id": "clgvcbh1a00kl14zk4zwwe7p7",
                            "name": "first_sub_checklist_answer",
                            "classifications": []
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "feature_id": "clgvcbh1a00km14zk29bz64p6",
                "name": "nested_radio_question",
                "radio_answer": {
                  "feature_id": "clgvcbh1a00kn14zkbghls5te",
                  "name": "first_radio_answer",
                  "classifications": [
                    {
                      "feature_id": "clgvcbh1a00ko14zkt08wjylu",
                      "name": "sub_radio_question",
                      "radio_answer": {
                        "feature_id": "clgvcbh1a00kp14zkupjk5xvn",
                        "name": "first_sub_radio_answer",
                        "classifications": []
                      }
                    }
                  ]
                }
              }
            ],
            "relationships": []
          }
        }
      ],
      "project_details": {
        "ontology_id": "clgvcahhq01eo070ugwzvfb07",
        "batch_id": "85c37200-e2e5-11ed-a1e0-d1f28f3467f6",
        "priority": 5,
        "consensus_expected_label_count": 1,
        "workflow_history": []
      }
    }
  }
}

Sample model run export

{
  "data_row": {
    "id": "clfcvahul0184076233pr16n1",
    "global_key": "sample_html_2.html",
    "row_data": "https://storage.googleapis.com/labelbox-datasets/html_sample_data/sample_html_2.html",
    "details": {
      "dataset_id": "clfcvafns0uol07ytccchb0v7",
      "created_at": "2023-03-17T18:22:12.000+00:00",
      "updated_at": "2023-03-17T18:22:12.000+00:00",
      "created_by": "[email protected]"
    }
  },
  "media_attributes": {
    "mime_type": "text/html"
  },
  "attachments": [],
  "metadata_fields": [],
  "experiments": {
    "a12b5bb0-eb35-0fda-c4ec-91b04f98fb69": {
      "name": "HTML_model_run_2e38d656-3960-43c4-9611-7dec29e40808",
      "runs": {
        "a12b5bb1-44e8-0446-557a-854bf1422102": {
          "name": "iteration 1",
          "run_data_row_id": "70b1059d-58c1-467c-aa28-a7d613a35acd",
          "labels": [
            {
              "label_kind": "Default",
              "version": "1.0.0",
              "id": "clgvcr9ue00mi14zkbmvui6zj",
              "annotations": {
                "objects": [],
                "classifications": [
                  {
                    "feature_id": "1473a998-5387-41bf-98de-b9b9b3562474",
                    "name": "radio_question",
                    "radio_answer": {
                      "feature_id": "d53dd9b9-ea25-49cd-9cba-b3cdc2a7472f",
                      "name": "first_radio_answer",
                      "classifications": []
                    }
                  },
                  {
                    "feature_id": "170a5f1f-0844-49ad-917a-4ef113245d9c",
                    "name": "nested_checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "fcce85ad-065a-4cdf-b0a5-4dbbc3a9b574",
                        "name": "first_checklist_answer",
                        "classifications": [
                          {
                            "feature_id": "3abaa6b2-042c-4384-9bae-2dd667cbb55e",
                            "name": "sub_checklist_question",
                            "checklist_answers": [
                              {
                                "feature_id": "ed38eb35-c1ef-4522-9c83-8e9e1ba69698",
                                "name": "first_sub_checklist_answer",
                                "classifications": []
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "feature_id": "1a866325-a33f-4bd8-baa6-a33585204bcc",
                    "name": "checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "9606fe2a-0ebe-450f-84e7-fbb3f1c80e61",
                        "name": "second_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "d9951d7c-ba8b-4863-a0a4-6985ce131bb1",
                        "name": "third_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "e4a191e2-c2d3-457c-85b2-9e85cdf362d9",
                        "name": "first_checklist_answer",
                        "classifications": []
                      }
                    ]
                  },
                  {
                    "feature_id": "47b8936b-8801-4589-9ee1-49d82d599ba3",
                    "name": "nested_radio_question",
                    "radio_answer": {
                      "feature_id": "dcd93caf-7f20-45ca-a8d4-2294588d4824",
                      "name": "first_radio_answer",
                      "classifications": [
                        {
                          "feature_id": "81b6054b-a46f-4855-8453-349675a74b86",
                          "name": "sub_radio_question",
                          "radio_answer": {
                            "feature_id": "c259226f-cbec-475b-9030-f6b2cfe32bf8",
                            "name": "first_sub_radio_answer",
                            "classifications": []
                          }
                        }
                      ]
                    }
                  },
                  {
                    "feature_id": "ee6af094-a98f-47a9-a06f-1e05c2edc3a3",
                    "name": "free_text",
                    "text_answer": {
                      "content": "sample text"
                    }
                  }
                ],
                "relationships": []
              }
            }
          ],
          "predictions": [
            {
              "label_kind": "Default",
              "version": "1.0.0",
              "id": "clgvcr9ue00mi14zkbmvui6zj",
              "annotations": {
                "objects": [],
                "classifications": [
                  {
                    "feature_id": "0f50d117-2ed9-4c4e-b32c-eaa8eba21e86",
                    "name": "checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "fc73eb59-fe70-4eba-829a-c17f759d4167",
                        "name": "first_checklist_answer",
                        "classifications": []
                      }
                    ]
                  },
                  {
                    "feature_id": "763672d9-877e-4924-ab5f-beed9df6e40e",
                    "name": "free_text",
                    "text_answer": {
                      "content": "sample text"
                    }
                  },
                  {
                    "feature_id": "98983985-964c-407a-9cb2-177ae4796b42",
                    "name": "nested_checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "b6685a20-2801-42a3-900a-1eadd9c3c3f5",
                        "name": "first_checklist_answer",
                        "classifications": [
                          {
                            "feature_id": "5a390d76-987e-477f-812b-bfc9650fac79",
                            "name": "sub_checklist_question",
                            "checklist_answers": [
                              {
                                "feature_id": "d2bfd1f5-2f51-43b9-b563-a53874839e79",
                                "name": "first_sub_checklist_answer",
                                "classifications": []
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "feature_id": "b7721e86-09bc-4ec0-872c-db307822dfd1",
                    "name": "radio_question",
                    "radio_answer": {
                      "feature_id": "039a3712-9f8f-413b-9b91-4cfa0dcbb556",
                      "name": "first_radio_answer",
                      "classifications": []
                    }
                  },
                  {
                    "feature_id": "f65a6d37-61c5-49c0-9f6d-a7f2be7b5ae4",
                    "name": "nested_radio_question",
                    "radio_answer": {
                      "feature_id": "1a1c6a12-06af-444a-a063-ff4f3ef0946b",
                      "name": "first_radio_answer",
                      "classifications": [
                        {
                          "feature_id": "05739178-798b-4be4-8fb6-dbc52fbd2b44",
                          "name": "sub_radio_question",
                          "radio_answer": {
                            "feature_id": "16ebecce-faf6-428b-901d-103c01088c01",
                            "name": "first_sub_radio_answer",
                            "classifications": []
                          }
                        }
                      ]
                    }
                  }
                ],
                "relationships": []
              }
            }
          ]
        }
      }
    }
  }
}