# Collection Campaign Scripting

You can now use the Python client to grab the formatted results from either your (a) [unlabeled collection campaigns](broken://pages/-MQZGS5xFJn3GtC5dA8g#unlabeled-indexed-in-app-collections) in the UI or (b) more traditional Python client [collection campaign](https://legacy-docs.aquariumlearning.com/aquarium/python-sdk/code-snippets-and-examples/pages/-MQZGS5xFJn3GtC5dA8g#2.-collect-and-upload-your-data-python-client).

Full python client docs are [available here](https://aquarium-not-pypi.web.app/aquariumlearning/docs/#aquariumlearning.CollectionClient.get_unlabeled_results_for_issue), and a brief example follows.

```python
import aquariumlearning as al
import json

# Your issue must have been created under the Rare Scenario issue type
ISSUE_UUID = "..."

# Either the unlabeled dataset that you want to search through
# OR "" if you are querying the results of a Python-client-triggered
# collection campaign
UNLABELED_DATASET_NAME = "..."

OUTPUT_JSON = "..."

collection_client = al.CollectionClient()
collection_client.set_credentials(api_key="YOUR_API_KEY")

results = collection_client.get_unlabeled_results_for_issue(
    issue_uuid=ISSUE_UUID,
    unlabeled_dataset_name=UNLABELED_DATASET_NAME,
    # You can add the option retrigger_search=True to run the search
    # for the first time (or rerun)
)

print(f"{len(results)} results found")
with open(OUTPUT_JSON, "w") as f:
    json.dump(results, f)

```

A particular unlabeled result might look something like the following (note: this is for the bounding box objection detection task):

{% code lineNumbers="true" %}

```json
{
    "classifierScore": 0.8154874556308199,
    "collectionFrameId": 536914,
    "deviceId": "default_device",
    "images": [
      {
        "coordinateFrame": "img0",
        "dateCaptured": "2022-01-04T14:56:34.384042+00:00",
        "imageBoxes": [
          {
            "height": 39.599999999999994,
            "label": "car",
            "left": 741.18,
            "top": 168.83,
            "user__width": 51.07000000000005,
            "user__width_bucket": "medium",
            "uuid": "000008_8_1_gt",
            "width": 51.07000000000005,
            "windowId": 1641326258849
          },
          {
            "height": 16.580000000000013,
            "label": "dontcare",
            "left": 826.87,
            "top": 162.28,
            "user__width": 18.970000000000027,
            "user__width_bucket": "small",
            "uuid": "000008_8_2_gt",
            "width": 18.970000000000027,
            "windowId": 1641326258849
          },
        ],
        "image_url": "https://storage.googleapis.com/aquarium-public/kitti_2d_obj_train/image_2/000008.png",
        "preview_url": "https://storage.googleapis.com/aquarium-public/kitti_2d_obj_train/webp_images/000008.webp",
        "sensorId": "img0"
      }
    ],
    "issueVersion": 1,
    "labeled": false,
    "sampledElementId": "000008_8_2_gt",
    "similarityScore": 0.8673680939432816,
    "sortStatus": "UNSORTED",
    "sourceMetadata": {
      "source": "unlabeled_dataset",
      "source_dataset": "test_pca_diff.unlabeled_real_str"
    },
    "taskId": "000008_8"
  },

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://legacy-docs.aquariumlearning.com/aquarium/python-sdk/code-snippets-and-examples/collection-campaign-scripting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
