Resource Tables Explained

https://baosystems.atlassian.net/wiki/spaces/SOL/pages/3407740929/Resource+Tables+Explained


Resource Tables

Resource tables in DHIS2 are a set of tables that are used internally during the analytics table generation process. These tables help improve the performance of the analytics process by pre-aggregating certain pieces of information. Resource tables do not contain analytics data per se; rather, they contain metadata which helps in the generation of the analytics tables. Examples include period-related tables, organisational unit hierarchy tables, and category option combo tables.

Analytics Table Generation

The process of analytics table generation involves taking raw data values and transforming them into a format that's more conducive to fast querying and analysis. This is done by creating aggregated data tables that take the raw data and summarise it at various levels, such as by month, organizational unit, data element, and so on.

Here's how resource tables come into play:

  1. Period Tables: These are used to store various period types, like daily, monthly, quarterly, etc. They help to quickly determine which periods are relevant for a given analysis, and help in fast date calculations.
  2. Organisation Unit Tables: These tables describe the hierarchical structure of organizational units. By pre-aggregating this data into a resource table, the system can rapidly determine relationships between different units (like which facilities are part of a given district).
  3. Category Option Combo Tables: In DHIS2, data can be disaggregated by different categories (like age, gender, etc.). These tables help to pre-calculate and manage all the possible combinations of these categories, making the analytics processing faster.

Analytics Process with Resource Tables

When the analytics table generation is triggered:

  1. DHIS2 first updates the resource tables, ensuring they contain the most recent metadata.
  2. Using these resource tables as a reference, the system then goes through the raw data and starts the aggregation process.
  3. As the system processes the raw data, it refers to the resource tables to determine things like:
    • What period a given data point belongs to.
    • Which organizational unit hierarchy level a particular data point should be aggregated to.
    • How data should be disaggregated based on category options.
  4. Once all raw data has been processed and aggregated with the help of resource tables, the final analytics tables are produced. These tables are highly optimized for querying and analysis.

Conclusion

In essence, resource tables in DHIS2 act as a foundation or "reference library" during the analytics table generation process. By pre-aggregating and organizing essential metadata in these tables, DHIS2 ensures that the heavy lifting of the analytics generation process is as efficient and fast as possible.