# Reports generation

While LIBSAFE offers some already made reports plus the possibility of deploying custom reports, there are cases in which the organization could prefer to create its own reports and explore LIBSAFE data. When this is needed, you can request LIBNOVA the configuration of METABASE, that is not part of the LIBSAFE package, but can interact with it.

{% hint style="info" %}
Please refer to the [METABASE user guide](https://www.metabase.com/docs/latest/users-guide/start.html) for additional information on using it.
{% endhint %}

After it has been deployed, you can access it in your **Advanced options -> Reports** section

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FOIroc8gZoNmmtadchqOk%2Fimage.png?alt=media\&token=93f2f85f-b971-4174-ad0a-d8acd3761f92)

Using METABASE you can create reports or data exports in three main ways:&#x20;

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FiLGxQ5PQtQA0jZBjfhYc%2Fimage.png?alt=media\&token=bd979e37-08fb-4f3e-934f-ff9d3d51f757)

* Making "Simple questions", that are going to display a table data,&#x20;
* Making "Custom questions" that allow you to perform join operations and advanced filters visually or
* Making "Native queries" that imply using SQL queries to build your reports.

{% hint style="info" %}
For advanced queries, knowing SQL is desirable. [This is a very good guide](https://www.w3schools.com/sql/sql_intro.asp) to start understanding its basic principles.
{% endhint %}

Let's start making a simple report:

### Files by file format sample report

Go to **Ask a question** -> **Custom question**

Select the LIBSAFE database, or the Tenants database if you are running in a multi-tenancy environment:

<img src="https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FznjYQBvnvP9zkahi1n3m%2Fimage.png?alt=media&#x26;token=3aa35b8a-75dc-405e-be6f-09ef8231967b" alt="" data-size="original">

As you want to create a file format (for your files) report, you'll need to load the table that includes the preserved files, that is **Object Files**

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FDH8T62NqqADUHqTa5j7s%2Fimage.png?alt=media\&token=a5a74e5f-ead0-4f24-8a8c-2d0ef8aaae64)

As you are not interested in all information of your files, you can select the Columns option to just leave the ones that you need:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2F73CcZSHrbJIplasA7E7j%2Fimage.png?alt=media\&token=027b0be8-35ff-446b-8b39-fa826e078ccf)

If you are in doubt of the information you need, you can always select **Visualize**, and Metabase will present you a table with a few records, so you can understand how information is organized.

In this case, when you Visualize your data, you will see something interesting:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2F9Ia0Lbid7b3JoAHTDWVh%2Fimage.png?alt=media\&token=8096fdb1-835e-4981-b048-7abbf40e9cb7)

LIBSAFE is using a relational data model to organize your information, so it is keeping the file format associated to each file in another table. For instance, for the file with id=1, the file format is 806. On the other hand, what you need is a PRONOM format in your report, but what PRONOM id corresponds to a given FileDataFormat is stored in another database table. This way, you need then to **combine** two tables or, in SQL terms, to do a **Join**.

Select the Join Data option and METABASE will show you other tables. In there, select Data Formats, and then, how to relate both tables: In your case,&#x20;

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2Fb7rbY1SkaVyJZ0CyGiCg%2Fimage.png?alt=media\&token=ceec0102-ee38-4716-b8a0-2f2dff4df348)

You can always use the **Visualize** option to see if you are doing it right. In this case, we are as, as you can see, we are now relating each file with its PRONOM format using the Join:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FzVQDSqeBcIcN6ZjrPF5a%2Fimage.png?alt=media\&token=768ad836-a275-4729-a616-65e37cbd95f9)

In the same way, you don't need all columns there, so we are leaving only the ones we are interested in:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2Fe91pt4k0Wq9lol26i27R%2Fimage.png?alt=media\&token=4fee5c00-d6a2-4f85-8f35-4139ef09d1da)

Now we are finally getting a table that includes, for each of your files, their PRONOM format.

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2Fce2vxHOJFK8bCwY7pyBe%2Fimage.png?alt=media\&token=63f955c5-e837-466f-bfc5-5fe33141fbab)

At this stage, you may just want to export and download your results in Excel, CSV or json format. To do it, you can just select the small cloud icon at the bottom right area of the interface:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FbmPy2GsryIQ1Ckb4cEhy%2Fimage.png?alt=media\&token=1045061a-666d-4731-83f6-d531d88ef1de)

You may also want to save your query for future use, selecting **Save** (saved queries can then be used as building blocks for dashboards),&#x20;

You may just want want to know the number of distinct files formats, selecting **Summarize** and then selecting **Number of distinct values of**:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FMxZCtJhPYuPQ4xkhfgza%2Fimage.png?alt=media\&token=f2e5c10f-7662-40ea-a404-141063dc3d34)&#x20;

And then your UIDFormat.

Or you could want to build a visualization with your data. In this case, select Visualization, and then select the Summarize option. In your case, you are interested in the count and unique formats, so you select:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FtDCvGxSjxwfHzR559fFI%2Fimage.png?alt=media\&token=389556ff-da8e-48c8-9996-0fa23816ddd4)

If you then select Visualize, you will be able to see the data table:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FWaOiD12te1uDFmEzOaYu%2Fimage.png?alt=media\&token=812fc5aa-5ae2-49c8-ae6c-2b6fd61000b9)

That you can then convert to a Pie chart selecting it from the available ones:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FjKZL0PllwxGvfpxcBj18%2Fimage.png?alt=media\&token=3844cc81-a6f3-464d-aee8-5509b84aa19c)

When you select it, you will get something close to this:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FyxtbkIpPpP3fy3WXyan9%2Fimage.png?alt=media\&token=9e3aac07-acdd-4539-be41-6efef093b172)

As you can see, the file format is not sorted. Let's improve it: Go back to your query, and add a **Sort** criteria:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2FICzAnjnzV9MzL01962vx%2Fimage.png?alt=media\&token=5269465a-abc8-4bfa-87f4-2742f6a2d9cb)

This way, you can continue refining your query until you get what you need.

When you have saved it, you can create a dashboard and include it inside. Select the + icon in the top bar, and create a new dashboard:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2F7qXdJ4PgeUn3mWzh3yKr%2Fimage.png?alt=media\&token=ec456bde-683d-4a67-91ad-ddfcb943f539)

and start adding your saved questions selecting the **pencil icon** and then the **+ icon**:

![](https://1027461619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjAMV2uTheGBDHeGhtb%2Fuploads%2F1NR8t9Pe2stRzsMgxsS8%2Fimage.png?alt=media\&token=1ea6c49e-1db0-4286-b1e8-82827bc0aeb1)
