1.1. Reporting
1.1.1. 作用
Reporting API是一种将来自多个来源的数字孪生数据聚合到一个统一格式和位置的工具。使用Reporting API,可以大大简化通过商业应用程序(如Power BI)或您自己的定制应用程序使用数据的过程。
1.1.2. 工作流程
首先已完成imodel的创建和转换过程
创建空的iModel Mapping
https://developer.bentley.com/apis/insights/operations/create-mapping/ 每个Mapping表示可以在报告中使用的数据表(组)的集合。在该Mapping下创建一个或多个组https://developer.bentley.com/apis/insights/operations/create-group/。组是由查询定义的iModel元素的集合
关于ECSql的学习资料:
https://www.itwinjs.org/learning/ecsql/
https://imodelconsole.bentley.com/ 如果初次尝试,query语句可以写为SELECT * FROM bis.physicalelement为每个组创建一个或多个组属性。这些是从iModel元素中提取的属性,以及在报告中如何识别这些属性。如果初次尝试,可以选用Yaw,Roll,Pitch这些3D元素肯定有的属性 https://developer.bentley.com/apis/insights/operations/create-groupproperty/
创建新Report https://developer.bentley.com/apis/insights/operations/create-report/ Report表示数据的集合。报表是多个映射Map的集合。使用报告API,您可以将一个或多个Map绑定给某个报告,以供某些应用程序(如Power BI)作为单个数据源使用
报告映射(Report Mapping) Mapping和Report的关系是多对多的。一个Report可以有多个Mapping,一个Mapping可以分配给多个Report。在生成报表数据时,我们的API将找到分配给该Report的所有Mapping,并从Mapping定义的每个数据源收集数据。
https://developer.bentley.com/apis/insights/operations/create-report-mapping/运行iModel提取 https://developer.bentley.com/apis/insights/operations/run-extraction/ 每次数据提取将运行链接到与iModel关联的所有Report的所有Mapping
确保提取已完成 https://developer.bentley.com/apis/insights/operations/get-extraction-status/ 注意,jobId即为上一接口返回值
通过可以访问新报告的Api密钥用户界面创建新的Api密钥。https://developer.bentley.com/apis/insights/api-keys/
使用生成的ApiKey将符合OData v4的应用程序连接到报告。备注:这里的用户名是OData,密码是Api密钥。
查看数据的方式 OData为微软发起的开放数据协议,ODataAPI可以与支持ODataV4协议和OAUTH2授权的工具和库一起使用。 数据查看有两种方式,一种列出报表的endpoint。该endpoint可以用作Excel或Power BI等应用程序中的OData的来源。第二种直接给给出结果
1 https://developer.bentley.com/apis/imodels-odata/operations/mapping-odata/
2 https://developer.bentley.com/apis/insights/operations/odata-entity/
注意输入的region,manifest,entityType为上一接口返回值结果
1.1.3. 更多详细说明及用例请参见
https://developer.bentley.com/apis/insights/overview/ https://developer.bentley.com/apis/insights/samples/
1.1.4. 最佳实践
https://medium.com/itwinjs/automate-your-digital-twin-e30b6f55801b