Skip to content
This repository was archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Chickneas/deprecate (#5)
Browse files Browse the repository at this point in the history
* Mark deprecated and add link to new COBie sample

* make a proper link to new sample

* add notes to deprecate this sample and link to point to new sample
  • Loading branch information
jchick-bentley authored Dec 2, 2021
1 parent dc1010c commit 7aaafb0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 45 deletions.
48 changes: 48 additions & 0 deletions DEPRECATEDREADME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DEPRECATED: iTwin Connector

This COBie Connector sample is deprecated. Please refer to the [New Connector Sample](https://github.com/iTwin/connector-samples)

This version of the readme includes the original documentation (below) for legacy purposes.

Please refer to the general topic about [How to Write A Connector](./WriteAConnector.md)

Special implementation details specific to the COBie Connector will be included below.

**COBie Connector**
As part of this [repository](https://github.com/imodeljs/imodel-connector-sample), an iTwin connector that synchronizes data from COBie sheets is provided as a sample. More information about the implementation of the sample can be found inside COBie Connector [readme](./cOBie-connector/README.md).

### Extract

In case of the COBie Connector, the cobie-extractor module present in this repository demonstrates how COBie sheet data can be extracted into a sqlite database.

**Provenance**

For COBie data, this sample connector uses a combination of sheet name and unique row name to map data into the iModel. See [updateElementClass](https://github.com/imodeljs/imodel-connector-sample/src/DataAligner.ts) function in the provided sample. When the identifier is provided to the synchronizer, it is stored inside the ExternalSourceAspect class, in the Identifier property.

**Change-detection**

In case of COBIE sheet data timestamps are not available. So in cases like this the connector will have to use some other means of recording and then comparing the state of the source data from run to run. If conversion is cheap, then the source data can be converted again and the results compared to the previous results, as stored in the iModel. In the COBIE case, a cryptographic hash of the source data is used to represent the source data. The hash is stored inside the external source aspect by the synchronizer.

The change-detection algorithm implemented is

- For each source data item:
- add source item's Id to the *source_items_seen* set
- Look in the mappings for the corresponding data in the iModel (element, aspect, model)
- If found,
- Detect if the source item's current data has changed. If so,
- Convert the source item to BIS data.
- Update the corresponding data in the iModel
- Else,
- Convert the source data to BIS data
- Insert the new data into the iModel
- Add the source data item's Id to the mappings

Infer deletions:

- For each source data item Id previously converted
- if item Id is not in *source_items_seen*
- Find the the corresponding data in the iModel
- Delete the data in the iModel
- Remove the the source data item's Id from the mappings

In case of COBie connector, the above algorithm implemented inside the [align method of DataAligner](https://github.com/imodeljs/itwin-connector-sample/src/DataAligner.ts)
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
# iTwin Connector
# DEPRECATED: iTwin Connector



Please refer to the general topic about [How to Write A Connector](./WriteAConnector.md)

Special implementation details specific to the COBie Connector will be included below.

**COBie Connector**
As part of this [repository](https://github.com/imodeljs/imodel-connector-sample), an iTwin connector that synchronizes data from COBie sheets is provided as a sample. More information about the implementation of the sample can be found inside COBie Connector [readme](./cOBie-connector/README.md).

### Extract

In case of the COBie Connector, the cobie-extractor module present in this repository demonstrates how COBie sheet data can be extracted into a sqlite database.

**Provenance**

For COBie data, this sample connector uses a combination of sheet name and unique row name to map data into the iModel. See [updateElementClass](https://github.com/imodeljs/imodel-connector-sample/src/DataAligner.ts) function in the provided sample. When the identifier is provided to the synchronizer, it is stored inside the ExternalSourceAspect class, in the Identifier property.

**Change-detection**

In case of COBIE sheet data timestamps are not available. So in cases like this the connector will have to use some other means of recording and then comparing the state of the source data from run to run. If conversion is cheap, then the source data can be converted again and the results compared to the previous results, as stored in the iModel. In the COBIE case, a cryptographic hash of the source data is used to represent the source data. The hash is stored inside the external source aspect by the synchronizer.

The change-detection algorithm implemented is

- For each source data item:
- add source item's Id to the *source_items_seen* set
- Look in the mappings for the corresponding data in the iModel (element, aspect, model)
- If found,
- Detect if the source item's current data has changed. If so,
- Convert the source item to BIS data.
- Update the corresponding data in the iModel
- Else,
- Convert the source data to BIS data
- Insert the new data into the iModel
- Add the source data item's Id to the mappings

Infer deletions:

- For each source data item Id previously converted
- if item Id is not in *source_items_seen*
- Find the the corresponding data in the iModel
- Delete the data in the iModel
- Remove the the source data item's Id from the mappings

In case of COBie connector, the above algorithm implemented inside the [align method of DataAligner](https://github.com/imodeljs/itwin-connector-sample/src/DataAligner.ts)
This COBie Connector sample is deprecated. Please refer to the [New Connector Sample](https://github.com/iTwin/connector-samples)

0 comments on commit 7aaafb0

Please sign in to comment.