Ingesting basic datapoints

Overview

The Agent SDK has a method for each datapoint type that can be ingested to Formant.

The full list of method names for ingesting data is:

  • post_text
  • post_json
  • post_numeric
  • post_numericset
  • post_image
  • post_bitset
  • post_geolocation
  • post_battery
  • post_transform_frame

In each of these methods, the first argument is the stream name, and the subsequent arguments are the datapoint values you wish to post. For instance,

fclient.post_numeric("Numeric stream name", 1.0)

would post a numeric datapoint with value 1.0 to the stream named "Numeric stream name".

To see all methods on the Agent SDK and their signatures, see the Agent SDK Reference.

Example

For an example, check out the script which sends several datapoints to the Formant Agent:

from formant.sdk.agent.v1 import Client as FormantClient


if __name__ == "__main__":
    fclient = FormantClient()

    # Ingest text datapoint
    fclient.post_text("example.text", "Send text example processed")

    # Ingest numeric datapoint
    fclient.post_numeric("example.numeric", 3.0)

    # Ingest numericset datapoint, 'percent' and '%' units adds
    # additional donut visualization
    fclient.post_numericset(
        "example.numericset2",
        {
            "frequency": (998, "Hz"),
            "usage": (30, "percent"),
            "warp factor": (6.0, None),
        },
    )

    # Ingest bitset datapoint
    fclient.post_bitset(
        "example.bitset", {"standing": False, "walking": False, "sitting": True}
    )

    # Ingest geolocation datapoint
    fclient.post_geolocation("example.geolocation", 22.835, 33.631667)  # lat, long

    print("Successfully ingested datapoints.")

👋

If you notice an issue with this page or need help, please reach out to us! Use the 'Did this page help you?' buttons below, or get in contact with our Customer Success team via the Intercom messenger in the bottom-right corner of this page, or at [email protected].