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

Update to the latest iModel.js version and document integration tests #2

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions COBie-connector/.gitignore
Original file line number Diff line number Diff line change
@@ -3,5 +3,4 @@
*.bim*
lib/
node_modules/
**/package-lock.json
.prettierrc
.env
5 changes: 5 additions & 0 deletions COBie-connector/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DO NOT SPECIFY AUTHENTICATION CREDENTIALS IN THIS FILE. It should only be used
# to configure registry sources.

registry=https://registry.npmjs.org/
@bentley:registry=https://registry.npmjs.org/
40 changes: 29 additions & 11 deletions COBie-connector/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# [COBie](https://en.wikipedia.org/wiki/COBie#:~:text=Construction%20Operations%20Building%20Information%20Exchange,COBie%20was%20designed%20by%20Dr.)

COBie is an international standard for building data exchange. Its most common use is in product data handover from construction to operations. The COBie specifications and guidelines capture industry knowledge and best practices. The COBie standards do not dictate what information is required for a specific project handover. That responsibility still lies with the owner. The COBie data model is a subset (“smart filter”) of the buildingSMART data model, more commonly known as IFC (Industry Foundation Classes). COBie is part of the openBIM movement to collaboratively design, build and operate buildings. It is also part of the UK Building Information Modelling (BIM) Task Group level 2 initiative. The most common representation of COBie is the COBie spreadsheet, but it is important to note that the data format can be represented in multiple ways according to the requirements and needs of the specific data transfer.
@@ -16,17 +15,36 @@ In the second phase, the COBie Connector reads the intermediary SQLite database

## How to Run It

You may find the sample COBie Excel data under COBie-extractor/extractor/input/*. [Sample Data Source](https://www.nibs.org/page/bsa_commonbimfiles)
You may find the sample COBie Excel data under `COBie-extractor/extractor/input/*`. [Sample Data Source](https://www.nibs.org/page/bsa_commonbimfiles)

1. Execute COBie-extractor (see how to inside [COBie-extractor/README.md](../COBie-extractor/README.md))
2. Move the output of COBie extractor (intermediary SQLite DB's) to `COBie-connector/test/assets/`
- Execute `sh transferdb` on Linux/WSL
3. Run "npm install"
4. Run "npm run build"
5. Run "npm run test:unit". The output [Snapshot iModel](https://www.itwinjs.org/learning/backend/accessingimodels/?term=snapsh#snapshot-imodels) will be at `COBie-connector/test/output/final.db`).
6. Run the connector against a live iModel, run `npm run test:integration`. It will test if the Connector updates the iModel data and schema.
- The provided Connector tests almost work right out of the box, but you'll need to configure it with your Context, iModel, and OIDC information. To do this, just create a .env file at the project root with the following:

```sh
###############################################################################
# This file contains secrets - don't commit or share it!
###############################################################################
TEST_USER_EMAIL=
TEST_USER_PASSWORD=

CLIENT_ID=
CLIENT_REDIRECT_URI=

# The CONTEXT to create the new iModel.
CONTEXT_ID=
```

1. Execute COBie-extractor (see see how to inside COBie-extractor/README.md)
2. Move the output of COBie extractor (intermediary SQLite DB's) to COBie-connector/test/assets/ (or execute "sh transferdb" if you are on Linux / WSL)
3. Run "npm run test:unit" (output iModel will be COBie-connector/test/output/final.db) This produces the iModel snapshot that can be used locally.
4. To run the connector against a live iModel, run "npm run build" and "npm run test:integration" that will test if the Connector updates iModel data and schema.
Note: You must set the environment variable imjs_config_dir = path/to/imodeljs-config (or the path to the directory that contains your default.json credential file) to successfully run the integration test.
Your CLIENT_ID and CLIENT_REDIRECT_URI should both come from the [iTwin Platform App registration](https://developer.bentley.com/my-apps) - be sure to create a "SPA" app with Visualization enabled!

## Architecture

Mapping of data into requires The COBie connector uses the following parts to map data from the intermediary database into an iModel.
Mapping of data into requires The COBie connector uses the following parts to map data from the intermediary database into an iModel.

### DataAligner (Reusable Parser)

@@ -35,7 +53,7 @@ It immediately creates the entity it encounters.

### DataFetcher

DataFetcher dynamically joins tables and return values from the intermediary SQLite database.
DataFetcher dynamically joins tables and return values from the intermediary SQLite database.

### EC Schema Generation

@@ -47,15 +65,15 @@ Notes:

### Configuration Files

**ElementTree.ts**: a dictionary that dictates the order in which partitions/models/elements should be created/updated.
**ElementTree.ts**: a dictionary that dictates the order in which partitions/models/elements should be created/updated.

**COBieElements.ts**: subclasses of EC Elements.

**COBieRelatedElements.ts**: subclasses of EC RelatedElement.

**COBieRelationships.ts**: subclasses of EC relationships.

**COBieSchemaConfig.ts**: configuration for schema mapping.
**COBieSchemaConfig.ts**: configuration for schema mapping.

## Walk-through

Loading