Elia Group PoweApps Hackathon 2022

Soulaiman Ghanem
Elia Group Engineering Blog
6 min readJul 6, 2022

--

Our Team

The Business Need

Elia Group is applying the BIM methodology in building new infrastructure projects. A key software component in BIM architecture is the Common Data Environment (CDE). CDE is seen as a database and a documentation system in the ACE industry. It’s the single source of truth for all project participants and all engineering disciplines. CDE contains all project-related data. 3D models, images from the sites, schedules, contacts, and bills of materials are examples of the data that is stored, tracked and versioned in a CDE.

At Elia, we continue to automate and integrate many data sources and make the project managers' and engineers' life easier! Therefore, We have an idea to integrate the CDE data into Microsoft Teams. There is no need to jump between multiple apps to share and collaborate.

We will use the Microsoft Power Apps platform to develop a PoC. The proposed solution will connect to the CDE via its REST API. We can then retrieve a list of projects and their documents, and present them in MS Teams. Mircosoft Power Apps will help us to build the solution with almost no coding!

The Approach

Since we are developing the solution on the Elia hackathon day, we are going to use the test CDE system. Unfortunately, we don’t have an API subscription for the test environment. However, we have mocked the CDE API and imported some data from the CDE.

1) Mocking The API

As mentioned before, a CDE is a specialized Document Management System (DMS) for construction. We will mock part of the real CDE API:

  1. Projects are the key objects in the API. A project here defines an infrastructure project like building an offshore wind farm.
  2. Each project has many documents. A document is an object that has many properties like creation date, created user…
  3. The document is more of a logical container for files. however, files (like 3D plans or PDF files) are the artefacts to upload, download and share within the team.
  4. The last object to be mocked is the member. Projects member could be internal employees or external stakeholders.

For each of the mentioned objects, we created an endpoint using the tool Mockapi.io

Mockapi.io can also generate some dummy data for the API responses. It has also a cool feature to generate real-life data like names or addresses using Faker!

The next tool is Postman, we created a new collection that calls the mock API endpoints. We will use the new collection as input for connecting the API in the Power Apps platform later.

The third step is optional. We would like to generate Swagger documentation for the mocked API. The easiest way to do that is to use the online Swagger editor. However, we need to convert the Postman collection first.

After conversion, we can paste the generated Open API specification into the editor and the documentation is rendered!

Now we have a running API with some dummy data, let’s move to the Power Apps part!

2) Configuring The Data connector

Before using the CDE API in Power Apps, we need to configure the connection to the API first.

Under the Dataverse menu, we should select “Custom connections”. Then, select “new custom connection”. As shown in the underneath screenshot, we have several choices to create a new connection. Since we have already created a Postman collection, we will select the “import a Postman collection” option.

Next is to name the connection and import the collection JSON file.

Power Apps platform has a step-by-step wizard to configure the connection. The good thing about importing a Postman collection is that many configurations will be imported automatically from the JSON file!

We will leave the “Security” step since we applied no authentication in our mock CDE API.

“Definition” is the interesting part. All HTTP methods from the Postman collection are listed here. However, we need to do a manual step to make the connection works properly.

We should provide a sample response for the API operations. This way Power Apps learns more about our API and the data it provides. This is important to make the API’s entities available in IntelliSense while building the app.

We need to provide a sample response for each GET operation. If we have to send an object in POST or PUT operation, then we should do the same in the “Request” section.

We can easily follow the next steps and our custom connection should appear in the “connection” menu with the status “connected”.

3) Testing The Connection

To test all the previous steps, we will create a blank Canvas app. Let’s add a “data table” controller. It will pop up a data source window to select. Under “Connectors”, we will select our CDE Mock API.

Next is to correct the data source directly using the formula. We can map the table to show all projects as shown below.

Then we will add the fields of the projects. As mentioned before, providing a sample response when configuring the connection, will help us to map the API operation’s return object to the table columns.

Let’s now preview the app

The Final App!

During the Hackathon, we enhanced our initial idea and built a concrete use case, where a BIM manager can query the status of some documents and remind the reviewer to finish the task. The final name is “Easy-BIM Remindery” ;)

Homepage
Send reminder page
The Pitch

Link to Code -> SouliCool/PowerAppsCdeApi (github.com) (configuration files and not the final app)

--

--