本地设置CSV数据适配器

发布于 2025-02-04 08:43:15 字数 935 浏览 2 评论 0原文

我正在尝试设置数据可视化扩展程序,以基于此示例将来自CSV文件中的数据用于传感器:

https://forge.autodesk.com/en/docs/dataviz/dataviz/v1/develoders_guide/advanced_topics/csv_adapter/文件夹服务器\ Gateways \ CSV中的默认Hyperion-1.csv。我还需要添加/更改其他一些设置吗?

它在Chrome Console中显示以下错误:

”

我在.env文件中为CSV具有这些设置。

此处Synthetic-data文件夹。 “在此处输入图像描述”

I am trying to set up the Data Visualization extension to use data from csv file for the sensors based on this example:

https://forge.autodesk.com/en/docs/dataviz/v1/developers_guide/advanced_topics/csv_adapter/

So the csv data I am trying to use is the default Hyperion-1.csv in folder server\gateways\csv. Do I need to add/change some other settings as well?

It is showing the following error in Chrome console:

Error message in chrome console

I have these settings for the csv in .env file.enter image description here

And these in devices.json in server\gateways\synthetic-data folder.enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赏烟花じ飞满天 2025-02-11 08:43:15

我刚刚采取了以下步骤来启用CSV数据适配器,该适配器似乎可以正常工作:

  1. 克隆回购:git克隆https://github.com/autodesk-forge/forge-dataviz-dataviz-iot-reference-app-
  2. 安装依赖项:npm install
  3. 创建 server/env_template 的副本,然后将其重命名为 server/.env
  4. 修改<的内容em> server/.env ,评论所有初始env。变量,毫无注入CSV相关的Env。 vars,并设置其相应的值:
# FORGE_CLIENT_ID=
# FORGE_CLIENT_SECRET=
# FORGE_ENV=AutodeskProduction
# FORGE_API_URL=https://developer.api.autodesk.com
# FORGE_CALLBACK_URL=http://localhost:9000/oauth/callback
# 
# FORGE_BUCKET=
# ENV=local
# ADAPTER_TYPE=local


## Please uncomment the following part if you want to connect to Azure IoTHub and Time Series Insights
## Connect to Azure IoTHub and Time Series Insights
# ADAPTER_TYPE=azure
# AZURE_IOT_HUB_CONNECTION_STRING=
# AZURE_TSI_ENV=
# 
## Azure Service Principle
# AZURE_CLIENT_ID=
# AZURE_APPLICATION_SECRET=
# AZURE_TENANT_ID=
# AZURE_SUBSCRIPTION_ID=
#
## Path to Device Model configuration File
# DEVICE_MODEL_JSON=
## End - Connect to Azure IoTHub and Time Series Insights

## Please uncomment the following part if you want to use a CSV file as the time series provider
ADAPTER_TYPE=csv
CSV_MODEL_JSON=server/gateways/synthetic-data/device-models.json
CSV_DEVICE_JSON=server/gateways/synthetic-data/devices.json
CSV_FOLDER=server/gateways/csv/
CSV_DATA_START=2011-02-01T08:00:00.000Z
CSV_DATA_END=2011-02-20T13:51:10.511Z
CSV_DELIMITER="\t"
CSV_LINE_BREAK="\n"
CSV_TIMESTAMP_COLUMN="time"
CSV_FILE_EXTENSION=".csv"
## End - Please uncomment the following part if you want to use a CSV file as the time series provider
  1. 将应用程序设置为“本地”:env = local npm run dev

在这些步骤成功运行之后,但是您会发现其他错误,因为服务器/网关/CSV 文件夹仅包含单个传感器的数据(Hyperion-1)。

顺便提一句。我一直在开发一个替代数据示例应用程序,该应用程序的目的更简单,更易于重复使用: https://github.com/petrbroz/forge-iot-extensions-demo (使用 https://github.com/petrbroz/forge-iot-extensions 在引擎盖下)。

I've just taken the following steps to enable the CSV data adapter which seemed to work fine:

  1. Clone the repo: git clone https://github.com/Autodesk-Forge/forge-dataviz-iot-reference-app
  2. Install dependencies: npm install
  3. Create a copy of server/env_template and rename it to server/.env
  4. Modify the contents of server/.env, commenting out all the initial env. variables, uncommenting the CSV-related env. vars, and setting their corresponding values:
# FORGE_CLIENT_ID=
# FORGE_CLIENT_SECRET=
# FORGE_ENV=AutodeskProduction
# FORGE_API_URL=https://developer.api.autodesk.com
# FORGE_CALLBACK_URL=http://localhost:9000/oauth/callback
# 
# FORGE_BUCKET=
# ENV=local
# ADAPTER_TYPE=local


## Please uncomment the following part if you want to connect to Azure IoTHub and Time Series Insights
## Connect to Azure IoTHub and Time Series Insights
# ADAPTER_TYPE=azure
# AZURE_IOT_HUB_CONNECTION_STRING=
# AZURE_TSI_ENV=
# 
## Azure Service Principle
# AZURE_CLIENT_ID=
# AZURE_APPLICATION_SECRET=
# AZURE_TENANT_ID=
# AZURE_SUBSCRIPTION_ID=
#
## Path to Device Model configuration File
# DEVICE_MODEL_JSON=
## End - Connect to Azure IoTHub and Time Series Insights

## Please uncomment the following part if you want to use a CSV file as the time series provider
ADAPTER_TYPE=csv
CSV_MODEL_JSON=server/gateways/synthetic-data/device-models.json
CSV_DEVICE_JSON=server/gateways/synthetic-data/devices.json
CSV_FOLDER=server/gateways/csv/
CSV_DATA_START=2011-02-01T08:00:00.000Z
CSV_DATA_END=2011-02-20T13:51:10.511Z
CSV_DELIMITER="\t"
CSV_LINE_BREAK="\n"
CSV_TIMESTAMP_COLUMN="time"
CSV_FILE_EXTENSION=".csv"
## End - Please uncomment the following part if you want to use a CSV file as the time series provider
  1. Run the app with ENV set to "local": ENV=local npm run dev

After these steps the app is running successfully, however you'll get some other errors because the server/gateways/csv folder only contains data for a single sensor (Hyperion-1).

Btw. I've been working on an alternative DataViz sample app that aims to be simpler and easier to reuse: https://github.com/petrbroz/forge-iot-extensions-demo (which uses https://github.com/petrbroz/forge-iot-extensions under the hood).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文