DocuGen
Challenge:
Many of us are probably familiar with the fact that after a Qlik Sense™ app has been developed, documentation is required to transfer the analysis to production. This process is time-consuming and requires several days of work to finally obtain a “piece of paper”. The documentation can be mandatory for both regulatory and operational reasons. Following the “Let’s Work Smarter” principle, you could automate exactly this process with DocuGen using Qlik™ Application Automation. This can save valuable time and give us the ability to transfer use cases into production even faster.
Idea:
It all started with this simple idea and a first prototype, built in Qlik™ Application Automation. Various Qlik™ Cloud Services blocks are used to extract the relevant metadata from the individual app (e.g. table definitions, sheets and visualizations, variables, measures and dimensions, etc.). This data is then stored in variables and once all the information has been collected it gets passed into a “Custom Code” block. This block uses Python 3.11 and creates a dynamic HTML file without external references. This means that the created HTML file remains transportable and does not require any external resources, as it contains all the necessary functions itself. Finally, the created HTML file is saved to MS Sharepoint.
Outcome:
This approach helps us to create standard documentation much faster on a daily basis (before, about 3-5 days; now ~30 minutes). In day-to-day work a BI specialist can now move analytical prototypes into production much faster for his customers and deliver even faster added value to business departments. There are BI specialists facing the same challenge, which is why a few Qlik™ team members were able to create a community project based on this idea. So, the documentation was extended with more functionalities, the documentation design was generalized and the code was rewritten.
Below, we present you this project prepared by Qlik™ specialists.
Content of the package:
The archive consists of only 4 files:
To import the Qlik™ Application Automation you need the DocuGen v(x).json file. This file contains the exported Qlik™ Application Automation workspace.
The “code” folder contains the code segments used if you want to customise the code for your needs.
- custom_code_block.py: This file contains the code that we use in the “Custom Code” blog in the automation.
- used_css.css: This file contains the CSS definition that we use in the “Variable – vCSS” blog in the automation and imports the style description for our HTML file. The definition is not minified in this file.
- used_js.js: This file contains the Java scripts that we use in our Python script (custom_code_block.py at the very end). The JavaScript is implemented in the Python code (last <script></script> section). It is important that ‘{‘ and ‘}’ are replaced with ‘{{‘ and ‘}}’ so that they are not evaluated in Python.
Installation:
1. Create a new blank Qlik™ Application Automation
2. Upload workspace (right click on canvas) à DocuGen v_(x)_.json
3. Creați o conexiune pentru SharePoint
a. scroll to the bottom and click on the “Create File on Microsoft SharePoint” Block that has a red border
b. click on the Connection tab and create a connection to your Microsoft SharePoint
c. după ce primiți informația „Connection is linked” o puteți utiliza făcând clic pe conexiunea creată. Fila conexiune ar trebui să își schimbe acum culoarea din roșu în negru.
d. after you receive the information “Connection is linked” you can use it by clicking on your created connection. The connection tab should now change its colour from red to black.
4. (optional) If you want to switch the number format from ‘comma’ to ‘point’ as decimal separator you can switch the value of the block named “Variable – vNumber Format” from ‘de’ to ‘us’. It’s the second block of the automation.
5. Now you can run the automation to generate your first documentation
Running the automation:
When you click on “Run” the automation gets executed. By default, the automation has configured “Run Mode: Manual”. It requires a few inputs for processing:
- Space – where the app is located (Personal doesn’t work)
- App name
- List of Sections that need to be documented (e.g. Data Model, Measures, Dimensions etc.)
- Screenshots (yes/no)
- List for type of sheets (e.g. Public, Community, Private)
Note
If you want to run the automation triggered (e.g. by REST call) it needs to me modified. We will post an example later to showcase this option.
Features:
This list showcases what DocuGen covers:
- General app information:
- app name, description, Id, Resource type, type of usage, owner, published, published time, space Id, has section access, is encrypted, create date, modified date, last reload time, app memory footprint, app reload peak RAM
- Data model:
- For every table it generates:
- title, number of rows, number of fields, number of key fields, is loose, comment, table size,
- table containing field name, number of distinct values, number of non-null values, tags, is hidden, is key, connected tables
- For every table it generates:
- Measures:
- For every measure it generates:
- title, label, description, Id, definition, expression, grouping, custom formatted, format type, format, color, tags
- For every measure it generates:
- Dimensions:
- For every dimension it generates:
- title, label, description, Id, definition, grouping, tags
- For every dimension it generates:
- Variables:
- For every variable it generates:
- title, Id, definition, comment, tags
- For every variable it generates:
- Sheets & Visualizations:
- list of sheets
- for every sheet it generates title, type, Id, description, grid resolution, sheet mode, list of used objects
- link to sheet
- list of objects on the sheet
- for every object on a sheet, it generates screenshot, type, Id, title, subtitle, footnote, color mode, color definition, dimensions, measures, link to object
- if the object is a container (layout container, tabbed container or normal container) it creates a list of all child objects containing the following information:
- type, Id, title, subtitle, footnote, color mode, color definition, dimensions, measures, link to object
- list of sheets
- Load Script:
- For every script section it generates:
- title, script
- For every script section it generates:
We hope this project can help you to also automize and minimize your documentation efforts.
For a demo about DocuGen, please watch the video below:
Article source: https://github.com/djaskowiak/
For information about Qlik™, click here: qlik.com.
For specific and specialized solutions from QQinfo, click here: QQsolutions.
In order to be in touch with the latest news in the field, unique solutions explained, but also with our personal perspectives regarding the world of management, data and analytics, click here: QQblog !