Azure-Samples / Azure-Samples/digital-twins-explorer
Import function unable to create twin for model that contains component
- Dominant language
- JavaScript
- Stars
- 215
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to use the ADT import function to do bulk creation of twins via excel file. The function works as expected for models without components, but I get the following error for models that include components.
> Error: Failed to create twins stp_AHU-Lobby
at https://explorer.digitaltwins.azure.net/static/js/main.69838216.chunk.js:1:288412
at c (https://explorer.digitaltwins.azure.net/static/js/2.75cc45df.chunk.js:2:7360360)
at Generator._invoke (https://explorer.digitaltwins.azure.net/static/js/2.75cc45df.chunk.js:2:7360148)
at Generator.E.forEach.e. [as next] (https://explorer.digitaltwins.azure.net/static/js/2.75cc45df.chunk.js:2:7360783)
at r (https://explorer.digitaltwins.azure.net/static/js/2.75cc45df.chunk.js:2:3050)
at s (https://explorer.digitaltwins.azure.net/static/js/2.75cc45df.chunk.js:2:3253)
and in the Output window:

This issue is seemingly the same as [this one](https://github.com/Azure-Samples/digital-twins-explorer/issues/187), which appears to be solved. However, in my case the problem persists for both the web-based version of ADT and a local instance.
There is no issue when creating the twin by hand (including for the example models below).
To reproduce, please use the models below and attached excel file. Thanks for your help!
```{
"@id": "dtmi:BDT:Air_Handling_Unit;1",
"@type": "Interface",
"displayName": "Air Handling Unit",
"contents": [
{
"@type": "Property",
"name": "name",
"displayName": "name",
"schema": "string",
"writable": true
},
{
"@type": "Component",
"name": "design_air_flow_rate",
"displayName": "design air flow rate",
"schema": "dtmi:BDT:Volume_Flow_Rate;1"
}
],
"@context": "dtmi:dtdl:context;2"
},
{
"@id": "dtmi:BDT:Volume_Flow_Rate;1",
"@type": "Interface",
"displayName": "Volume Flow Rate",
"contents": [
{
"@type": "Property",
"name": "unit",
"schema": {
"@type": "Enum",
"valueSchema": "string",
"displayName": "unit",
"enumValues": [
{
"name": "cubic_feet_per_minute",
"enumValue": "CFM"
},
{
"name": "liters_per_second",
"enumValue": "LPS"
},
{
"name": "gallons_per_minute",
"enumValue": "GPM"
}
]
},
"writable": true
},
{
"@type": "Property",
"name": "value",
"displayName": "value",
"schema": "double"
}
],
"@context": "dtmi:dtdl:context;2"
}
```
[bulkUpload_ahu_test.xlsx](https://github.com/Azure-Samples/digital-twins-explorer/files/8074500/bulkUpload_ahu_test.xlsx)
Contributor guide
Research direction
Start with the ADT import function in the web-based or local digital-twins-explorer instance and reproduce the failure using bulkUpload_ahu_test.xlsx and the component model definitions in the issue. Compare imports for models with and without components; done means the workbook creates the component-containing twin without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript
- Domain
- cloud, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100