Skip to main content
Developers can stream generic timeseries data from pre-recorded CSV files into a Lens by connecting a CSV File Reader data connector to the input data stream of a Lens. Prior to streaming CSV data to a lens, a developer should first upload their CSV file to the Archetype platform using the Files API. Upon uploading their CSV file, the developer will receive a file_id that identifies that file throughout the Newton Platform. For example, the bash command below demonstrates how to upload a local CSV file from your terminal to the Archetype platform using the Files API.
curl https://api.u1.archetypeai.app/v0.5/files \
  -H "Authorization: Bearer $ATAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@my_csv_data.csv"
Upon successful upload, you will receive a JSON response similar to:
{
  "is_valid":true
  "file_id":"my_csv_data.csv"
  "file_uid":"25081907c598752e7e71ef"
}
Like all data stream connectors, the CSV file reader can be identified and configured via the following stream type and stream config:
stream_type: csv_file_reader
stream_config:
  file_id: "your_csv_file_id.csv"
This can be passed to Newton as an event:
event:
  type: input_stream.set
  event_data:
    stream_type: csv_file_reader
    stream_config:
      file_id: "your_csv_file_id.csv"