Table of content
- Inroduction
- Version Control
- Exporting Classes
- Exporting BI Analytics clases
- Exporting globals
Introduction.
In this article, we'll cover a quick start to Git development with the InterSystems Developer Community and version control practices when working with IRIS InterSystems. We'll cover scenarios where we need to export Interoperability classes, globals, and analytics elements such as cubes and dashboards. These scenarios encompass key version control practices with IRIS.
To get started, you'll need:
- Register and log in to GitHub
- Be a member of the intersystems-community organization on Git
Getting started with IRIS InterSystems is very simple!
Version control with IRIS is fundamentally no different from any other project. We make changes to files and commit them to the repository. With IRIS InterSystems, сhanges made in IRIS are not exported to the external file system automatically, we need specialized tools for that.
Let's start by creating a repository and uploading your code to it.
To get started, go to github.com and create an empty repository. You'll be prompted to name it, select privacy settings, and use the template intersystems-community/iris-interoperability-template (this is possible if you're part of the InterSystems Community organization).
- This template contains everything you need to quickly get started with IRIS and its core systems: interoperability classes, globals, and data classes for working with analytics. You can also use this template to follow along with me. -
Fill in the appropriate fields and click Create repository
Done! Now we have a repository. Next, we just need to clone it to our hard drive, build a Docker container with the IRIS image, and start coding.
Clone the repository to the file system. Then open Microsoft Visual Studio and navigate to the directory containing the code.
Next, we build our project.
docker compose build - -no-cache - -progress=plain
And then
docker compose up -d
That's it, the installation and launch of your project is complete.
Version control.
To commit your project changes to the repository, you need to check them out of the container and into the working directory. To track changes in IRIS, use the git-source-control application. It allows you to monitor the state of files within the IRIS filesystem without any additional configuration and check them out each time you make changes.
Our template already has the git-source-control package pre-installed, so we can see how it works and focus on version control. The package is installed in the iris.cls file. Note these lines:
zpm "install git-source-control"
do ##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension")
The first line is installing the application from InterSystems Package Manager or IMP (ex: ZPM). The second line sets the git-source-control application class: "SourceControl.Git.Extension" as an argument to the %Studio.SourceControl.Interface system class, which allows VSCode to communicate with the source control class. This configuration is done when building the container in the dockerfile or installer.cls, or in this case, in iris.cls.
Exporting classes.
Now let's try making some changes to our code and see what happens. We'll create a data cube for one of the tables provided in this template. To do this, enable analytics for the current namespace by running the following command in the console:
do EnableDeepSee^%SYS.cspServer("/csp/USER/")
After that, we go to the address Management Portal->Analytics->Architect and we will see this window:
Click New and fill in the fields in the form to create a new cube. For our cube, we'll use the dc.Demo.PostMessages data model.
This is approximately the result you should get.
Then we save and compile the new cube.
Let's go back to VSCode and see what has changed.
The new cube is uploaded to the file system exactly as we created it! It's that simple. Next, we'll modify one of the business production classes.
Go to IRIS and navigate to Management Portal->Interoperability->Configure->Production. There, we'll see the dc.Demo.RedditService business process running.
Let's make a change to the dc.Demo.RedditService class definition and assign it a category. Then click Apply.
We go to VSCode and see that the business process class has already been uploaded to our file system and contains all the changes made.
Now all we have to do is place the classes in the appropriate directories and commit them to the repository.
Exporting BI Analytics classes.
Next, we'll look at another method for exporting files using business analytics elements as an example. Recall the data cube we created based on Reddit messages. Let's create a pivot and dashboard to visualize the data and try to export it. To do this, go to IRIS and navigate to Analytics->Analyzer. Here, we have the RedditMessages data cube selected and the basic Count measure.
Drag the measure into the Measures field and save the resulting pivot as Reddit Messages Amount.
Next, let's create a dashboard to display the resulting pivot. Go to Management Portal -> User Portal. In the window that opens, click the plus sign and select Add Dashboard.
Next, fill in the dashboard name and click OK.
Then add the previously created widget to the dashboard and click OK.
Done! Very simple. We've started developing analytics. Now we need to export these elements. Unfortunately, the current version of IRIS and Git-Source-Control doesn't allow you to track changes to analytics classes, but we have another convenient tool for this task.
We'll use iris-bi-utils. This is a set of utilities for exporting or importing any classes from IRIS to your file system. The main difference from Git-Source-Control is that the latter automatically tracks class changes, while iris-bi-utils exports classes manually. Using the iris-bi-utils application, you can download any classes and elements contained within IRIS.
So, let's start by installing iris-bi-utils in your IRIS.
Run the command in the console.
zpm "install iris-bi-utils"
We then run the command to set the project root directory to store objects.
do ##class(BIInstruments.utils).workdir("/home/irisowner/dev/")
The following commands export the desired pivot and dashboard. Note the syntax of the exported class. The element name must be followed by its category and type: .pivot.DFI for the pivot and .dashboard.DFI for the dashboard.
do ##class(BIInstruments.export).export("Reddit Messages Amount.pivot.DFI")
do ##class(BIInstruments.export).export("Reddit overview.dashboard.DFI")
The files will be exported to the /dfi directory. This is where the bi analytics classes are stored.
We also place them in the appropriate directory and push the changes to the repository.
Exporting globals.
As a rule, we don't need to push global to the repository during development. Often, sensitive data is stored there, or the global size is too large. However, if necessary, they can always be exported to an external file system and committed to git using this method of %Library.Global class.
do ##class(%Library.Global).Export("NAMESPACE", "global.name, global.name1,....", “/path/and/outputFileName”)
This can also be done through the Management Portal. To do this, go to Management Portal->System Explorer->Globals. Select the desired global and click Export. The interface has a convenient search function. Exporting is possible to the file system or to a browser.
When exported, the global can be encoded using several variants of the most common
That's all, in this article we created a repository, looked at ways to exported business classes, analytics, and globals, and sent changes to the git repository.
Useful links for this article:
(1).jpg)
.png)
.png)
.png)