Přeskočit obsah
For the complete DHIS2 documentation index, see llms.txt.

Analytika

Analytika

To access analytical, aggregated data in DHIS2 you can work with the analytics resource. The analytics resource is powerful as it lets you query and retrieve data aggregated along all available data dimensions. For instance, you can ask the analytics resource to provide the aggregated data values for a set of data elements, periods and organisation units. Also, you can retrieve the aggregated data for a combination of any number of dimensions based on data elements and organisation unit group sets.

/api/analytics

Parametry požadavku databázového dotazu

Prostředek pro analýzu umožňuje určit řadu parametrů dotazu:

Tabulka: Parametry databázového dotazu

Parametr dotazu Požadované Popis Možnosti (nejprve výchozí)
dimenze Ano Rozměry a položky dimenzí, které mají být načteny, se opakují pro každou. Libovolná dimenze
filtr Ne Filtry a položky filtru, které se mají použít na dotaz, opakují se pro každý z nich. Libovolná dimenze
aggregationType Ne Typ agregace, který se má použít v procesu agregace. SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | LAST | LAST_AVERAGE_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX
measureCriteria Ne Filtry pro data / opatření. EQ | GT | GE | LT | LE
preAggregationMeasureCriteria Ne Filtry pro data / opatření použité před agregací. EQ | GT | GE | LT | LE
startDate Ne Počáteční datum pro časové období. Bude použit jako filtr. Nelze použít společně s dimenzí období nebo s filtrem. Datum
endDate Ne Koncové datum pro časové období. Bude použit jako filtr. Nelze použít společně s dimenzí období nebo s filtrem. Datum
skipMeta Ne Vyloučí část metadat odpovědi (zlepšuje výkon). false | true
skipData Ne Vyloučí datovou část odpovědi. false | true
skipRounding Ne Přeskočí zaokrouhlování hodnot dat, tj. poskytuje úplnou přesnost. false | true
hierarchyMeta Ne Do metadat zahrňte názvy předků organizačních jednotek a cesty hierarchie organizačních jednotek. false | true
ignoreLimit Ne Ignorujte limit max. 50 000 záznamů v odpovědi - používejte opatrně. false | true
tableLayout Ne Pro odpověď použijte prostý zdroj dat nebo rozložení tabulky. false | true
hideEmptyRows Ne Skryje v odpovědi prázdné řádky, použitelné, pokud je rozvržení tabulky true. false | true
hideEmptyColumns Ne Skryje v odpovědi prázdné sloupce, použitelné, pokud je rozvržení tabulky true. false | true
showHierarchy Ne Zobrazí úplnou cestu hierarchie organizačních jednotek spolu s názvem organizační jednotky. false | true
includeNumDen Ne Zahrnuje čitatele a jmenovatele použitého k výpočtu hodnoty v odpovědi. false | true
includeMetadataDetails Ne Zahrnuje podrobnosti o metadatech do odpovědi na nezpracovaná data. false | true
displayProperty Ne Vlastnost k zobrazení pro metadata. NÁZEV | KRÁTKÝ NÁZEV
outputIdScheme Ne Schéma identifikátoru použité pro položky metadat v odpovědi na dotaz. Přijímá identifikátor, kód nebo atributy. UID | UUID | CODE | NAME | ATTRIBUTE:<ID>
outputOrgUnitIdScheme Ne Schéma identifikátoru používané pro položky metadat v odpovědi na dotaz. Tento parametr přepíše "outputIdScheme" speciálně pro organizační jednotky. Přijímá identifikátor, kód nebo atributy. UUID | CODE | NAME | ATTRIBUTE:<ID>
outputDataElementIdScheme Ne Schéma identifikátoru používané pro položky metadat v odpovědi na dotaz. Tento parametr přepíše "outputIdScheme" konkrétně pro datové prvky. Přijímá identifikátor, kód nebo atributy. UUID | CODE | NAME | ATTRIBUTE:<ID>
inputIdScheme Ne Schéma identifikátoru, které se má použít pro položky metadat v požadavku na dotaz, může být identifikátor, kód nebo atributy. UID | CODE | ATTRIBUTE:<ID>
approvalLevel Ne Zahrnuje data, která byla schválena alespoň do dané úrovně schválení, odkazuje na identifikátor úrovně schválení. Identifikátor úrovně schválení
relativePeriodDate Ne Datum použité jako základ pro relativní období. Datum.
userOrgUnit Ne Explicitně definujte uživatelské organizační jednotky k použití, přepíše organizační jednotky přidružené k aktuálnímu uživateli, více identifikátorů lze oddělit středníkem. Identifikátory organizační jednotky.
sloupce Ne Dimenze, které se použijí jako sloupce pro rozložení tabulky. Jakákoli dimenze (musí být dimenze dotazu)
řádky Ne Dimenze, které se použijí jako řádky pro rozložení tabulky. Jakákoli dimenze (musí být dimenze dotazu)
řazení Ne Zadejte pořadí řádků na základě hodnoty. ASC | DESC
timeField Ne Časové pole, na kterém se má založit agregace událostí. Platí pouze pro datové položky událostí. Může to být předdefinovaná volba nebo ID atributu nebo datového prvku s typem hodnoty založené na čase. EVENT_DATE | ENROLLMENT_DATE | INCIDENT_DATE | DUE_DATE | COMPLETED_DATE | CREATED | LAST_UPDATED | <Attribute ID> | <Data element ID>
orgUnitField Ne The organisation unit field to base event aggregation on. Applies to event data items only. Can be the ID of an attribute or data element with the Organisation unit value type. The default option is specified as omitting the query parameter. <Attribute ID> | <Data element ID> | REGISTRATION | ENROLLMENT | OWNER_AT_START | OWNER_AT_END
enhancedConditions Ne Povolit rozšířené podmínky pro dimenze / filtry false | true

The dimension query parameter defines which dimensions should be included in the analytics query. Any number of dimensions can be specified. The dimension parameter should be repeated for each dimension to include in the query response. The query response can potentially contain aggregated values for all combinations of the specified dimension items.

Parametr filtr určuje, které dimenze mají být použity jako filtry pro data získaná v analytickém dotazu. Lze zadat libovolný počet filtrů. Parametr filter by se měl opakovat pro každý filtr, který se má v dotazu použít. Filtr se od dimenze liší tím, že dimenze filtru nebudou součástí obsahu odpovědi dotazu a že agregované hodnoty v odpovědi budou sbaleny na dimenze filtru. Jinými slovy, data v odpovědi budou agregována na dimenze filtru, ale filtry nebudou zahrnuty jako dimenze ve skutečné odpovědi. Jako příklad můžete pro dotaz na určité datové prvky filtrované podle období a organizačních jednotek použít následující adresu URL:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&filter=pe:2014Q1;2014Q2
  &filter=ou:O6uvpzGd5pu;lc3eMKXaEfw

The aggregationType query parameter lets you define which aggregation operator should be used for the query. By default, the aggregation operator defined for data elements included in the query will be used. If your query does not contain any data elements but does include data element groups, the aggregation operator of the first data element in the first group will be used. The order of groups and data elements is undefined. This query parameter allows you to override the default and specify a specific aggregation operator. As an example, you can set the aggregation operator to "count" with the following URL:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2014Q1&dimension=ou:O6uvpzGd5pu
  &aggregationType=COUNT

The measureCriteria query parameter lets you filter out ranges of data records to return. You can instruct the system to return only records where the aggregated data value is equal, greater than, greater or equal, less than or less or equal to certain values. You can specify any number of criteria on the following format, where criteria and value should be substituted with real values:

/api/analytics?measureCriteria=criteria:value;criteria:value

As an example, the following query will return only records where the data value is greater or equal to 6500 and less than 33000:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014
  &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&measureCriteria=GE:6500;LT:33000

Similar to measureCriteria, the preAggregationMeasureCriteria query parameter lets you filter out data, only before aggregation is performed. For example, the following query only aggregates data where the original value is within the criteria defined:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014
  &dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw&preAggregationMeasureCriteria=GE:10;LT:100

The startDate and endDate parameters can be used to specify a custom date range to aggregate over. When specifying a date range you can not specify relative nor fixed periods as dimension or filter. The date range will filter the analytics response. You can use it like this:

/api/analytics.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=ou:ImspTQPwCqd&startDate=2018-01-01&endDate=2018-06-01

In order to have the analytics resource generate the data in the shape of a ready-made table, you can provide the tableLayout parameter with true as value. Instead of generating a plain, normalized data source, the analytics resource will now generate the data in a table layout. You can use the columns and rows parameters with dimension identifiers separated by semi-colons as values to indicate which ones to use as table columns and rows. The column and rows dimensions must be present as a data dimension in the query (not a filter). Such a request can look like this:

/api/analytics.html?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU&dimension=pe:2014Q1;2014Q2
  &dimension=ou:O6uvpzGd5pu&tableLayout=true&columns=dx;ou&rows=pe

The order parameter can be used for analytics resource to generate ordered data. The data will be ordered in ascending (or descending) order of values. An example request for ordering the values in descending order is:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:LAST_12_MONTHS
  &dimension=ou:O6uvpzGd5pu&order=DESC

Rozměry a položky

DHIS2 features a multi-dimensional data model with several fixed and dynamic data dimensions. The fixed dimensions are the data element, period (time) and organisation unit dimension. You can dynamically add dimensions through categories, category option group sets, organisation unit group sets, data element group sets and organisation unit group sets. The table below displays the available data dimensions in DHIS2. Each data dimension has a corresponding dimension identifier, and each dimension can have a set of dimension items:

Tabulka: Dimenze a položky dimenzí

Dimenze ID dimenze Položky dimenze
Datové prvky, indikátory, metriky rychlosti vykazování datových souborů, operandy datových prvků, programové indikátory, datové prvky programu, atributy programu, pravidla ověřování dx Datový prvek, indikátor, metrika rychlosti vykazování datové sady, operand datového prvku, indikátor programu, identifikátory atributů programu, klíčové slovo DE_GROUP- <group-id> , IN_GROUP- <group-id> , použití <dataelement-id> . <optioncombo-id> pro operandy datových prvků, <program-id> . <dataelement-id> pro datové prvky programu, <program-id> . <attribute-id> pro atributy programu, <validationrule-id> pro výsledky ověření.
Období (čas) pe Období ISO a relativní období, viz "formát data a období"
Hierarchie organizačních jednotek ou Identifikátory organizační jednotky a klíčová slova USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL- <level> a OU_GROUP- <group-id>
Kombinace možností kategorií co Category option combo identifiers (omit to get all items)
Kombinace možností atributů ao Kombinované identifikátory možností kategorie (vynechejte, chcete-li získat všechny položky)
Kategorie <category id> Identifikátory možností kategorií (vynechejte, chcete-li získat všechny položky)
Sady skupin datových prvků <group set id> Identifikátory skupiny datových prvků (vynechejte, chcete-li získat všechny položky)
Sady skupin organizačních jednotek <group set id> Identifikátory skupiny organizačních jednotek (vynechejte, chcete-li získat všechny položky)
Sady skupin možností kategorie <group set id> Identifikátory skupiny možností kategorie (vynechejte, chcete-li získat všechny položky)

Při navrhování analytických dotazů není nutné si uvědomovat, které objekty se používají pro různé dynamické dimenze. Úplný seznam dynamických dimenzí můžete získat na této adrese URL ve webovém rozhraní API:

/api/dimensions

If you want to retrieve only the dimensional items for a given dynamic dimension you can use the example below. Pagination is disabled by default. It can be enabled by adding the pagination parameter paging=true to the URL.

/api/dimensions/J5jldMd8OHv/items?paging=true

The /dimensions API also provides an endpoint where the clients can get the recomendations for a given set of dimensions. For example:

/api/33/dimensions/recommendations?fields=id&dimension=dx:fbfJHSPpUQD

In the example above, the client will receive back all the Categories that are configured as Data dimensions and associated (through data sets and category combos) with the data element fbfJHSPpUQD. In addition, all *Organization Unit Group Set*s that are configured as Data dimensions will also (and always) be returned as part of the response.

The endpoint supports multiple data elements. If one wishes to send multiple data elements, they should be separated by ;. For example:

/api/33/dimensions/recommendations?fields=id&dimension=dx:fbfJHSPpUQD;JuTpJ2Ywq5b

Note

This endpoint returns only dimensions that can be read by the current logged user. It will check if the current user can read the data or the metadata of the respective recommended dimension. Non-authorized dimensions are omitted from the list.

The base URL to the analytics resource is /api/analytics. To request specific dimensions and dimension items you can use a query string on the following format, where dim-id and dim-item should be substituted with real values:

/api/analytics?dimension=dim-id:dim-item;dim-item&dimension=dim-id:dim-item;dim-item

As illustrated above, the dimension identifier is followed by a colon while the dimension items are separated by semi-colons. As an example, a query for two data elements, two periods and two organisation units can be done with the following URL:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=pe:2016Q1;2016Q2&dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw

To query for data broken down by category option combinations instead of data element totals you can include the category dimension in the query string, for instance like this:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=co&dimension=pe:201601&dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw

When selecting data elements you can also select all data elements in a group as items by using the DE_GROUP-<id> syntax:

/api/analytics?dimension=dx:DE_GROUP-h9cuJOkOwY2
  &dimension=pe:201601&dimension=ou:O6uvpzGd5pu

When selecting data set reporting rates, the syntax contains a data set identifier followed by a reporting rate metric:

/api/analytics?dimension=dx:BfMAe6Itzgt.REPORTING_RATE;BfMAe6Itzgt.ACTUAL_REPORTS
  &dimension=pe:201601&dimension=ou:O6uvpzGd5pu

To query for program data elements (of tracker domain type) you can get those by specifying the program for each data element using the <program-id>.<dataelement-id> syntax:

/api/analytics.json?dimension=dx:eBAyeGv0exc.qrur9Dvnyt5;eBAyeGv0exc.GieVkTxp4HH
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

To query for program attributes (tracked entity attributes) you can get those by specifying the program for each attribute using the <program.id>.<attribute-id> syntax:

/api/analytics.json?dimension=dx:IpHINAT79UW.a3kGcGDCuk6;IpHINAT79UW.UXz7xuGCEhU
  &dimension=pe:LAST_4_QUARTERS&dimension=ou:ImspTQPwCqd

To query for organisation unit group sets and data elements you can use the following URL. Notice how the group set identifier is used as a dimension identifier and the groups as dimension items:

/api/analytics?dimension=Bpx0589u8y0:oRVt7g429ZO;MAs88nJc9nL
  &dimension=pe:2016&dimension=ou:ImspTQPwCqd

To query for data elements and categories you can use this URL. Use the category identifier as a dimension identifier and the category options as dimension items:

/api/analytics?dimension=dx:s46m5MS0hxu;fClA2Erf6IO&dimension=pe:2016
  &dimension=YNZyaJHiHYq:btOyqprQ9e8;GEqzEKCHoGA&filter=ou:ImspTQPwCqd

To query using relative periods and organisation units associated with the current user you can use a URL like this:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=pe:LAST_12_MONTHS&dimension=ou:USER_ORGUNIT

When selecting organisation units for a dimension you can select an entire level optionally constrained by any number of boundary organisation units with the LEVEL-<level> syntax. Boundary refers to a top node in a sub-hierarchy, meaning that all organisation units at the given level below the given boundary organisation unit in the hierarchy will be included in the response, and is provided as regular organisation unit dimension items. The level value can either be a numerical level or refer to the identifier of the organisation unit level entity. A simple query for all org units at level three:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016&dimension=ou:LEVEL-3

A query for level three and four with two boundary org units can be specified like this:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016
  &dimension=ou:LEVEL-3;LEVEL-4;O6uvpzGd5pu;lc3eMKXaEf

When selecting organisation units you can also select all organisation units in an organisation unit group to be included as dimension items using the OU_GROUP-<id> syntax. The organisation units in the groups can optionally be constrained by any number of boundary organisation units. Both the level and the group items can be repeated any number of times:

/api/analytics?dimension=dx:fbfJHSPpUQD&dimension=pe:2016
  &dimension=ou:OU_GROUP-w0gFTTmsUcF;OU_GROUP-EYbopBOJWsW;O6uvpzGd5pu;lc3eMKXaEf

You can utilize identifier schemes for the metadata part of the analytics response with the outputIdScheme property like this. You can use ID, code and attributes as identifier scheme:

/api/analytics?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &dimension=pe:2017Q1;2017Q2&dimension=ou:O6uvpzGd5pu&outputIdScheme=CODE

Níže je uvedeno několik věcí, na které je třeba dávat pozor při používání analytických zdrojů.

  • Data elements, indicator, data set reporting rates, program data elements and program indicators are part of a common data dimension, identified as "dx". This means that you can use any of data elements, indicators and data set identifiers together with the "dx" dimension identifier in a query.

  • For the category, data element group set and organisation unit group set dimensions, all dimension items will be used in the query if no položky rozměrů jsou specifikovány.

  • For the period dimension, the dimension items are ISO period identifikátory a/nebo relativní období. Podívejte se prosím do sekce above called "Date and period format" for the period format and dostupná relativní období.

  • For the organisation unit dimension, you can specify the items to be organizační jednotku nebo dílčí jednotky organizační jednotky associated with the user currently authenticated for the request pomocí klíčů USER_ORGUNIT nebo USER_ORGUNIT_CHILDREN jako položek, respectively. You can also specify organisation unit identifiers directly, or a combination of both.

  • For the organisation unit dimension, you can specify the organisation hierarchy level and the boundary unit to use for the request on the format LEVEL-<level>-<boundary-id>; as an example LEVEL-3-ImspTQPwCqd implies all organisation units below the given boundary unit at level 3 in the hierarchy.

  • For the organisation unit dimension, the dimension items are the organisation units and their sub-hierarchy - data will be aggregated for all organisation units below the given organisation unit in the hierarchy.

  • You cannot specify dimension items for the category option combination dimension. Instead, the response will contain the items which are linked to the data values.

Dimenze dx

The dx dimension is a special dimension which can contain all of the following data types.

Tabulka: Typy rozměrů dat dx

Typ Syntaxe Popis Zdroj dat
Indikátor <indicator-id> Identifikátor indikátoru. Agregovaná data
Skupina indikátorů IN_GROUP-<indicatorgroup-id> Klíčové slovo následované identifikátorem skupiny indikátorů. Do odpovědi zahrne všechny indikátory ve skupině. Agregovaná data
Datový prvek <dataelement-id> Identifikátor datového prvku. Agregovaná data
Skupina datových prvků DE_GROUP-<dataelementgroup-id> Klíčové slovo následované identifikátorem skupiny datových prvků. Do odpovědi zahrne všechny datové prvky ve skupině. Agregovaná data
Operand datového prvku <dataelement-id>.<categoryoptcombo-id>.<attributeoptcombo-id> Identifikátor datového prvku následovaný jedním nebo oběma kombinacemi možností kategorie a identifikátorem kombinace možností atributů. Zástupný znak "*" lze použít k označení libovolné hodnoty kombinace možností. Identifikátor kombinace možností atributu lze zcela vynechat. Agregát dat
Datová sada <dataset-id>.<reporting-rate-metric> Identifikátor souboru dat následovaný metrikou četnosti přehledů. Může být REPORTING_RATE | REPORTING_RATE_ON_TIME | ACTUAL_REPORTS | ACTUAL_REPORTS_ON_TIME | EXPECTED_REPORTS. Registrace úplnosti datové sady
Datový prvek programu <program-id>.<dataelement-id> Identifikátor programu následovaný identifikátorem datového prvku. Čte z událostí v rámci zadaného programu. Akce z daného programu
Indikátor programu <programindicator-id> Identifikátor indikátoru programu. Čte z událostí z programu spojených s identifikátorem programu. Události z programu ukazatele programu
Výsledek ověření <validationrule-id> Identifikátor ověřovacího pravidla. Bude zahrnovat porušení ověřovacích pravidel pro ověřovací pravidlo, vyžaduje, aby byly generovány a uchovány výsledky ověření. Výsledky ověření

Items from all of the various dx types can be combined in an analytics request. An example looks like this:

/api/analytics.json
  ?dimension=dx:Uvn6LCg7dVU;BfMAe6Itzgt.REPORTING_RATE;IpHINAT79UW.a3kGcGDCuk6
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

Syntaxi skupiny lze použít i s jakoukoli jinou položkou. Příklad vypadá takto:

/api/analytics.json
  ?dimension=dx:DE_GROUP-qfxEYY9xAl6;IN_GROUP-oehv9EO3vP7;BfMAe6Itzgt.REPORTING_RATE
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

Data element operands can optionally specify attribute option combinations and use wildcards e.g. to specify all category option combination values:

/api/analytics.json
  ?dimension=dx:Uvn6LCg7dVU.*.j8vBiBqGf6O;Uvn6LCg7dVU.Z4oQs46iTeR
  &dimension=pe:LAST_12_MONTHS&filter=ou:ImspTQPwCqd

Tip

A great way to learn how to use the analytics API is to use the DHIS2 Data Visualizer web app and create a pivot table. You can play around with pivot tables using the various dimensions and items and click Download > Plain data source > JSON to see the resulting analytics API calls in the address bar of your web browser.

Formáty odpovědí

The analytics response containing aggregate data can be returned in various representation formats. As usual, you can indicate interest in a specific format by appending a file extension to the URL, through the Accept HTTP header or through the format query parameter. The default format is JSON. The available formats and content-types are listed below.

  • json (application/json)

  • jsonp (application/javascript)

  • xml (application/xml)

  • csv (application/csv)

  • html (text/html)

  • html+css (text/html)

  • xls (application/vnd.ms-excel)

As an example, to request an analytics response in XML format you can use the following URL:

/api/analytics.xml?dimension=dx:fbfJHSPpUQD
  &dimension=pe:2016&dimension=ou:O6uvpzGd5pu;lc3eMKXaEfw

Odpověď JSON bude vypadat takto:

{
  "headers": [
    {
      "name": "dx",
      "column": "Data",
      "meta": true,
      "type": "java.lang.String"
    },
    {
      "name": "pe",
      "column": "Period",
      "meta": true,
      "type": "java.lang.String"
    },
    {
      "name": "value",
      "column": "Value",
      "meta": false,
      "type": "java.lang.Double"
    }
  ],
  "height": 4,
  "metaData": {
    "pe": [
      "2016Q1",
      "2016Q2"
    ],
    "ou": [
      "ImspTQPwCqd"
    ],
    "names": {
      "2016Q1": "Jan to Mar 2016",
      "2016Q2": "Apr to Jun 2016",
      "FbKK4ofIv5R": "Measles Coverage <1 y",
      "ImspTQPwCqd": "Sierra Leone",
      "eTDtyyaSA7f": "Fully Immunized Coverage"
    }
  },
  "rows": [
    [
      "eTDtyyaSA7f",
      "2016Q2",
      "81.1"
    ],
    [
      "eTDtyyaSA7f",
      "2016Q1",
      "74.7"
    ],
    [
      "FbKK4ofIv5R",
      "2016Q2",
      "88.9"
    ],
    [
      "FbKK4ofIv5R",
      "2016Q1",
      "84.0"
    ]
  ],
  "width": 3
}

Odpověď představuje tabulku rozměrových dat. Pole záhlaví poskytuje přehled o tom, které sloupce jsou v tabulce obsaženy a co obsahují. Vlastnost sloupec zobrazuje identifikátor rozměru sloupce, nebo pokud sloupec obsahuje míry, slovo "Hodnota". Vlastnost meta je pravdivá, pokud sloupec obsahuje položky dimenze, nebo nepravdivá, pokud sloupec obsahuje míru (agregované hodnoty dat). Vlastnost jméno je podobná vlastnosti sloupce, s tím rozdílem, že v případě, že sloupec obsahuje míru, zobrazuje slovo "hodnota". Vlastnost type udává typ třídy Java pro hodnoty sloupce.

The height and width properties indicate how many data columns and rows are contained in the response, respectively.

The metaData periods property contains a unique, ordered array of the periods included in the response. The metaData ou property contains an array of the identifiers of organisation units included in the response. The metaData names property contains a mapping between the identifiers used in the data response and the names of the objects they represent. It can be used by clients to substitute the identifiers within the data response with names in order to give a more meaningful view of the data table.

Pole rows obsahuje rozměrovou tabulku dat. Obsahuje sloupce s položkami dimenze (identifikátory objektů nebo období) a sloupec s agregovanými hodnotami dat. Výše uvedená příkladová odpověď obsahuje sloupec s údaji/indikátory, sloupec s periodou a sloupec s hodnotou. První sloupec obsahuje identifikátory ukazatelů, druhý obsahuje identifikátory období ISO a třetí obsahuje hodnoty agregovaných dat.

Omezení a validace

There are several constraints to the input parameters you can provide to the analytics resource. If any of the constraints are violated, the API will return a 409 Conflict response and a response message looking similar to this:

{
  "httpStatus": "Conflict",
  "httpStatusCode": 409,
  "status": "ERROR",
  "message": "Only a single indicator can be specified as filter",
  "errorCode": "E7108"
}

The httpStatus and httpStatusCode fields indicate the HTTP status and status code per the HTTP specification. The messsage field provides a human-readable description of the validation error. The errorCode field provides a machine-readable code which can be used by clients to handle validation errors. The possible validation errors for the aggregate analytics API are described in the table below.

Chybový kód Zpráva
E7100 Parametry dotazu nemohou mít hodnotu null
E7101 Musí být zadána alespoň jedna dimenze
E7102 Musí být zadána alespoň jedna položka dimenze dat nebo položka dimenze sady datových skupin
E7103 Dimenze nelze zadat jako dimenzi a filtr současně
E7104 Musí být zadáno alespoň jedno období jako dimenze nebo filtr nebo začátek a data
E7105 Období a datum zahájení a ukončení nelze určit současně
E7106 Datum zahájení nesmí být po datu ukončení
E7107 U sazeb hlášení nelze určit datum zahájení a ukončení
E7108 Jako filtr lze zadat pouze jeden indikátor
E7109 Jako filtr lze zadat pouze jednu četnost vykazování
E7110 Kombinace možností kategorie nelze zadat jako filtr
E7111 Dimenze nelze zadat více než jednou
E7112 Četnost hlášení lze zadat pouze společně s dimenzemi typu
E7113 Přiřazené kategorie nelze určit, pokud nejsou zadány datové prvky
E7114 Přiřazené kategorie lze zadat pouze společně s datovými prvky, nikoli s indikátory nebo četností hlášení
E7115 Datové prvky musí být hodnoty a typu agregace, které umožňují agregaci
E7116 Výrazy indikátoru nemohou obsahovat cyklické odkazy
E7117 Je-li výstupní formát DATA_VALUE_SET, je třeba zadat datovou dimenzi „dx“
E7118 Pokud je výstupní formát DATA_VALUE_SET, musí být zadána dimenze období 'pe'
E7119 Je-li výstupní formát DATA_VALUE_SET, je třeba zadat dimenzi organizační jednotky 'ou'
E7120 Uživatel nemá povoleno prohlížet organizační jednotku
E7121 Uživatel nemá povoleno číst data pro objekt
E7122 Úroveň schválení dat neexistuje
E7123 Aktuální uživatel je omezen dimenzí, ale nemá přístup k žádným položkám dimenze
E7124 Dimenze je v dotazu přítomna bez jakýchkoli platných možností dimenze
E7125 Identifikátor dimenze neodkazuje na žádnou dimenzi
E7126 Sloupec musí být v dotazu přítomen jako dimenze
E7127 Řádek musí být v dotazu uveden jako dimenze
E7128 Sada výsledků dotazu překročila maximální limit
E7129 Program je zadán, ale neexistuje
E7130 Fáze programu je zadána, ale neexistuje
E7131 Dotaz se nezdařil, pravděpodobně proto, že vypršel časový limit dotazu

Formát sady datových hodnot

The analytics dataValueSet resource allows for returning aggregated data in the data value set format. This format represents raw data values, as opposed to data which has been aggregated along various dimensions. Exporting aggregated data as regular data values is useful for data exchange between systems when the target system contains data of finer granularity compared to what the destination system is storing.

Jako příklad lze v cílovém systému určit indikátor, který shrne data pro více datových prvků a importuje tato data pro jeden datový prvek v cílovém systému. Jako další příklad lze agregovat data shromážděná na úrovni organizační jednotky 4 v cílovém systému na úroveň 2 a importovat tato data do cílového systému.

Ze zdroje dataValueSet můžete načíst data v surovém formátu sady datových hodnot:

/api/analytics/dataValueSet

Jsou podporovány následující reprezentace prostředků:

  • json (application/json)

  • xml (application/xml)

When using the data value set format, exactly three dimensions must be specified as analytics dimensions with at least one dimension item each:

  • Data (dx)

  • Období (pe)

  • Organizační jednotka (ou)

Jakákoli jiná dimenze bude ignorována. Filtry budou použity jako u běžných analytických požadavků. Lze zadat jakýkoli typ datové dimenze, včetně indikátorů, datových prvků, operandů datových prvků, datových sad a indikátorů programu.

Příklad požadavku, který agreguje data pro určité ukazatele, období a organizační jednotky a vrací je jako běžné hodnoty dat v XML, vypadá takto:

api/analytics/dataValueSet.xml?dimension=dx:Uvn6LCg7dVU;OdiHJayrsKo
  &dimension=pe:LAST_4_QUARTERS&dimension=ou:lc3eMKXaEfw;PMa2VCrupOd

A request which aggregates data for data element operands and uses CODE as output identifier scheme looks like the below. When defining the output identifier scheme, all metadata objects part of the response are affected:

api/analytics/dataValueSet.json?dimension=dx:fbfJHSPpUQD.pq2XI5kz2BY;fbfJHSPpUQD.PT59n8BQbqM
  &dimension=pe:LAST_12_MONTHS&dimension=ou:ImspTQPwCqd&outputIdScheme=CODE

Při použití schémat identifikátorů založených na atributech pro export hrozí riziko vzniku duplicitních datových hodnot. Pro účely ladění lze použít logický parametr dotazu duplicatesOnly, který vrací pouze duplicitní hodnoty dat. Tuto odpověď lze použít k vyčištění duplicit:

api/analytics/dataValueSet.xml?dimension=dx:Uvn6LCg7dVU;OdiHJayrsKo
  &dimension=pe:LAST_4_QUARTERS&dimension=ou:lc3eMKXaEfw&duplicatesOnly=true

Formát surových dat

The analytics rawData resource allows for returning the data stored in the analytics data tables without any aggregation being performed. This is useful for clients which would like to perform aggregation and filtering on their own without having to denormalize data in the available data dimensions themselves.

/api/analytics/rawData

Jsou podporovány následující reprezentace prostředků:

  • json (application/json)

  • csv (application/csv)

This resource follows the syntax of the regular analytics resource. Only a subset of the query parameters are supported. Additionally, a startDate and endDate parameter are available. The supported parameters are listed in the table below.

Tabulka: Parametry databázového dotazu

Parametr dotazu Vyžadované / Poznámky
dimenze Ano
startDate Ne / yyyy-MM-dd
endDate Ne / yyyy-MM-dd
skipMeta Ne
skipData Ne
hierarchyMeta Ne
showHierarchy Ne
displayProperty Ne
outputIdScheme Ne
outputOrgUnitIdScheme Ne
outputDataElementIdScheme Ne
inputIdScheme Ne
userOrgUnit Ne

The dimension query parameter defines which dimensions (table columns) should be included in the response. It can optionally be constrained with items. The filter query parameter defines which items and dimensions (table columns) should be used as a filter for the response.

For the organisation unit dimension, the response will contain data associated with the organisation unit and all organisation units in the sub-hierarchy (children in the tree). This is different compared to the regular analytics resource, where only the explicitly selected organisation units are included.

To retrieve a response with specific data elements, specific periods, specific organisation units and all data for two custom dimensions you can issue a request like this:

/api/analytics/rawData.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU;Jtf34kNZhzP
  &dimension=J5jldMd8OHv&dimension=Bpx0589u8y0
  &dimension=pe:LAST_12_MONTHS
  &dimension=ou:O6uvpzGd5pu;fdc6uOvgoji

The startDate and endDate parameters allow for fetching data linked to any period between those dates. This avoids the need for defining all periods explicitly in the request:

/api/analytics/rawData.json?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU;Jtf34kNZhzP
  &dimension=J5jldMd8OHv&dimension=Bpx0589u8y0
  &startDate=2015-01-01&endDate=2015-12-31
  &dimension=ou:O6uvpzGd5pu;fdc6uOvgoji

The filter parameter can be used to filter a response without including that dimension as part of the response, this time in CSV format:

/api/analytics/rawData.csv?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU;Jtf34kNZhzP
  &filter=J5jldMd8OHv:uYxK4wmcPqA;tDZVQ1WtwpA
  &startDate=2015-01-01&endDate=2015-12-31
  &dimension=ou:O6uvpzGd5pu

The outputIdScheme parameter is useful if you want human readable data responses as it can be set to NAME like this:

/api/analytics/rawData.csv?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &filter=J5jldMd8OHv:uYxK4wmcPqA;tDZVQ1WtwpA
  &startDate=2017-01-01&endDate=2017-12-31
  &dimension=ou:O6uvpzGd5pu
  &outputIdScheme=NAME

The response from the rawData resource will look identical to the regular analytics resource; the difference is that the response contains raw, non-aggregated data, suitable for further aggregation by third-party systems.

Ladění

When debugging analytics requests it can be useful to examine the data value source of the aggregated analytics response. The analytics/debug/sql resource will provide an SQL statement that returns the relevant content of the datavalue table. You can produce this SQL by doing a GET request with content type "text/html" or "text/plain" like below. The dimension and filter syntax are identical to regular analytics queries:

/api/analytics/debug/sql?dimension=dx:fbfJHSPpUQD;cYeuwXTCPkU
  &filter=pe:2016Q1;2016Q2&filter=ou:O6uvpzGd5pu

Analýza události

The event analytics API lets you access aggregated event data and query events captured in DHIS2. This resource lets you retrieve events based on a program and optionally a program stage, and lets you retrieve and filter events on any event dimensions.

/api/analytics/events

Rozměry a položky

Event dimensions include data elements, attributes, organisation units and periods. The aggregated event analytics resource will return aggregated information such as counts or averages. The query analytics resource will simply return events matching a set of criteria and does not perform any aggregation. You can specify dimension items in the form of options from option sets and legends from legend sets for data elements and attributes which are associated with such. The event dimensions are listed in the table below.

Tabulka: Dimenze události

Dimenze ID dimenze Popis
Datové prvky <id> Identifikátory datových prvků
Atributy <id> Identifikátory atributů
Období pe Období ISO a relativní období, viz "formát data a období"
Organizační jednotky ou Identifikátory organizační jednotky a klíčová slova USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL- <level> a OU_GROUP- <group-id>
Sady skupin organizačních jednotek <org unit group set id> Identifikátory sady skupin organizačních jednotek
Kategorie <category id> Identifikátory kategorií (pouze kategorie atributů programu)

Parametry požadavku databázového dotazu

Rozhraní API pro analytickou událost umožňuje určit rozsah parametrů dotazu.

Tabulka: Parametry dotazu pro dotaz události i souhrnnou analýzu

Parametr dotazu Požadované Popis Možnosti (nejprve výchozí)
program Ano Identifikátor programu. Jakýkoli identifikátor programu
fáze Ne Identifikátor fáze programu. Jakýkoli identifikátor fáze programu
startDate Ano Datum zahájení událostí. Datum ve formátu yyyy-MM-dd
endDate Ano Datum ukončení událostí. Datum ve formátu yyyy-MM-dd
dimenze Ano Identifikátor dimenze zahrnující datové prvky, atributy, indikátory programu, období, organizační jednotky a sady skupin organizačních jednotek. Parametr lze opakovat libovolněkrát. Filtry položek lze použít na dimenzi ve formátu <item-id>: <operator>: <filter>. Hodnoty filtru nerozlišují malá a velká písmena. Operátory mohou být EQ | GT | GE | LT | LE | NE | LIKE | IN
filtr Ne Identifikátor dimenze zahrnující datové prvky, atributy, období, organizační jednotky a sady skupin organizačních jednotek. Parametr lze opakovat libovolněkrát. Filtry položek lze použít na dimenzi ve formátu <item-id>: <operator>: <filter>. Hodnoty filtru nerozlišují malá a velká písmena.
hierarchyMeta Ne Do metadat zahrňte názvy předků organizačních jednotek a cesty hierarchie organizačních jednotek. false | true
eventStatus Ne Zadejte stav událostí, které chcete zahrnout. ACTIVE | COMPLETED | SCHEDULE | OVERDUE | SKIPPED. Can be comma separated (for query only).
programStatus Ne Zadejte stav zápisu událostí, které chcete zahrnout. ACTIVE | COMPLETED | CANCELLED. Can be comma separated (for query only).
relativePeriodDate řetězec Ne Identifikátor data, např.: "2016-01-01". Přepíše počáteční datum relativního období
sloupce Ne Dimenze, které se použijí jako sloupce pro rozložení tabulky. Jakákoli dimenze (musí být dimenze dotazu)
řádky Ne Dimenze, které se použijí jako řádky pro rozložení tabulky. Jakákoli dimenze (musí být dimenze dotazu)
timeField Ne Time field used in aggregations/queries on events. Applies to event data items only. Can be a predefined option or the ID of an attribute or data element with a time-based value type. For "/analytics/events/" endpoints, the default "timeField" is EVENT_DATE. EVENT_DATE | SCHEDULED_DATE | <Attribute ID> | <Data element ID>

Tabulka: Parametry dotazu pouze pro analýzu dotazů událostí

Parametr dotazu Požadované Popis Možnosti
ouMode Ne The mode of selecting organisation units. Default is DESCENDANTS, meaning all sub units in the hierarchy. CHILDREN refers to immediate children in the hierarchy; SELECTED refers to the selected organisation units only. More details [here].(https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html#webapi_nti_ou_scope) DESCENDANTS, CHILDREN, SELECTED
asc Ne Dimenze, které mají být seřazeny vzestupně, mohou odkazovat na datum události, název a kód organizační jednotky a jakékoli identifikátory položek. ouname | programstatus | eventstatus | createdbydisplayname | lastupdatedbydisplayname | eventdate | enrollmentdate | incidentdate | lastupdated | item identifier
desc Ne Dimenze, které mají být seřazeny sestupně, mohou odkazovat na datum události, název a kód organizační jednotky a jakékoli identifikátory položek. ouname | programstatus | eventstatus | createdbydisplayname | lastupdatedbydisplayname | eventdate | enrollmentdate | incidentdate | lastupdated | item identifier
coordinatesOnly Ne Zda se mají vrátit pouze události, které mají souřadnice. false | true
coordinateOuFallback Ne Geometrie instance programu se použije vždy, když geometrie organizační jednotky chybí. false | true
coordinateField Ne Field to base geospatial event analytics on. Can be set to EVENT (default), ENROLLMENT or TRACKER, or to the identifier of a data element or attribute of value type coordinate or organisation unit. For organisation unit value type items, the organisation unit geometry is used (represented by its centroid). The raw geometry column names eventgeometry, enrollmentgeometry, tegeometry and ougeometry are also accepted. EVENT | ENROLLMENT | TRACKER | ougeometry | <attribute-id> | <dataelement-id>
dataIdScheme Ne Schéma ID, které se má použít pro data, konkrétněji datové prvky a atributy, které mají sadu voleb nebo sadu legend, např. v datové odpovědi vraťte název možnosti místo kódu nebo název legendy místo ID legendy. NAME | CODE | UID
záhlaví Ne Názvy záhlaví, které mají být vráceny jako součást odpovědi. Jeden nebo více názvů záhlaví oddělených čárkou
strana Ne Číslo stránky. Výchozí stránka je 1. Číselná kladná hodnota
pageSize Ne Velikost stránky. Výchozí velikost je 50 položek na stránku. Nulová nebo kladná hodnota
eventDate ne (pouze zdroj events) Vlastní období v eventDate (viz část „období vlastního data“) viz část "formát data a období".
enrollmentDate ne Vlastní období v enrollmentDate (viz část „období vlastního data“) viz část "formát data a období".
scheduledDate ne (pouze zdroj events) Vlastní období na scheduledDate (viz část „období vlastního data“) viz část "formát data a období".
incidentDate ne Vlastní období v incidentDate (viz část „období vlastního data“) viz část "formát data a období".
lastUpdated ne Vlastní období na lastUpdated (viz část „období vlastního data“) viz část "formát data a období".

Tabulka: Parametry dotazu pouze pro agregovanou analýzu událostí

Parametr dotazu Požadované Popis Možnosti
value Ne Identifikátor dimenze hodnoty. Může to být datový prvek nebo atribut, který musí být typu číselné hodnoty. Identifikátor datového prvku nebo atributu
aggregationType Ne Typ agregace pro dimenzi hodnoty. Výchozí hodnota je AVERAGE. SUM | AVERAGE | AVERAGE_SUM_ORG_UNIT | LAST | LAST_AVERAGE_ORG_UNIT | COUNT | STDDEV | VARIANCE | MIN | MAX
showHierarchy Ne Zobrazí úplnou cestu hierarchie organizačních jednotek spolu s názvem organizační jednotky. false | true
displayProperty Ne Vlastnost k zobrazení pro metadata. NÁZEV | KRÁTKÝ NÁZEV
sortOrder Ne Seřaďte záznamy ve sloupci hodnoty ve vzestupném nebo sestupném pořadí. ASC | DESC
limit Ne Maximální počet vrácených záznamů. Nesmí být větší než 10 000. Číselná kladná hodnota
outputType Ne Zadejte typ výstupu pro analytická data, což mohou být události, zápisy nebo instance sledovaných entit. Poslední dvě možnosti platí pouze pro programy s registrací. EVENT | ENROLLMENT | TRACKED_ENTITY_INSTANCE
collapseDataDimensions Ne Sbalte všechny datové dimenze (datové prvky a atributy) do jediné dimenze v odpovědi. false | true
skipMeta Ne Vyloučit metadatovou část odpovědi (zlepšuje výkon). false | true
skipData Ne Vyloučí datovou část odpovědi. false | true
skipRounding Ne Přeskočit zaokrouhlování agregovaných datových hodnot. false | true
aggregateData Ne Vytvořte souhrnné hodnoty pro datové dimenze (na rozdíl od položek dimenzí). false | true
orgUnitField Ne The organisation unit field to base event aggregation on. Applies to event data items only. Can be the ID of an attribute or data element with the Organisation unit value type. The default option is specified as omitting the query parameter. <Attribute ID> | <Data element ID> | REGISTRATION | ENROLLMENT | OWNER_AT_START | OWNER_AT_END

Tabulka: Parametry dotazu pouze pro analýzu událostí clusteru

Parametr dotazu Požadované Popis Možnosti
clusterSize Ano Velikost shluků v metrech. Číselná kladná hodnota
coordinateField Ne Field to base geospatial event analytics on. Can be set to EVENT (default), ENROLLMENT or TRACKER, or to the identifier of a data element or attribute of value type coordinate or organisation unit. For organisation unit value type items, the organisation unit geometry is used (represented by its centroid). The raw geometry column names eventgeometry, enrollmentgeometry, tegeometry and ougeometry are also accepted. EVENT | ENROLLMENT | TRACKER | ougeometry | <attribute-id> | <dataelement-id>
bbox Ano Ohraničující rámeček / oblast událostí, které mají být zahrnuty do odpovědi ve formátu „min. zeměpisná délka, minimální zeměpisná šířka, maximální zeměpisná délka, maximální zeměpisná šířka“. Řetězec
includeClusterPoints Ne U každého shluku uveďte informace o základních bodech, buďte opatrní, pokud shluky představují velmi vysoký počet bodů. false | true

Note

When coordinateField references a data element or tracked entity attribute of value type organisation unit, the organisation unit's own geometry is used, represented by its centroid. In addition to the EVENT, ENROLLMENT and TRACKER keywords, the raw analytics geometry column names eventgeometry, enrollmentgeometry, tegeometry and ougeometry are accepted directly (tegeometry only for programs with registration). The aliases pigeometry (enrollment), psigeometry (event) and teigeometry (tracked entity) are deprecated, retained only for backwards compatibility, and will be removed in a future release.

Analýza dotazů na události

The analytics/events/query resource lets you query for captured events. This resource does not perform any aggregation, rather it lets you query and filter for information about events.

/api/analytics/events/query

You can specify any number of dimensions and any number of filters in a query. Dimension item identifiers can refer to any of data elements, person attributes, person identifiers, fixed and relative periods and organisation units. Dimensions can optionally have a query operator and a filter. Event queries should be on the format described below.

/api/analytics/events/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>

Chcete-li například získat události z programu "Ústavní nemocnost a úmrtnost" mezi lednem a říjnem 2016, kde jsou zahrnuty datové prvky "Pohlaví" a "Věk" a dimenze "Věk" je filtrována na "18", můžete použít následující dotaz:

/api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu;fdc6uOvgoji&dimension=oZg33kd9taw&dimension=qrur9Dvnyt5:EQ:18

To retrieve events for the "Birth" program stage of the "Child programme" program between March and December 2016, where the "Weight" data element, filtered for values larger than 2000:

/api/analytics/events/query/IpHINAT79UW?stage=A03MvHHogjR&startDate=2016-03-01
  &endDate=2016-12-31&dimension=ou:O6uvpzGd5pu&dimension=UXz7xuGCEhU:GT:2000

Sorting can be applied to the query for the event date of the event and any dimensions. To sort descending on the event date and ascending on the "Age" data element dimension you can use:

/api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&desc=EVENTDATE&asc=qrur9Dvnyt5

Paging can be applied to the query by specifying the page number and the page size parameters. If page number is specified but page size is not, a page size of 50 will be used. If page size is specified but page number is not, a page number of 1 will be used. To get the third page of the response with a page size of 20 you can use a query like this:

/api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu&dimension=qrur9Dvnyt5&page=3&pageSize=20

Filtrování

Filtry lze použít na datové prvky, atributy osob a identifikátory osob. Filtrování se provádí pomocí hodnoty parametru dotazu v následujícím formátu:

&dimension=<item-id>:<operator>:<filter-value>

Jako příklad můžete filtrovat datový prvek "Váha" pro hodnoty větší než 2000 a nižší než 4000 takto:

&dimension=UXz7xuGCEhU:GT:2000&dimension=UXz7xuGCEhU:LT:4000

You can filter the "Age" data element for multiple, specific ages using the IN operator like this:

&dimension=qrur9Dvnyt5:IN:18;19;20

Můžete zadat více filtrů pro danou položku opakováním operátoru a součástí filtru, všechny oddělené středníky:

&dimension=qrur9Dvnyt5:GT:5:LT:15

Dostupné operátory jsou uvedeny níže.

Tabulka: Operátory filtrů

Operátor Popis
EQ Rovno
!EQ Nerovná se
IEQ Rovná se, malá a velká písmena se ignorují
!IEQ Nerovná se, ignoruje se malá a velká písmena
GT Větší než
GE Větší než nebo rovno
LT Menší než
LE Menší nebo rovno
NE Nerovná se
LIKE Jako (shoda volného textu)
!LIKE Není jako (shoda volného textu)
ILIKE Jako, ignorování malých a velkých písmen (shoda volného textu)
!ILIKE Není jako, ignorování velkých a malých písmen (shoda volného textu)
IN Rovná se jedné z více hodnot oddělených ";"

Time Field Filtering

By default, the query endpoints filter periods based on eventDate. However, it is possible to filter entries based on lastUpdated or schedule instead, by using the timeField query parameter. For example:

&timeField=LAST_UPDATED
&timeField=SCHEDULED_DATE

Enhanced conditions

By default enhancedConditions flag is set to false. This means all conditions expressed in dimension and filter are meant as AND conditions. For example:

dimension=a:GT:20:LT:40&dimension=b:GT:1:LT:5

převádí do následující logické podmínky:

a>20 and a<40 and b>1 and b<5

However, there are cases in which more control on conditions might be needed and can be enabled by setting enhancedConditions query parameter to true. By doing so, a client can use a special _OR_ separator to join conditions using OR logical operator.

Příklad:

dimension=a:GT:20:LT:40_OR_b:GT:1:LT:5&dimension=c:EQ:test

převádí do následující logické podmínky:

((a>20 and a<40) or (b>1 and b<5)) and c = "test"

Formáty odpovědí

The default response representation format is JSON. The requests must be using the HTTP GET method. The following response formats are supported.

  • json (application/json)

  • jsonp (application/javascript)

  • xls (application/vnd.ms-excel)

Například pro získání odpovědi ve formátu Excel můžete použít příponu souboru v URL požadavku takto:

/api/analytics/events/query/eBAyeGv0exc.xls?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu&dimension=oZg33kd9taw&dimension=qrur9Dvnyt5

You can set the hierarchyMeta query parameter to true in order to include names of all ancestor organisation units in the meta-section of the response:

/api/analytics/events/query/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:YuQRtpLP10I&dimension=qrur9Dvnyt5:EQ:50&hierarchyMeta=true

Výchozí formát odpovědi JSON bude vypadat podobně jako tento:

{
  "headers": [
    {
      "name": "psi",
      "column": "Event",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "ps",
      "column": "Program stage",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "eventdate",
      "column": "Event date",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "storedby",
      "column": "Stored by",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "lastupdated",
      "column": "Last Updated",
      "valueType": "DATE",
      "type": "java.time.LocalDate",
      "hidden": false,
      "meta": true
    },
    {
      "name": "createdbydisplayname",
      "column": "Created by (display name)",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "lastupdatedbydisplayname",
      "column": "Last updated by (display name)",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "coordinates",
      "column": "Coordinates",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "ouname",
      "column": "Organisation unit name",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "oucode",
      "column": "Organisation unit code",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "ou",
      "column": "Organisation unit",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "oZg33kd9taw",
      "column": "Gender",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    },
    {
      "name": "qrur9Dvnyt5",
      "column": "Age",
      "type": "java.lang.String",
      "hidden": false,
      "meta": false
    }
  ],
  "metaData": {
    "names": {
      "qrur9Dvnyt5": "Age",
      "eBAyeGv0exc": "Inpatient morbidity and mortality",
      "ImspTQPwCqd": "Sierra Leone",
      "O6uvpzGd5pu": "Bo",
      "YuQRtpLP10I": "Badjia",
      "oZg33kd9taw": "Gender"
    },
    "ouHierarchy": {
      "YuQRtpLP10I": "/ImspTQPwCqd/O6uvpzGd5pu"
    }
  },
  "width": 8,
  "height": 4,
  "rows": [
    [
      "yx9IDINf82o",
      "Zj7UnCAulEk",
      "2016-08-05",
      "system",
      "2018-08-07",
      "[5.12, 1.23]",
      "Ngelehun",
      "OU_559",
      "YuQRtpLP10I",
      "Female",
      "50"
    ],
    [
      "IPNa7AsCyFt",
      "Zj7UnCAulEk",
      "2016-06-12",
      "system",
      "2018-08-07",
      "[5.22, 1.43]",
      "Ngelehun",
      "OU_559",
      "YuQRtpLP10I",
      "Female",
      "50"
    ],
    [
      "ZY9JL9dkhD2",
      "Zj7UnCAulEk",
      "2016-06-15",
      "system",
      "2018-08-07",
      "[5.42, 1.33]",
      "Ngelehun",
      "OU_559",
      "YuQRtpLP10I",
      "Female",
      "50"
    ],
    [
      "MYvh4WAUdWt",
      "Zj7UnCAulEk",
      "2016-06-16",
      "system",
      "2018-08-07",
      "[5.32, 1.53]",
      "Ngelehun",
      "OU_559",
      "YuQRtpLP10I",
      "Female",
      "50"
    ]
  ]
}

The headers section of the response describes the content of the query result. The event unique identifier, the program stage identifier, the event date, the organisation unit name, the organisation unit code and the organisation unit identifier appear as the first six dimensions in the response and will always be present. Next comes the data elements, person attributes and person identifiers which were specified as dimensions in the request, in this case, the "Gender" and "Age" data element dimensions. The header section contains the identifier of the dimension item in the "name" property and a readable dimension description in the "column" property.

The metaData section, ou object contains the identifiers of all organisation units present in the response mapped to a string representing the hierarchy. This hierarchy string lists the identifiers of the ancestors (parents) of the organisation unit starting from the root. The names object contains the identifiers of all items in the response mapped to their names.

The rows section contains the events produced by the query. Each row represents exactly one event.

In order to have the event analytics resource generate the data in the shape of a ready-made table, you can provide rows and columns parameters with requested dimension identifiers separated by semi-colons as values to indicate which ones to use as table columns and rows. Instead of generating a plain, normalized data source, the event analytics resource will now generate the data in table layout. The column and rows dimensions must be present as a data dimension in the query (not a filter). Such a request can look like this:

/api/analytics.html+css?dimension=dx:cYeuwXTCPkU;fbfJHSPpUQD&dimension=pe:WEEKS_THIS_YEAR
  &filter=ou:ImspTQPwCqd&displayProperty=SHORTNAME&columns=dx&rows=pe

Agregovaná analýza událostí

The /analytics/events/aggregate resource lets you retrieve aggregated numbers of events captured in DHIS2. This resource lets you retrieve aggregate data based on a program and optionally a program stage, and lets you filter on any event dimension.

/api/analytics/events/aggregate

Agregovaný zdroj událostí nevrací samotné informace o událostech, ale spíše souhrnný počet událostí, které odpovídají dotazu. Rozměry událostí zahrnují datové prvky, atributy osob, identifikátory osob, období a organizační jednotky. Agregátní dotazy na události by měly být ve formátu popsaném níže.

/api/analytics/events/aggregate/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>

For example, to retrieve aggregate numbers for events from the "Inpatient morbidity and mortality" program between January and October 2016, where the "Gender" and "Age" data elements are included, the "Age" dimension item is filtered on "18" and the "Gender" item is filtered on "Female", you can use the following query:

/api/analytics/events/aggregate/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:O6uvpzGd5pu&dimension=oZg33kd9taw:EQ:Female&dimension=qrur9Dvnyt5:GT:50

To retrieve data for fixed and relative periods instead of start and end date, in this case, May 2016 and last 12 months, and the organisation unit associated with the current user, you can use the following query:

/api/analytics/events/aggregate/eBAyeGv0exc?dimension=pe:201605;LAST_12_MONTHS
  &dimension=ou:USER_ORGUNIT;fdc6uOvgo7ji&dimension=oZg33kd9taw

Chcete-li zadat "Ženy" jako filtr pro "Pohlaví" pro datovou odpověď, což znamená, že "Pohlaví" nebude součástí odpovědi, ale bude filtrovat souhrnná čísla v ní, můžete použít následující syntaxi:

/api/analytics/events/aggregate/eBAyeGv0exc?dimension=pe:2016;
  &dimension=ou:O6uvpzGd5pu&filter=oZg33kd9taw:EQ:Female

To specify the "Bo" organisation unit and the period "2016" as filters, and the "Mode of discharge" and Gender" as dimensions, where "Gender" is filtered on the "Male" item, you can use a query like this:

/api/analytics/events/aggregate/eBAyeGv0exc?filter=pe:2016&filter=ou:O6uvpzGd5pu
  &dimension=fWIAEtYVEGk&dimension=oZg33kd9taw:EQ:Male

To create a "Top 3 report" for Mode of discharge you can use the limit and sortOrder query parameters similar to this:

/api/analytics/events/aggregate/eBAyeGv0exc?filter=pe:2016&filter=ou:O6uvpzGd5pu
  &dimension=fWIAEtYVEGk&limit=3&sortOrder=DESC

To specify a value dimension with a corresponding aggregation type you can use the value and aggregationType query parameters. Specifying a value dimension will make the analytics engine return aggregate values for the values of that dimension in the response as opposed to counts of events.

/api/analytics/events/aggregate/eBAyeGv0exc.json?stage=Zj7UnCAulEk
  &dimension=ou:ImspTQPwCqd&dimension=pe:LAST_12_MONTHS&dimension=fWIAEtYVEGk
  &value=qrur9Dvnyt5&aggregationType=AVERAGE

To base event analytics aggregation on a specific data element or attribute of value type date or date time you can use the timeField parameter:

/api/analytics/events/aggregate/IpHINAT79UW.json?dimension=ou:ImspTQPwCqd
  &dimension=pe:LAST_12_MONTHS&dimension=cejWyOfXge6&stage=A03MvHHogjR
  &timeField=ENROLLMENT_DATE

To base event analytics aggregation on a specific data element or attribute of value type organisation unit you can use the orgUnitField parameter:

/api/analytics/events/aggregate/eBAyeGv0exc.json?dimension=ou:ImspTQPwCqd
  &dimension=pe:THIS_YEAR&dimension=oZg33kd9taw&stage=Zj7UnCAulEk
  &orgUnitField=S33cRBsnXPo

The orgUnitField parameter value may be one of the following:

orgUnitField Popis
<Attribute ID> ID of an attribute with the organisation unit value type
<Data element ID> ID of a data element with the organisation unit value type
REGISTRATION The organization unit at which the tracked entity instance was registered (created)
ZÁPIS The organization unit at which the tracked entity instance was enrolled in the program
OWNER_AT_START The tracked entity instance's owning organisation unit at the start of the reporting period
OWNER_AT_END The tracked entity instance's owning organisation unit at the end of the reporting period

Sady rozsahů / legend

For aggregate queries, you can specify a range / legend set for numeric data element and attribute dimensions. The purpose is to group the numeric values into ranges. As an example, instead of generating data for an "Age" data element for distinct years, you can group the information into age groups. To achieve this, the data element or attribute must be associated with the legend set. The format is described below:

?dimension=<item-id>-<legend-set-id>

Příklad vypadá takto:

/api/analytics/events/aggregate/eBAyeGv0exc.json?stage=Zj7UnCAulEk
  &dimension=qrur9Dvnyt5-Yf6UHoPkdS6&dimension=ou:ImspTQPwCqd&dimension=pe:LAST_MONTH

Formáty odpovědí

The default response representation format is JSON. The requests must be using the HTTP GET method. The response will look similar to this:

{
  "headers": [
    {
      "name": "oZg33kd9taw",
      "column": "Gender",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "qrur9Dvnyt5",
      "column": "Age",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "pe",
      "column": "Period",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "ou",
      "column": "Organisation unit",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "value",
      "column": "Value",
      "type": "java.lang.String",
      "meta": false
    }
  ],
  "metaData": {
    "names": {
      "eBAyeGv0exc": "Inpatient morbidity and mortality"
    }
  },
  "width": 5,
  "height": 39,
  "rows": [
    [
      "Female",
      "95",
      "201605",
      "O6uvpzGd5pu",
      "2"
    ],
    [
      "Female",
      "63",
      "201605",
      "O6uvpzGd5pu",
      "2"
    ],
    [
      "Female",
      "67",
      "201605",
      "O6uvpzGd5pu",
      "1"
    ],
    [
      "Female",
      "71",
      "201605",
      "O6uvpzGd5pu",
      "1"
    ],
    [
      "Female",
      "75",
      "201605",
      "O6uvpzGd5pu",
      "14"
    ],
    [
      "Female",
      "73",
      "201605",
      "O6uvpzGd5pu",
      "5"
    ]
  ]
}

Note that the max limit for rows to return in a single response is 10 000. If the query produces more than the max limit, a 409 Conflict status code will be returned.

Analýza shluků událostí

The analytics/events/cluster resource provides clustered geospatial event data. A request looks like this:

/api/analytics/events/cluster/eBAyeGv0exc?startDate=2016-01-01&endDate=2016-10-31
  &dimension=ou:LEVEL-2&clusterSize=100000
  &bbox=-13.2682125,7.3721619,-10.4261178,9.904012&includeClusterPoints=false

The cluster response provides the count of underlying points, the center point and extent of each cluster. If the includeClusterPoints query parameter is set to true, a comma-separated string with the identifiers of the underlying events is included. A sample response looks like this:

{
  "headers": [
    {
      "name": "count",
      "column": "Count",
      "type": "java.lang.Long",
      "meta": false
    },
    {
      "name": "center",
      "column": "Center",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "extent",
      "column": "Extent",
      "type": "java.lang.String",
      "meta": false
    },
    {
      "name": "points",
      "column": "Points",
      "type": "java.lang.String",
      "meta": false
    }
  ],
  "width": 3,
  "height": 4,
  "rows": [
    [
      "3",
      "POINT(-13.15818 8.47567)",
      "BOX(-13.26821 8.4St7215,-13.08711 8.47807)",
      ""
    ],
    [
      "9",
      "POINT(-13.11184 8.66424)",
      "BOX(-13.24982 8.51961,-13.05816 8.87696)",
      ""
    ],
    [
      "1",
      "POINT(-12.46144 7.50597)",
      "BOX(-12.46144 7.50597,-12.46144 7.50597)",
      ""
    ],
    [
      "7",
      "POINT(-12.47964 8.21533)",
      "BOX(-12.91769 7.66775,-12.21011 8.49713)",
      ""
    ]
  ]
}

Počet a rozsah analýzy událostí

The analytics/events/count resource is suitable for geometry-related requests for retrieving the count and extent (bounding box) of events for a specific query. The query syntax is equal to the events/query resource. A request looks like this:

/api/analytics/events/count/eBAyeGv0exc?startDate=2016-01-01
  &endDate=2016-10-31&dimension=ou:O6uvpzGd5pu

Odpověď poskytne počet a rozsah ve formátu JSON:

{
  extent: "BOX(-13.2682125910096 7.38679562779441,-10.4261178860988 9.90401290212795)",
  count: 59
}

Omezení a validace

There are several constraints to the input parameters you can provide to the event analytics resource. If any of the constraints are violated, the API will return a 409 Conflict response and a response message looking similar to this:

{
  "httpStatus": "Conflict",
  "httpStatusCode": 409,
  "status": "ERROR",
  "message": "At least one organisation unit must be specified",
  "errorCode": "E7200"
}

The possible validation errors for the event analytics API are described in the table below.

Chybový kód Zpráva
E7200 Musí být uvedena alespoň jedna organizační jednotka
E7201 Dimenze nelze zadat více než jednou
E7202 Položky dotazu nelze zadat více než jednou
E7203 Hodnoty dimenzi nelze také určit jako položku nebo filtr položky
E7204 Při zadání typu agregace je nutné zadat hodnoty dimenze nebo agregovaná data
E7205 Musí být uvedeno datum zahájení a ukončení nebo alespoň jedno období
E7206 Datum zahájení je po datu ukončení
E7207 Číslo stránky musí být kladné číslo
E7208 Velikost stránky musí být nula nebo kladné číslo
E7209 Limit je větší než maximální limit
E7210 Pole času je neplatné
E7211 Pole organizační jednotky je neplatné
E7212 Velikost klastru musí být kladné číslo
E7213 ohraničovací rámeček je neplatný, musí být ve formátu: 'min-lng, min-lat, max-lng, max-lat'
E7214 Pokud je zadán ohraničující rámeček nebo velikost clusteru, musí být zadáno pole clusteru
E7215 Položka dotazu nemůže určit sadu legend i sadu možností
E7216 Při použití v agregovaném dotazu musí být položka dotazu agregovatelná
E7217 Uživatel nemá povoleno prohlížet analytická data událostí
E7218 Podpora prostorové databáze není povolena
E7219 Aby bylo možné použít jako souřadnicové pole datový prvek, musí mít souřadnici hodnotového typu
E7220 Atribut musí být souřadnicového typu hodnoty, aby mohl být použit jako pole souřadnic
E7221 Pole souřadnic je neplatné
E7222 Položka dotazu nebo filtr jsou neplatné
E7223 Hodnota neodkazuje na datový prvek nebo atribut, které jsou číselné a jsou součástí programu
E7224 Identifikátor položky neodkazuje na žádný datový prvek, atribut nebo indikátorovou část programu
E7225 Fáze programu je povinná pro dimenze datových prvků v analytických dotazech registrace
E7226 Dimenze není platná položka dotazu
E7227 Typ entity vztahu není podporován
E7228 Pole záložní souřadnice je neplatné
E7229 Operátor nepovolí chybějící hodnotu

Analytika zápisu

The enrollment analytics API lets you access aggregated event data and query enrollments with their event data captured in DHIS2. This resource lets you retrieve data for a program based on program stages and data elements - in addition to tracked entity attributes. When querying event data for a specific programstages within each enrollment, the data element values for each program stage will be returned as one row in the response from the api. If querying a data element in a program stage that is repeatable, the newest data element value will be used for that data element in the api response.

Rozměry a položky

Dimenze zápisu zahrnují datové prvky, atributy, organizační jednotky a období. Prostředek pro analýzu dotazů jednoduše vrátí zápisy odpovídající sadě kritérií a neprovádí žádnou agregaci.

Tabulka: Rozměry pro zápis

Dimenze ID dimenze Popis
Datové prvky ve fázích programu <program stage id>.<data element id> Data element identifiers must include the program stage when querying data for enrollments. dimension=edqlbukwRfQ.vANAXwtLwcT
Atributy <id> Identifikátory atributů
Období pe Období ISO a relativní období, viz "formát data a období"
Organizační jednotky ou Identifikátory organizační jednotky a klíčová slova USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL- <level> a OU_GROUP- <group-id>

Repeatable stages

Data element identifier must include program stage. The program stage can be repeatable. For example the dimension edqlbukwRfQ.vANAXwtLwcT can refer to repeatable program stage. The data element of this stage is accessible via index parameters (enclosed with [ ]).

Possible indexing of repeatable stages
Dimenze Index parameters DataElement value refers to
edqlbukwRfQ.vANAXwtLwcT Nedostupné last execution date
edqlbukwRfQ[0].vANAXwtLwcT 0 last execution date
dqlbukwRfQ[-2].vANAXwtLwcT -2 second from last execution date
dqlbukwRfQ[1].vANAXwtLwcT 1 first execution date
dqlbukwRfQ[3].vANAXwtLwcT 3 third execution date
edqlbukwRfQ[*].vANAXwtLwcT * all repetitions
edqlbukwRfQ[-1~3].vANAXwtLwcT -1, 3 3 repetitions starting with -1 (first after last execution date)
edqlbukwRfQ[05LAST_3_MONTHS ].vANAXwtLwcT 0, 5, LAST_3_MONTHS 5 repetitions starting with last execution date down to the fifth one within last 3 months
edqlbukwRfQ[-132021-01-01~2022-05-31].vANAXwtLwcT -1, 3, 2021-01-01,2022-05-31 3 repetitions starting with -1 (first after last execution date) within specified dates

Warning: Indexing of non-repeatable program stage leads to parameter validation error.

Analýza dotazů na zápis

The analytics/enrollments/query resource lets you query for captured enrollments. This resource does not perform any aggregation, rather it lets you query and filter for information about enrollments.

/api/analytics/enrollments/query

V dotazu můžete zadat libovolný počet dimenzí a libovolný počet filtrů. Identifikátory položky dimenze mohou odkazovat na kterýkoli z datových prvků ve fázích programu, trasované atributy entity, pevná a relativní období a organizační jednotky. Dimenze mohou volitelně mít operátor dotazu a filtr. Dotazy k registraci by měly být ve formátu popsaném níže.

/api/analytics/enrollments/query/<program-id>?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd
  &dimension=ou:<ou-id>;<ou-id>&dimension=<item-id>&dimension=<item-id>:<operator>:<filter>

Například k načtení zápisů z programu „Antenatální péče“ z ledna 2019, kde je z atributů převzato „Jméno“, jsou od první fáze programu zahrnuty datové prvky „Chronické stavy“ a „Kouření“ a „Hodnota hemoglobinu“ z následující programové fáze a zahrnuty by byly pouze ženy, které mají „Chronické stavy“, můžete použít následující dotaz:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json?dimension=ou:ImspTQPwCqd
  &dimension=w75KJ2mc4zz&dimension=WZbXY0S00lP.de0FEHSIoxh:eq:1&dimension=w75KJ2mc4zz
  &dimension=WZbXY0S00lP.sWoqcoByYmD&dimension=edqlbukwRfQ.vANAXwtLwcT
  &startDate=2019-01-01&endDate=2019-01-31

Chcete-li načíst registrace z programu „Předporodní péče“ z minulého měsíce (ve vztahu k okamžiku, kdy je dotaz proveden), kde jsou od první fáze programu zahrnuty datové prvky „Chronické stavy“ a „Kouření“, a „Hodnota hemoglobinu“ od fáze následného programu, zahrnuje pouze kouřící ženy s hemoglobinem nižším než 20:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json?dimension=ou:ImspTQPwCqd
  &dimension=WZbXY0S00lP.de0FEHSIoxh&dimension=w75KJ2mc4zz
  &dimension=WZbXY0S00lP.sWoqcoByYmD:eq:1&dimension=edqlbukwRfQ.vANAXwtLwcT:lt:20
  &dimension=pe:LAST_MONTH

Řazení lze použít na dotaz pro data zápisu a incidentů zápisu:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.xls?dimension=ou:ImspTQPwCqd
  &columns=w75KJ2mc4zz&dimension=WZbXY0S00lP.sWoqcoByYmD&dimension=pe:LAST_MONTH
  &stage=WZbXY0S00lP&pageSize=10&page=1&asc=ENROLLMENTDATE&ouMode=DESCENDANTS

Stránkování lze na dotaz použít zadáním čísla stránky a parametrů velikosti stránky. Pokud je zadáno číslo stránky, ale velikost stránky není, použije se velikost stránky 50. Pokud je zadána velikost stránky, ale číslo stránky není, použije se číslo stránky 1. Chcete-li získat druhou stránku odpovědi s velikostí stránky 10, můžete použít dotaz, jako je tento:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json?dimension=ou:ImspTQPwCqd
  &dimension=WZbXY0S00lP.de0FEHSIoxh&dimension=w75KJ2mc4zz&dimension=pe:LAST_MONTH
  &dimension=WZbXY0S00lP.sWoqcoByYmD&pageSize=10&page=2

Filtrování

Filtry lze použít na datové prvky, atributy osob a identifikátory osob. Filtrování se provádí pomocí hodnoty parametru dotazu v následujícím formátu:

&dimension=<item-id>:<operator>:<filter-value>

Jako příklad můžete filtrovat datový prvek "Váha" pro hodnoty větší než 2000 a nižší než 4000 takto:

&dimension=WZbXY0S00lP.UXz7xuGCEhU:GT:2000&dimension=WZbXY0S00lP.UXz7xuGCEhU:LT:4000

Atribut "Věk" můžete filtrovat pro více konkrétních věků pomocí operátoru IN takto:

&dimension=qrur9Dvnyt5:IN:18;19;20

Můžete zadat více filtrů pro danou položku opakováním operátoru a součástí filtru, všechny oddělené středníky:

&dimension=qrur9Dvnyt5:GT:5:LT:15

Time Field Filtering

By default, the query endpoints filter periods based on enrollmentDate. However, it is possible to filter entries based on lastUpdated instead, by using the timeField query parameter.

&timeField=LAST_UPDATED
NV keyword

Speciální klíčové slovo NV lze použít k filtrování podle hodnot null

Filtr podle AGE je null

&dimension=qrur9Dvnyt5:EQ:NV

Filtr podle AGE není nulový

&dimension=qrur9Dvnyt5:NE:NV

Filtr podle AGE je 18, 19 nebo je nulový

&dimension=qrur9Dvnyt5:IN:18;19;NV

NV lze použít s operátory EQ, NE a IN

Operators

Dostupné operátory jsou uvedeny níže.

Tabulka: Operátory filtrů

Operátor Popis
EQ Rovno
GT Větší než
GE Větší než nebo rovno
LT Menší než
LE Menší nebo rovno
NE Nerovná se
LIKE Jako (shoda volného textu)
IN Rovná se jedné z více hodnot oddělených ";"

Parametry požadavku databázového dotazu

Rozhraní API pro analytický dotaz na zápis umožňuje určit rozsah parametrů dotazu.

Tabulka: Parametry dotazu pro koncový bod dotazu registrace

Parametr dotazu Požadované Popis Možnosti (nejprve výchozí)
program Ano Identifikátor programu. Jakýkoli identifikátor programu
startDate Ne Datum zahájení zápisů. Datum ve formátu yyyy-MM-dd
endDate Ne Datum ukončení zápisů. Datum ve formátu yyyy-MM-dd
dimenze Ano Identifikátor dimenze zahrnující datové prvky, atributy, indikátory programu, období, organizační jednotky a sady skupin organizačních jednotek. Parametr lze opakovat libovolněkrát. Filtry položek lze použít na dimenzi ve formátu <item-id>: <operator>: <filter>. Hodnoty filtru nerozlišují malá a velká písmena. Operátory mohou být EQ | GT | GE | LT | LE | NE | LIKE | IN
filtr Ne Identifikátor dimenze zahrnující datové prvky, atributy, období, organizační jednotky a sady skupin organizačních jednotek. Parametr lze opakovat libovolněkrát. Filtry položek lze použít na dimenzi ve formátu <item-id>: <operator>: <filter>. Hodnoty filtru nerozlišují malá a velká písmena.
programStatus Ne Zadejte stav zápisu zápisů, které chcete zahrnout. ACTIVE | COMPLETED | CANCELLED
relativePeriodDate řetězec Ne Identifikátor data, např.: "2016-01-01". Přepíše počáteční datum relativního období
ouMode Ne The mode of selecting organisation units. Default is DESCENDANTS, meaning all sub units in the hierarchy. CHILDREN refers to immediate children in the hierarchy; SELECTED refers to the selected organisation units only. More details [here].(https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html#webapi_nti_ou_scope) DESCENDANTS, CHILDREN, SELECTED
asc Ne Dimenze, které mají být seřazeny vzestupně, mohou odkazovat na datum registrace, datum incidentu, název a kód organizační jednotky. ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | item identifier
desc Ne Dimenze, které mají být seřazeny sestupně, mohou odkazovat na datum registrace, datum incidentu, název a kód organizační jednotky. ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | item identifier
coordinatesOnly Ne Zda se mají vrátit pouze zápisy, které mají souřadnice. false | true
coordinateField Ne Field to base geospatial enrollment analytics on. Can be set to EVENT, ENROLLMENT (default) or TRACKER, or to the identifier of a data element or attribute of value type coordinate or organisation unit. For organisation unit value type items, the organisation unit geometry is used (represented by its centroid). The raw geometry column names eventgeometry, enrollmentgeometry, tegeometry and ougeometry are also accepted. EVENT | ENROLLMENT | TRACKER | ougeometry | <attribute-id> | <dataelement-id>
záhlaví Ne Názvy záhlaví, které mají být vráceny jako součást odpovědi. Jeden nebo více názvů záhlaví oddělených čárkou
strana Ne Číslo stránky. Výchozí stránka je 1. Číselná kladná hodnota
pageSize Ne Velikost stránky. Výchozí velikost je 50 položek na stránku. Nulová nebo kladná hodnota
timeField Ne Time field used in aggregations/queries on enrollments. Applies to enrollment data items only. Can be a predefined option or the ID of an attribute or data element with a time-based value type. For "/analytics/enrollments/" endpoints, the default "timeField" is ENROLLMENT_DATE. ENROLLMENT_DATE | LAST_UPDATED | <Attribute ID> | <Data element ID>

Formáty odpovědí

The default response representation format is JSON. The requests must be using the HTTP GET method. The following response formats are supported.

  • json (application/json)
  • xml (application/xml)
  • xls (application/vnd.ms-excel)
  • csv (application/csv)
  • html (text/html)
  • html+css (text/html)

Například pro získání odpovědi ve formátu Excel můžete použít příponu souboru v URL požadavku takto:

/api/analytics/enrollments/query/WSGAb5XwJ3Y.xls?dimension=ou:ImspTQPwCqd
  &dimension=WZbXY0S00lP.de0FEHSIoxh&columns=w75KJ2mc4zz
  &dimension=WZbXY0S00lP.sWoqcoByYmD&dimension=pe:LAST_MONTH&stage=WZbXY0S00lP
  &pageSize=10&page=1&asc=ENROLLMENTDATE&ouMode=DESCENDANTS

Výchozí formát odpovědi JSON bude vypadat podobně jako tento:

{
  "headers": [
    {
      "name": "pi",
      "column": "Enrollment",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "tei",
      "column": "Tracked entity instance",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "enrollmentdate",
      "column": "Enrollment date",
      "valueType": "DATE",
      "type": "java.util.Date",
      "hidden": false,
      "meta": true
    },
    {
      "name": "incidentdate",
      "column": "Incident date",
      "valueType": "DATE",
      "type": "java.util.Date",
      "hidden": false,
      "meta": true
    },
    {
      "name": "storedby",
      "column": "Stored by",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "lastupdated",
      "column": "Last Updated",
      "valueType": "DATE",
      "type": "java.time.LocalDate",
      "hidden": false,
      "meta": true
    },
    {
      "name": "storedby",
      "column": "Stored by",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "createdbydisplayname",
      "column": "Created by (display name)",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "lastupdatedbydisplayname",
      "column": "Last updated by (display name)",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "geometry",
      "column": "Geometry",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "longitude",
      "column": "Longitude",
      "valueType": "NUMBER",
      "type": "java.lang.Double",
      "hidden": false,
      "meta": true
    },
    {
      "name": "latitude",
      "column": "Latitude",
      "valueType": "NUMBER",
      "type": "java.lang.Double",
      "hidden": false,
      "meta": true
    },
    {
      "name": "ouname",
      "column": "Organisation unit name",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "oucode",
      "column": "Organisation unit code",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "ou",
      "column": "Organisation unit",
      "valueType": "TEXT",
      "type": "java.lang.String",
      "hidden": false,
      "meta": true
    },
    {
      "name": "de0FEHSIoxh",
      "column": "WHOMCH Chronic conditions",
      "valueType": "BOOLEAN",
      "type": "java.lang.Boolean",
      "hidden": false,
      "meta": true
    },
    {
      "name": "sWoqcoByYmD",
      "column": "WHOMCH Smoking",
      "valueType": "BOOLEAN",
      "type": "java.lang.Boolean",
      "hidden": false,
      "meta": true
    }
  ],
  "metaData": {
    "pager": {
      "page": 2,
      "total": 163,
      "pageSize": 4,
      "pageCount": 41
    },
    "items": {
      "ImspTQPwCqd": {
        "name": "Sierra Leone"
      },
      "PFDfvmGpsR3": {
        "name": "Care at birth"
      },
      "bbKtnxRZKEP": {
        "name": "Postpartum care visit"
      },
      "ou": {
        "name": "Organisation unit"
      },
      "PUZaKR0Jh2k": {
        "name": "Previous deliveries"
      },
      "edqlbukwRfQ": {
        "name": "Antenatal care visit"
      },
      "WZbXY0S00lP": {
        "name": "First antenatal care visit"
      },
      "sWoqcoByYmD": {
        "name": "WHOMCH Smoking"
      },
      "WSGAb5XwJ3Y": {
        "name": "WHO RMNCH Tracker"
      },
      "de0FEHSIoxh": {
        "name": "WHOMCH Chronic conditions"
      }
    },
    "dimensions": {
      "pe": [],
      "ou": [
        "ImspTQPwCqd"
      ],
      "sWoqcoByYmD": [],
      "de0FEHSIoxh": []
    }
  },
  "width": 12,
  "rows": [
    [
      "A0cP533hIQv",
      "to8G9jAprnx",
      "2019-02-02 12:05:00.0",
      "2019-02-02 12:05:00.0",
      "system",
      "2020-08-06 21:20:52.0",
      "",
      "0.0",
      "0.0",
      "Tonkomba MCHP",
      "OU_193264",
      "xIMxph4NMP1",
      "0",
      "1"
    ],
    [
      "ZqiUn2uXmBi",
      "SJtv0WzoYki",
      "2019-02-02 12:05:00.0",
      "2019-02-02 12:05:00.0",
      "system",
      "2020-08-06 21:20:52.0",
      "",
      "0.0",
      "0.0",
      "Mawoma MCHP",
      "OU_254973",
      "Srnpwq8jKbp",
      "0",
      "0"
    ],
    [
      "lE747mUAtbz",
      "PGzTv2A1xzn",
      "2019-02-02 12:05:00.0",
      "2019-02-02 12:05:00.0",
      "system",
      "2020-08-06 21:20:52.0",
      "",
      "0.0",
      "0.0",
      "Kunsho CHP",
      "OU_193254",
      "tdhB1JXYBx2",
      "",
      "0"
    ],
    [
      "nmcqu9QF8ow",
      "pav3tGLjYuq",
      "2019-02-03 12:05:00.0",
      "2019-02-03 12:05:00.0",
      "system",
      "2020-08-06 21:20:52.0",
      "",
      "0.0",
      "0.0",
      "Korbu MCHP",
      "OU_678893",
      "m73lWmo5BDG",
      "",
      "1"
    ]
  ],
  "height": 4
}

The headers section of the response describes the content of the query result. The enrollment unique identifier, the tracked entity instance identifier, the enrollment date, the incident date, geometry, latitude, longitude, the organisation unit name and the organisation unit code appear as the first dimensions in the response and will always be present. Next comes the data elements, and tracked entity attributes which were specified as dimensions in the request, in this case, the "WHOMCH Chronic conditions" and "WHOMCH smoking" data element dimensions. The header section contains the identifier of the dimension item in the "name" property and a readable dimension description in the "column" property.

The metaData section, ou object contains the identifiers of all organisation units present in the response mapped to a string representing the hierarchy. This hierarchy string lists the identifiers of the ancestors (parents) of the organisation unit starting from the root. The names object contains the identifiers of all items in the response mapped to their names.

The rows section contains the enrollments produced by the query. Each row represents exactly one enrollment.

Analýza napříč vztahy TEI s indikátory programu

Neagregační zápisové analytické API také podporuje propojení indikátorů programu s typy vztahů, aby se zobrazil výsledek výpočtu konkrétního indikátoru programu použitého na související entity uvedené instance trasované entity.

For the Program Indicator/Relationship Type link to work, the /api/analytics/enrollments/query API requires an additional dimension which must include the chosen Relationship Type UID and the chosen Program Indicator UID:

/api/analytics/enrollments/query/<program-id>
  ?dimension=<relationshiptype-id>.<programindicator-id>

Chcete-li například načíst seznam zápisů z programu „WHO RMNCH Tracker“ pro leden 2019 a zobrazit počet případů malárie propojených s tímto zápisem podle typu vztahu „případ malárie spojený s osobou“, můžete použít následující dotaz

/api/analytics/enrollments/query/WSGAb5XwJ3Y.json?dimension=mxZDvSZYxlw.nFICjJluo74
  &startDate=2019-01-01&endDate=2019-01-31

API podporuje použití indikátorů programu, které nejsou spojeny s "hlavním" programem (to je ID programu zadané za /query/).

Tracked entity analytics

The tracked entity (TE) analytics API allows querying TEs with their enrollments and event data captured in DHIS2. This resource retrieves data from TE, enrollments, events, and data elements across multiple programs, for a given tracked entity type.

Dimensions and items

Tracked entity instance dimensions include program attributes (TE attributes), data elements, organization units, and different kinds of periods. The analytics query will simply return TEs matching a set of criteria. It does not perform any aggregation.

TE dimensions
Dimenze ID dimenze Popis
Program attributes (TE attributes) <attribute id> The identifier of the program attribute.
Datové prvky ve fázích programu <program id>.<program stage id>[offset].<data element id> Data element identifiers must include the program and program stage. ie: dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO
Období N.A. There's no direct support for period dimension. Periods are supported through several different specific parameters. See the Periods section below.
TEI Organisation units ou Organisation unit identifiers, and also the keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>.
Enrollment Organisation units <program id>.ou Organisation unit identifiers, and also the keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>.
Event Organisation units <program id><program stage id>.ou Organisation unit identifiers, and also the keywords USER_ORGUNIT, USER_ORGUNIT_CHILDREN, USER_ORGUNIT_GRANDCHILDREN, LEVEL-<level> and OU_GROUP-<group-id>.

Offset

Dimensions referring to items in repeatable events can include an optional offset. The offset is used to specify which repetition of the event to use. The order of the repetitions is based on the occurred date, with the most recent event being the latest repetition. The offset is an integer value, where 0 refers to the last repetition, -1 to the second last, and so on. Positive values refer to the first (oldest) repetition, second repetition, and so on. The offset is enclosed in square brackets [ ].

Příklad:

IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO -- refers to the last repetition
IpHINAT79UW.ZzYYXq4fJie[-1].GQY2lXrypjO -- refers to the second last repetition
IpHINAT79UW.ZzYYXq4fJie[2].GQY2lXrypjO -- refers to the second repetition

Tracked entity (TE) query analytics

The analytics/trackedEntities/query endpoint provides queries for captured TEs, allowing querying and filtering for information related to TEs, along with their respective enrollments and events. It does not perform any aggregation.

/api/41/analytics/trackedEntities/query

You can specify any number of dimensions and any number of filters in a query. Dimension item identifiers can refer to any of the data elements in program stages, program attributes, tracked entity attributes, fixed and relative periods, and organization units. Dimensions can optionally have a query operator and a filter. TEs queries should be in the format described below.

/api/41/analytics/trackedEntities/query/<tracked-entity-type-id>?dimension=ou:<ou-id>;<ou-id>&
    dimension=<item-id>&dimension=<item-id>:<operator>:<filter>

For example, to retrieve TEs of type Person from the "Child Program" and "Antenatal care" programs, where the "First name" is "James":

/api/41/analytics/trackedEntities/query/nEenWmSyUEp?program=IpHINAT79UW,WSGAb5XwJ3Y&dimension=IpHINAT79UW.w75KJ2mc4zz:eq:James

Paging can be applied to the query by specifying the page number and the page size parameters. If the page number is specified but the page size is not, a page size of 50 will be used. If the page size is specified but the page number is not, a page number of 1 will be used. To get the second page of the response with a page size of 10 you can use a query like this:

/api/41/analytics/trackedEntities/query/nEenWmSyUEp?program=IpHINAT79UW,WSGAb5XwJ3Y&dimension=IpHINAT79UW.w75KJ2mc4zz:eq:James
    &pageSize=10&page=2

Filtrování

Filters can be applied to data elements, tracked entity attributes, and tracked entity identifiers. The filtering is done through a query parameter in the following format:

&dimension=<item-id>:<operator>:<filter-value>

For example, you can filter the "MCH Infant Weight (g)" data element, of the program "Child Program" and program stage "Baby Postnatal" looking for values greater than 2000 and lower than 4000. The filter is defined like this:

&dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO:GT:2000&dimension=IpHINAT79UW.ZzYYXq4fJie.GQY2lXrypjO:LT:4000

Periods

Unlike enrollment and event query endpoints, the TE endpoint supports multiple ways to specify the period the data belongs to. They are based on different date params as shown below:

Parametr Popis
eventDate TEs will be filtered based on the date the event occurred.
enrollmentDate TEs will be filtered based on the date of enrollment.
scheduledDate TEs will be filtered based on the date the event was scheduled.
incidentDate TEs will be filtered based on enrollment's incident date.
lastUpdated TEs will be filtered based on the date the TE/enrollment/event was last updated.
created TEs will be filtered based on the date the TE/enrollment/event was created.

Some periods, mentioned above, can be applied to Tracked Entities, Enrollments, or Events, depending on the way they are expressed.

Příklady:

  • filtering TEs that have been updated during the last year:

lastUpdated=LAST_YEAR

  • filtering TEs whose latest enrollment in the program "Child Program" has been updated during the last year:

lastUpdated=IpHINAT79UW.LAST_YEAR

  • filtering TEs whose latest event in the program stage "Baby Postnatal", in the latest enrollment in the program "Child Program" has been updated during the last year:

lastUpdated=IpHINAT79UW.ZzYYXq4fJie.LAST_YEAR

  • filtering TEs whose latest enrollment in the "Child Program" occurred in the last year:

enrollmentDate=IpHINAT79UW.LAST_YEAR

Request query parameters

The analytics TE query API supports a range of query parameters.

Query parameters for the TE query endpoint
Parametr dotazu Požadované Popis Možnosti (nejprve výchozí)
trackedEntityType Ano Tracked entity type identifier. Any tracked entity type identifier.
program Ne Program identifiers. Any program identifier. Accepts multiple comma-separated identifiers.
dimenze Ne Dimension identifier including data elements, attributes, program indicators, periods, organization units and organization unit group sets. This parameter can be specified multiple times. Dimension filters can be applied to a dimension in the format <dimension-id>:<operator>:<filter-value>. Filter values can be case-insensitive (depending on the operator). Operators supported: EQ | IEQ | GT | GE | LT | LE | NE | LIKE | ILIKE | IN
filtr Ne Dimension identifier including data elements, attributes, periods, organization units and organization unit group sets. This parameter can be specified multiple times. Dimension filters can be applied to a dimension in the format <dimension-id>:<operator>:<filter-value>. Filter values can be case-insensitive (depending on the operator). Operators supported: EQ | IEQ | GT | GE | LT | LE | NE | LIKE | ILIKE | IN
záhlaví Ne Názvy záhlaví, které mají být vráceny jako součást odpovědi. One or more header names (separated by a comma).
relativePeriodDate Ne Overrides the start date, so relative periods will use this date as the starting date. Example: "2016-01-01"
ouMode Ne The mode for the selection of organization units. The default is DESCENDANTS, meaning all subunits in the hierarchy. CHILDREN refers to immediate children in the hierarchy; SELECTED refers to the selected organization units only. DESCENDANTS, CHILDREN, SELECTED
asc Ne Dimensions to be sorted ascending. Can reference to enrollment date, incident date, org unit name, and code. ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier>
desc Ne Dimensions to be sorted descending, can reference to enrollment date, incident date, org unit name and code. ouname | programstatus | createdbydisplayname | lastupdatedbydisplayname | enrollmentdate | incidentdate | lastupdated | <dimension identifier>
strana Ne The page number. The default value is 1. Numeric positive value.
pageSize Ne The page size. The default value is 50 (which means 50 items per page). Numeric zero or positive value.
displayProperty Ne Vlastnost k zobrazení pro metadata. NÁZEV | KRÁTKÝ NÁZEV
includeMetadataDetails Ne Zahrnuje podrobnosti o metadatech do odpovědi na nezpracovaná data. false | true
outputIdScheme Ne Identifier scheme used for metadata items in the query response. It accepts identifiers, codes, or attributes. UID | UUID | CODE | NAME | ATTRIBUTE:<ID>
dataIdScheme Ne Id scheme to be used for data, more specifically data elements and attributes that have an option set or legend set, e.g. return the name of the option instead of the code, or the name of the legend instead of the legend ID, in the data response. NAME | CODE | UID
programStatus Ne Specify enrollment status of events to include. DEPRECATED, prefer enrollmentStatus ACTIVE | COMPLETED | CANCELLED. Can be comma separated (for query only).
enrollmentStatus Ne Zadejte stav zápisu událostí, které chcete zahrnout. ACTIVE | COMPLETED | CANCELLED. Can be comma separated (for query only).
eventStatus Ne Specify the status of events to include. ACTIVE | COMPLETED | SCHEDULE | OVERDUE | SKIPPED. Can be comma separated (for query only).
coordinatesOnly Ne Whether to only return events that have coordinates. false | true
geometryOnly Ne Whether to only return events that have geometries. false | true
userOrgUnit Ne User organization unit identifier. Any organization unit identifier.
skipMeta Ne Skip metadata in the response. false | true
skipData Ne Skip data in the response. false | true
skipRounding Ne Skip rounding of data values. false | true
skipHeaders Ne Skip headers in the response. false | true
totalPages Ne Include the total number of pages in the response. false | true
displayProperty Ne Vlastnost k zobrazení pro metadata. NÁZEV | KRÁTKÝ NÁZEV

Dimenze

Five resources allow to easily retrieve data dimensions:

Výše uvedené zdroje sdílejí následující parametr požadavku:

Parametr dotazu Vyžadováno Popis Možnosti
filtr ne Umožňuje filtrování hodnot pole ve formátu:
filter=field:OP:value&filter=field:OP:value&...
Viz sekce filtrů dimenzí
pole ne Umožňuje filtrování polí
strana ne Číslo stránky Výchozí hodnota je 1 (první stránka)
pageSize ne Velikost stránky Výchozí hodnota je 50 prvků na stránku
stránkování ne Zakáže stránkování, když je false true nebo false, výchozí hodnota je true
řazení ne Umožňuje řazení ve formátu: order=field:direction Řaditelná pole: created (výchozí), lastUpdated, code, uid, id, name, displayName, dimensionType

Směr může být ASC (výchozí) nebo DESC

Filtry dimenzí

Dimensions endpoints support filtering the output to narrow down the response to desired elements. Filters are in the format filter=field:op:value&filter=field:op:value&...&filter=field:op:value.

Podporované hodnoty pole field jsou:

  • id/uid – id dimenze
  • code - kód rozměru
  • valueType – typ hodnoty dimenze
  • name – název dimenze
  • dimensionType - the type of the dimension
    • DATA_ELEMENT
    • PROGRAM_INDICATOR
    • PROGRAM_ATTRIBUTE
    • CATEGORY
    • CATEGORY_OPTION_GROUP_SET
  • displayName - displayName dimenze
  • displayShortName – displayShortName dimenze

Podporované op hodnoty jsou:

  • startsWith - pole začíná na
  • !startsWith - pole nezačíná
  • endsWith - pole končí na
  • !endsWith - field does not end with-
  • eq – rovná se
  • ieq - rovná se ignorování velkých a malých písmen
  • ne – nerovná se
  • like - obsahuje
  • !like - neobsahuje
  • jako - obsahuje, ignorování velkých a malých písmen
  • !like - neobsahuje ignorování velkých a malých písmen

Event analytics dimensions

Dimenze analýzy dotazů událostí

The /analytics/events/query/dimensions?programId={programId}&programStageId={programStageId} resource accepts:

  • a tracker program
  • a tracker programStage
  • both program and programStage

There are constraints on the combination of program and programStage:

  • If only program is specified, the resource returns data dimensions for each program stage in the provided program
  • If only programStage is specified, the resource returns data dimensions for the provided programStage
  • If both program and programStage are specified, the resource returns data dimensions for the provided programStage if it belongs to the provided program. Returns an error otherwise.

the returned data dimensions are:

  • Indikátory programu spojené s programem (odvozeno z programStageId)
  • Data elements of supported types in the program stage
  • Tracked entity attributes of supported types associated with the program (derived from programStageId)
  • Kategorie v kombinaci kategorií spojených s programem (odvozeno z programStageId)
  • Sady skupin možností kategorie typu ATTRIBUTE

All value types for data elements and tracked entity attributes are considered supported types, except IMAGE, FILE_RESOURCE and TRACKER_ASSOCIATE.

Dimenze souhrnu událostí

Zdroj /analytics/events/aggregate/dimensions?programStageId=... přijímá povinný parametr programStageId a vrací následující datové dimenze:

  • Data elements of supported types in the program stage
  • Tracked entity attributes of supported types associated with the program (derived from programStageId)
  • Kategorie v kombinaci kategorií spojených s programem (odvozeno z programStageId)
  • Sady skupin možností kategorie typu ATTRIBUTE přidružené k programu (odvozeno z programStageId)

Data elements and tracked entity attributes are considered supported types if their value type is one of the following:

  • NUMBER
  • UNIT_INTERVAL
  • PERCENTAGE
  • INTEGER
  • INTEGER_POSITIVE
  • INTEGER_NEGATIVE
  • INTEGER_ZERO_OR_POSITIVE
  • BOOLEAN
  • TRUE_ONLY

Enrollment analytics dimensions

Dimenze analýzy dotazů zápisu

Zdroj /analytics/enrollments/query/dimensions?programId=... přijímá povinné ID sledovacího programu a vrací následující datové dimenze:

  • Indikátory programu připojené k programu
  • Data elements of supported types in the program, with program stage for each data element
  • Tracked entity attributes of supported types associated with the program that are not confidential

All value types for data elements and tracked entity attributes are considered supported types, except IMAGE, FILE_RESOURCE and TRACKER_ASSOCIATE.

Dimenze souhrnu zápisu{ #webapi_enrollment_aggregate_analytics_dimension }

Zdroj /analytics/enrollments/aggregate/dimensions?programId=... přijímá povinné ID trasovacího programu odkazující na program s registrací a vrací následující dimenze dat:

  • Data elements of supported types in the program, with program stage for each data element
  • Tracked entity attributes of supported types associated with the program that are not confidential

Data elements and tracked entity attributes are considered supported types if their value type is one of the following:

  • NUMBER
  • UNIT_INTERVAL
  • PERCENTAGE
  • INTEGER
  • INTEGER_POSITIVE
  • INTEGER_NEGATIVE
  • INTEGER_ZERO_OR_POSITIVE
  • BOOLEAN
  • TRUE_ONLY

Tracked Entities analytics dimensions

Tracked Entities query analytics dimensions

The /analytics/teis/query/dimensions?trackedEntityType=TET resource accepts a mandatory id of a tracked entity type TET and returns the following data dimensions:

for each program P associated with a tracked entity instance of type TET: - Program indicators associated to P - Data elements of supported types in P, with program stage for each data element - Tracked entity attributes of supported types associated with the program that are not confidential - Program attributes of P

All value types for data elements and tracked entity attributes are considered supported types, except IMAGE, FILE_RESOURCE and TRACKER_ASSOCIATE.

Sample request and response

GET /api/analytics/teis/query/dimensions?programStageId=A03MvHHogjR&order=code&filter=name:ilike:weight
{
   "page":1,
   "total":5,
   "pageSize":50,
   "dimensions":[
      {
         "dimensionType":"PROGRAM_INDICATOR",
         "created":"2015-08-06T22:49:20.128",
         "lastUpdated":"2015-08-06T22:51:19.787",
         "name":"Measles + Yellow fever doses low infant weight",
         "displayName":"Measles + Yellow fever doses low infant weight",
         "id":"tt54DiKuQ9c",
         "uid":"tt54DiKuQ9c",
         "displayShortName":"Measles + Yellow fever doses low infant weight"
      },
      {
         "dimensionType":"PROGRAM_INDICATOR",
         "created":"2017-01-20T10:32:26.388",
         "lastUpdated":"2017-01-20T10:32:26.388",
         "name":"Weight gain(in g) between birth and last postnatal",
         "displayName":"Weight gain(in g) between birth and last postnatal",
         "id":"qhTkqwAJLMv",
         "uid":"qhTkqwAJLMv",
         "displayShortName":"Weight gain(g)"
      },
      {
         "dimensionType":"PROGRAM_INDICATOR",
         "created":"2015-09-14T20:25:55.543",
         "lastUpdated":"2018-08-28T12:22:47.857",
         "name":"Average weight (g)",
         "displayName":"Average weight (g)",
         "id":"GxdhnY5wmHq",
         "uid":"GxdhnY5wmHq",
         "displayShortName":"Average weight (g)"
      },
      {
         "dimensionType":"PROGRAM_INDICATOR",
         "created":"2015-08-06T22:35:40.391",
         "lastUpdated":"2015-08-06T22:35:40.391",
         "name":"BCG doses low birth weight",
         "displayName":"BCG doses low birth weight",
         "id":"hCYU0G5Ti2T",
         "uid":"hCYU0G5Ti2T",
         "displayShortName":"BCG doses low birth weight"
      },
      {
         "valueType":"NUMBER",
         "dimensionType":"DATA_ELEMENT",
         "created":"2012-09-20T17:37:45.474",
         "lastUpdated":"2014-11-11T21:56:05.418",
         "name":"MCH Weight (g)",
         "displayName":"MCH Weight (g)",
         "id":"A03MvHHogjR.UXz7xuGCEhU",
         "uid":"UXz7xuGCEhU",
         "code":"DE_2005736",
         "displayShortName":"Weight (g)"
      }
   ]
}

Analytika Organizační jednotky

Rozhraní API pro analýzu organizačních jednotek poskytuje statistiku o organizačních jednotkách klasifikovaných podle sad skupin organizačních jednotek, tj. Počty organizačních jednotek na skupinu organizačních jednotek v rámci sad skupin organizačních jednotek.

GET /api/orgUnitAnalytics?ou=<org-unit-id>&ougs=<org-unit-group-set-id>

API vyžaduje alespoň jednu organizační jednotku a alespoň jednu sadu skupin organizačních jednotek. Lze poskytnout více organizačních jednotek a skupinových skupin oddělených středníkem.

Parametry požadavku databázového dotazu

Prostředek analytiky organizační jednotky vám umožní určit řadu parametrů dotazu:

Tabulka: Parametry analytického dotazu organizační jednotky

Vlastnictví Popis Požadované
ou Identifikátory organizační jednotky, případně oddělené středníkem. Ano
ougs Identifikátory sady skupin organizačních jednotek, potenciálně oddělené středníkem. Ano
sloupce Identifikátory sady skupin organizačních jednotek, potenciálně oddělené středníkem. Definuje, které sady skupin se vykreslí jako sloupce v rozložení tabulky. Ne

Odpověď bude obsahovat sloupec pro nadřazenou organizační jednotku, sloupce pro každou skupinu organizačních jednotek jako část požadavku a sloupec pro počet. Statistiky zahrnují počet organizačních jednotek, které jsou součástí podhierarchie organizačních jednotek uvedených v požadavku. Odpověď obsahuje část metadat, která určuje název každé organizační jednotky a části skupiny organizační jednotky a části odpovědí, na kterou odkazují jejich identifikátory.

Výchozí odpověď je normalizována pomocí jediného sloupce count Odpověď lze vykreslit v rozložení tabulky zadáním alespoň jedné sady skupin organizačních jednotek pomocí parametru dotazu columns.

Formáty odpovědí

Koncový bod analytiky jednotky org podporuje následující formáty reprezentace:

  • json (application/json)
  • csv (application/csv)
  • xls (application/vnd.ms-excel)
  • pdf (application/pdf)

Příklady

Načtení analytiky organizačních jednotek pro organizační jednotku a sadu skupin organizačních jednotek:

GET /api/orgUnitAnalytics?ou=lc3eMKXaEfw&ougs=J5jldMd8OHv

Chcete-li načíst analytická data jednotky org pro dvě jednotky org a dvě sady skupin jednotek org:

GET /api/orgUnitAnalytics?ou=lc3eMKXaEfw;PMa2VCrupOd&ougs=J5jldMd8OHv;Bpx0589u8y0

Pokud chcete načíst analytická data organizační jednotky v režimu tabulky s jednou sadou skupin vykreslenou jako sloupce:

GET /api/orgUnitAnalytics?ou=fdc6uOvgoji;jUb8gELQApl;lc3eMKXaEfw;PMa2VCrupOd
  &ougs=J5jldMd8OHv&columns=J5jldMd8OHv

Omezení a validace

Možné chyby v ověření konkrétně pro analytické API org jednotky jsou popsány v tabulce níže. Relevantní jsou také některé chyby zadané pro agregované analytické API.

Chybový kód Zpráva
E7300 Musí být uvedena alespoň jedna organizační jednotka
E7301 Musí být zadána alespoň jedna sada skupin organizačních jednotek

Zpráva o souboru dat

Data set reports can be generated through the web api using the /dataSetReport resource. This resource generates reports on data set and returns the result in the form of an HTML table.

/api/dataSetReport

Parametry požadavku databázového dotazu

Požadavek podporuje následující parametry:

Tabulka: Parametry dotazu sestavy datové sady

Parametr Popis Typ Požadované
ds Sada dat, ze které se má vytvořit sestava. UID datové sady Ano
pe Období, ze kterého (kterých) se má sestava vytvořit. Může to být seznam oddělený čárkami. Řetězec ISO Ano
ou Organizační jednotka, ze které se má sestava vytvořit. UID organizační jednotky Ano
filtr Filtry, které se mají použít jako filtry pro sestavu. Lze libovolněkrát opakovat. Dodržuje syntaxi analytického rozhraní API. Jedno nebo více UID Ne
selectedUnitOnly Zda použít pouze zachycená data nebo agregovaná data. Boolean Ne

Prostředek sestavy datové sady přijímá pouze požadavky GET. Typ obsahu odpovědi je application/json a vrací data v mřížce. Tento koncový bod funguje pro všechny typy datových sad, včetně výchozích, sekčních a vlastních formulářů.

Příklad požadavku na načtení přehledu pro měsíční soubor dat a organizační jednotku za říjen 2018 vypadá takto:

GET /api/dataSetReport?ds=BfMAe6Itzgt&pe=201810&ou=ImspTQPwCqd&selectedUnitOnly=false

Příklad požadavku na načtení přehledu pro měsíční soubor dat a organizační jednotku za říjen, listopad a prosinec 2018 vypadá takto:

GET /api/dataSetReport?ds=BfMAe6Itzgt&pe=201810,201811,201812&ou=ImspTQPwCqd&selectedUnitOnly=false

Chcete-li získat sestavu datové sady s filtrem, můžete použít parametr filter. V tomto případě je filtr založen na sadě skupin org jednotek a dvou skupinách org jednotek:

GET /api/dataSetReport?ds=BfMAe6Itzgt&pe=201810&ou=ImspTQPwCqd
  &filter=J5jldMd8OHv:RXL3lPSK8oG;tDZVQ1WtwpA

Formáty odpovědí

Koncový bod sestavy datové sady podporuje výstup v následujících formátech. Konkrétní koncový bod můžete načíst pomocí přípony souboru nebo záhlaví HTTP Accept.

  • json (application/json)
  • pdf (application/pdf)
  • xls (application/vnd.ms-excel)

Vlastní formuláře

Pro datové sady s vlastními formuláři HTML je k dispozici vyhrazený koncový bod. Tento koncový bod vrací obsah formuláře HTML s typem obsahu text/html s vloženými daty. Všimněte si, že koncový bod sestavy obecné sady dat můžete použít také pro sady dat s vlastními formuláři; to však vrátí zprávu ve formátu JSON jako mřížku. Tento koncový bod funguje pouze pro datové sady s vlastními formuláři HTML.

GET /api/dataSetReport/custom

Syntaxe pro tento koncový bod se jinak rovná koncovému bodu sestavy obecné sady dat. Chcete-li načíst vlastní sestavu datové sady HTML, můžete vystavit požadavek takto:

GET /api/dataSetReport/custom?ds=lyLU2wR22tC&pe=201810&ou=ImspTQPwCqd

Nabízená analýza

The push analysis API includes endpoints for previewing a push analysis report for the logged in user and manually triggering the system to generate and send push analysis reports, in addition to the normal CRUD operations. When using the create and update endpoints for push analysis, the push analysis will be scheduled to run based on the properties of the push analysis. When deleting or updating a push analysis to be disabled, the job will also be stopped from running in the future.

To get an HTML preview of an existing push analysis, you can do a GET request to the following endpoint:

/api/pushAnalysis/<id>/render

To manually trigger a push analysis job, you can do a POST request to this endpoint:

/api/pushAnalysis/<id>/run

A push analysis consists of the following properties, where some are required to automatically run push analysis jobs:

Tabulka: Vlastnosti analýzy tlaku

Vlastnictví Popis Typ Požadované
ovládací panel Ovládací panel, na kterém jsou založeny přehledy Dashboard UID Ano
message Zobrazuje se za názvem v přehledech Řetězec Ne
recipientUserGroups Sada uživatelských skupin, které by měly dostávat zprávy Jedno nebo více UID skupiny uživatelů Ne. Naplánované úlohy bez příjemce budou přeskočeny.
povoleno Označuje, zda má být tato analýza push naplánována nebo ne. Ve výchozím nastavení False. Boolean Ano. Aby bylo možné naplánovat, musí to být pravda.
schedulingFrequency Četnost hlášení by měla být naplánována. "DAILY", "WEEKLY", "MONTHLY" Ne. Push analýza bez frekvence nebude naplánována
schedulingDayOfFrequency Den ve frekvenci, kdy by měla být úloha naplánována. Celé číslo. Jakákoli hodnota, když je frekvence "DAILY". 0-7, když je frekvence "WEEKLY". 1-31, když je frekvence "MONTHLY" Ne. Push analýza bez platného dne frekvence pro nastavenou frekvenci nebude naplánována.

Analýza využití dat

Rozhraní API pro analýzu používání umožňuje přístup k informacím o tom, jak lidé používají DHIS2 na základě analýzy dat. Když uživatelé přistupují k oblíbeným položkám, zaznamená se událost. Událost se skládá ze jména uživatele, UID oblíbené položky, času, kdy k události došlo, a typu události. Různé typy událostí jsou uvedeny v tabulce.

/api/dataStatistics

The usage analytics API lets you retrieve aggregated snapshots of usage analytics based on time intervals. The API captures user views (for example the number of times a chart or pivot table has been viewed by a user) and saved analysis favorites (for example favorite charts and pivot tables). DHIS2 will capture nightly snapshots which are then aggregated at request.

Parametry požadavku databázového dotazu

Rozhraní API pro analýzu využití (statistiku dat) podporuje dvě operace:

  • POST: creates a view event

  • GET: načte agregované statistiky

Vytvoření události zobrazení (POST)

The usage analytics API lets you create event views. The dataStatisticsEventType parameter describes what type of item was viewed. The favorite parameter indicates the identifier of the relevant favorite.

URL, které vytváří nové zobrazení událostí grafů:

POST /api/dataStatistics?eventType=CHART_VIEW&favorite=LW0O27b7TdD

A successful save operation returns an HTTP status code 201. The table below shows the supported types of events.

Tabulka: Podporované typy událostí

Klíč Popis
VISUALIZATION_VIEW Vizualizační pohled
MAP_VIEW Zobrazení mapy (GIS)
EVENT_REPORT_VIEW Zobrazení přehledu událostí
EVENT_CHART_VIEW Zobrazení grafu událostí
EVENT_VISUALIZATION_VIEW Zobrazení vizualizace události
DASHBOARD_VIEW Zobrazení Ovládacího panelu
PASSIVE_DASHBOARD_VIEW Zobrazení ovládacího panelu (pokud není výslovně vybrán ovládací panel)
DATA_SET_REPORT_VIEW Zobrazení přehledu datové sady

Načíst agregovaný analytický přehled využití (GET)

The usage analytics (data statistics) API lets you specify certain query parameters when asking for an aggregated report.

Tabulka: Parametry dotazu pro agregovanou analýzu využití (statistiky dat)

Parametr dotazu Požadované Popis Možnosti
startDate Ano Datum zahájení období Datum ve formátu yyyy-MM-dd
endDate Ano Datum ukončení období Datum ve formátu yyyy-MM-dd
interval Ano Typ intervalu, který se má agregovat DAY, WEEK, MONTH, YEAR

The startDate and endDate parameters specify the period for which snapshots are to be used in the aggregation. You must format the dates as shown above. If no snapshots are saved in the specified period, an empty list is sent back. The parameter called interval specifies what type of aggregation will be done.

API query that creates a query for a monthly aggregation:

GET /api/dataStatistics?startDate=2014-01-02&endDate=2016-01-01&interval=MONTH

Načíst hlavní oblíbené položky

Rozhraní API pro analýzu využití vám umožňuje načíst nejoblíbenější oblíbené položky používané v DHIS2 a podle uživatele.

Tabulka: Parametry dotazu na oblíbené položky

Parametr dotazu Požadované Popis Možnosti
eventType Ano Typ události statistiky dat Viz výše uvedená tabulka
pageSize Ne Velikost vráceného seznamu Například 5, 10, 25. Výchozí hodnota je 25
sortOrder Ne Sestupně nebo vzestupně ASC nebo DESC. Výchozí hodnota je DESC.
uživatelské jméno Ne Pokud je zadáno, odpověď bude obsahovat pouze oblíbené položky tohoto uživatele. Například 'admin'

The API query can be used without a username, and will then find the top favorites of the system.

/api/dataStatistics/favorites?eventType=CHART_VIEW&pageSize=25&sortOrder=ASC

Pokud je zadáno uživatelské jméno, odpověď bude obsahovat pouze nejoblíbenější oblíbené uživatele.

/api/dataStatistics/favorites?eventType=CHART_VIEW&pageSize=25
  &sortOrder=ASC&username=admin

Formát odpovědi

You can return the aggregated data in a usage analytics response in several representation formats. The default format is JSON. The available formats and content types are:

  • json (application/json)

  • xml (application/xml)

  • html (text/html)

Databázový dotaz API, který požaduje odpověď na analýzu využití ve formátu XML:

/api/dataStatistics.xml?startDate=2014-01-01&endDate=2016-01-01&interval=WEEK

Postup získání odpovědi na analýzu využití ve formátu JSON:

/api/dataStatistics?startDate=2016-02-01&endDate=2016-02-14&interval=WEEK

Odpověď JSON vypadá takto:

[
  {
    "year": 2016,
    "week": 5,
    "mapViews": 2181,
    "chartViews": 2227,
    "reportTableViews": 5633,
    "eventReportViews": 6757,
    "eventChartViews": 9860,
    "eventVisualizationViews": 2387,
    "dashboardViews": 10082,
    "passiveDashboardViews": 0,
    "totalViews": 46346,
    "averageViews": 468,
    "averageMapViews": 22,
    "averageChartViews": 22,
    "averageReportTableViews": 56,
    "averageEventReportViews": 68,
    "averageEventChartViews": 99,
    "averageEventVisualizationViews": 10,
    "averageDashboardViews": 101,
    "averagePassiveDashboardViews": 0,
    "savedMaps": 1805,
    "savedCharts": 2205,
    "savedReportTables": 1995,
    "savedEventReports": 1679,
    "savedEventCharts": 1613,
    "savedEventVisualizations": 1231,
    "savedDashboards": 0,
    "savedIndicators": 1831,
    "activeUsers": 99,
    "users": 969
  },
  {
    "year": 2016,
    "week": 6,
    "mapViews": 2018,
    "chartViews": 2267,
    "reportTableViews": 4714,
    "eventReportViews": 6697,
    "eventChartViews": 9511,
    "dashboardViews": 12181,
    "passiveDashboardViews": 0,
    "totalViews": 47746,
    "averageViews": 497,
    "averageMapViews": 21,
    "averageChartViews": 23,
    "averageReportTableViews": 49,
    "averageEventReportViews": 69,
    "averageEventChartViews": 99,
    "averageDashboardViews": 126,
    "averagePassiveDashboardViews": 0,
    "savedMaps": 1643,
    "savedCharts": 1935,
    "savedReportTables": 1867,
    "savedEventReports": 1977,
    "savedEventCharts": 1714,
    "savedDashboards": 0,
    "savedIndicators": 1646,
    "activeUsers": 96,
    "users": 953
  }
]

Note that the number of activeUsers indicates the number of distinct users who had any events during the requested time period. The number of users represents the total number of users in the system (both enabled and disabled).

Načíst statistiky oblíbené položky

You can retrieve the number of view for a specific favorite by using the favorites resource, where {favorite-id} should be substituted with the identifier of the favorite of interest:

/api/dataStatistics/favorites/{favorite-id}.json

The response will contain the number of views for the given favorite and look like this:

{
  "views": 3
}

Geoprostorové prvky

The geoFeatures resource lets you retrieve geospatial information from DHIS2. Geospatial features are stored together with organisation units. The syntax for retrieving features is identical to the syntax used for the organisation unit dimension for the analytics resource. It is recommended to read up on the analytics api resource before continuing to read this section. You must use the GET request type, and only JSON response format is supported.

As an example, to retrieve geo features for all organisation units at level 3 in the organisation unit hierarchy you can use a GET request with the following URL:

/api/geoFeatures.json?ou=ou:LEVEL-3

To retrieve geo features for organisation units at a level within the boundary of an organisation unit (e.g. at level 2) you can use this URL:

/api/geoFeatures.json?ou=ou:LEVEL-4;O6uvpzGd5pu

Hodnotu souřadnic odezvy lze číst ze dvou vlastností, o kterých rozhoduje parametr coordinateField. - Vlastnost geometry OrganisationUnit: toto je výchozí chování, které se použije, když není zadán parametr coordinateField. - Atribut OrgansationUnit typu hodnoty GeoJSON: API použije zadaný coordinateField={attributeId} k získání souřadnic GeoJSON z této hodnoty atributu.

Chcete-li například načíst geografické prvky pro všechny organizační jednotky na úrovni 3, jak je uvedeno výše, ale získat souřadnice z atributu OrganisationUnit tJqtSV4quLb

/api/geoFeatures.json?ou=ou:LEVEL-3&coordinateField=tJqtSV4quLb

The semantics of the response properties are described in the following table.

Tabulka: Odezva geografických funkcí

Vlastnictví Popis
id Identifikátor organizační jednotky / geografického prvku
na Název organizační jednotky / geografického prvku
hcd Má souřadnice dole, označující, zda existuje jedna nebo více podřízených organizačních jednotek se souřadnicemi (níže v hierarchii)
hcu Má souřadnice nahoru, což označuje, zda má nadřazená organizační jednotka souřadnice (výše v hierarchii)
le Úroveň této organizační jednotky / geografické funkce.
pg Nadřazený graf, graf identifikátorů nadřazených organizačních jednotek až po kořen v hierarchii
pi Parent identifier, identifikátor nadřazeného této organizační jednotky
pn Parent name, název nadřazeného této organizační jednotky
ty Typ geografického prvku, 1 = bod a 2 = mnohoúhelník nebo multi-polygon
co Souřadnice tohoto geografického prvku

GeoJSON

To export GeoJSON, you can simply add .geosjon as an extension to the endpoint /api/organisationUnits, or you can use the Accept header application/json+geojson.

Jsou podporovány dva parametry: level (výchozí je 1) a parent (výchozí jsou kořenové organizační jednotky). Oba mohou být zahrnuty vícekrát. Nějaké příklady:

Získejte všechny funkce na úrovni 2 a 4:

/api/organisationUnits.geojson?level=2&level=4

Získejte všechny funkce na úrovni 3 s organizační jednotkou která určuje hranice:

/api/organisationUnits.geojson?parent=fdc6uOvgoji&level=3

Hooks analytické tabulky

Analytics table hooks provide a mechanism for invoking SQL scripts during different phases of the analytics table generation process. This is useful for customizing data in resource and analytics tables, e.g. in order to achieve specific logic for calculations and aggregation. Analytics table hooks can be manipulated at the following API endpoint:

/api/analyticsTableHooks

The analytics table hooks API supports the standard HTTP CRUD operations for creating (POST), updating (PUT), retrieving (GET) and deleting (DELETE) entities.

Hooks pole

Hooks analytické tabulky mají následující pole:

Tabulka: Pole pro hooks tabulky Analytics

Pole Možnosti Popis
název Text Název hook.
phase RESOURCE_TABLE_POPULATED, ANALYTICS_TABLE_POPULATED Fáze, kdy má být SQL skript vyvolán.
resourceTableType Viz sloupec "Typ tabulky" v tabulce "Fáze, typy tabulek a dočasné tabulky" níže Typ tabulky prostředků, pro kterou se má vyvolat skript SQL. Platí pouze pro háky definované ve fázi RESOURCE_TABLE_POPULATED.
analyticsTableType Viz sloupec "Typ tabulky" v tabulce "Fáze, typy tabulek a dočasné tabulky" níže Typ analytické tabulky, pro kterou se má vyvolat skript SQL. Platí pouze pro háky definované ve fázi ANALYTICS_TABLE_POPULATED.
sql Text SQL skript, který se má vyvolat.

The ANALYTICS_TABLE_POPULATED phase takes place after the analytics table has been populated, but before indexes have been created and the temp table has been swapped with the main table. As a result, the SQL script should refer to the analytics temp table, e.g. analytics_temp, analytics_completeness_temp, analytics_event_temp_ebayegv0exc.

This applies also to the RESOURCE_TABLE_POPULATED phase, which takes place after the resource table has been populated, but before indexes have been created and the temp table has been swapped with the main table. As a result, the SQL script should refer to the resource temp table, e.g. _orgunitstructure_temp, _categorystructure_temp.

You should define only one of the resourceTableType and analyticsTableType fields, depending on which phase is defined.

You can refer to the temporary database table which matches the specified hook table type only (other temporary tables will not be available). As an example, if you specify ORG_UNIT_STRUCTURE as the resource table type, you can refer to the _orgunitstructure_temp temporary database table only.

V následující tabulce jsou uvedeny platné kombinace fází, typů tabulek a dočasných tabulek.

Tabulka: Fáze, typy tabulek a dočasné tabulky

Fáze Typ tabulky Dočasná tabulka
RESOURCE_TABLE_POPULATED ORG_UNIT_STRUCTURE _orgunitstructure_temp
DATA_SET_ORG_UNIT_CATEGORY _datasetorgunitcategory_temp
CATEGORY_OPTION_COMBO_NAME _categoryoptioncomboname_temp
DATA_ELEMENT_GROUP_SET_STRUCTURE _dataelementgroupsetstructure_temp
INDICATOR_GROUP_SET_STRUCTURE _indicatorgroupsetstructure_temp
ORG_UNIT_GROUP_SET_STRUCTURE _organisationunitgroupsetstructure_temp
CATEGORY_STRUCTURE _categorystructure_temp
DATA_ELEMENT_STRUCTURE _dataelementstructure_temp
PERIOD_STRUCTURE _periodstructure_temp
DATE_PERIOD_STRUCTURE _dateperiodstructure_temp
DATA_ELEMENT_CATEGORY_OPTION_COMBO _dataelementcategoryoptioncombo_temp
DATA_APPROVAL_MIN_LEVEL _dataapprovalminlevel_temp
ANALYTICS_TABLE_POPULATED DATA_VALUE analytics_temp
COMPLETENESS analytics_completeness_temp
COMPLETENESS_TARGET analytics_completenesstarget_temp
ORG_UNIT_TARGET analytics_orgunittarget_temp
EVENT analytics_event_temp_{program-uid}
ZÁPIS analytics_enrollment_temp_{program-uid}
VALIDATION_RESULT analytics_validationresult_temp

Vytváření hooks

To create a hook which should run after the resource tables have been populated you can do a POST request like this using JSON as content type:

POST /api/analyticsTableHooks
{
  "name": "Update 'Area' in org unit group set resource table",
  "phase": "RESOURCE_TABLE_POPULATED",
  "resourceTableType": "ORG_UNIT_GROUP_SET_STRUCTURE",
  "sql": "update _organisationunitgroupsetstructure_temp set \"uIuxlbV1vRT\" = 'b0EsAxm8Nge'"
}

To create a hook which should run after the data value analytics table has been populated you can do a POST request like this using JSON format:

{
  "name": "Update 'Currently on treatment' data in analytics table",
  "phase": "ANALYTICS_TABLE_POPULATED",
  "analyticsTableType": "DATA_VALUE",
  "sql": "update analytics_temp set monthly = '200212' where monthly in ('200210', '200211')"
}

To create a hook which should run after the event analytics tables are populated you can do a POST request like this using JSON format:

{
  "name": "Delete data for a data element",
  "phase": "ANALYTICS_TABLE_POPULATED",
  "analyticsTableType": "EVENT",
  "sql": "delete from analytics_event_temp_lxaq7zs9vyr where dx = 'uDX9LKGRwaH'"
}

Konverze SVG

The Web API provides a resource which can be used to convert SVG content into more widely used formats such as PNG and PDF. Ideally this conversion should happen on the client side, but not all client side technologies are capable of performing this task. Currently PNG and PDF output formats are supported. The SVG content itself should be passed with a svg query parameter, and an optional query parameter filename can be used to specify the filename of the response attachment file. Note that the file extension should be omitted. For PNG you can send a POST request to the following URL with Content-type application/x-www-form-urlencoded, identical to a regular HTML form submission.

api/svg.png

For PDF you can send a POST request to the following URL with content-type application/x-www-form-urlencoded.

api/svg.pdf

Tabulka: Parametry databázového dotazu

Parametr dotazu Požadované Popis
svg Ano Obsah SVG
název souboru Ne Název souboru pro vrácenou přílohu bez přípony souboru

Analytics outlier detection

The analytics outliert API provides endpoints for investigation of the data quality based on Z Score and Modified Z Score. Both scores are statistical measures that help analyze and interpret data in the context of deviations from the middle value. They are particularly useful in identifying outliers or extreme values in a dataset. The API is implemented as a single analytics endpoint:

  • /api/analytics/outlierDetection

Request

Query parameters

Parametr dotazu Popis Požadované Možnosti (nejprve výchozí)
ds Datová sada Ano Identifikátor datové sady
startDate Start date for interval tocheck for outliers No (relative date period is mandatory in this case) Date (yyyy-MM-dd)
endDate End date for interval to check for outliers No (relative date period is mandatory in this case) Date (yyyy-MM-dd)
pe ISO periods and relative periods No (start and end date is mandatory in this case) see "date and period format"
relativePeriodDate Datum použité jako základ pro relativní období. Ne Date (yyyy-MM-dd)
ou Organisation unit, organisation unit level or groups (can be combined) Ne Organisation unit (level, group) identifier
záhlaví The name of the headers to be returned as part of the response. One or more headers name separated by comma Ne (NULL), dx, dxname, pename, pe ...
orderBy Sort the records on the value column Ne absdev, zscore, modifiedzscore, median, mean, stddev, medianabsdeviation, lowerbound, upperbound
sortOrder Sort the records on the value column in ascending or descending order Ne ASC, DESC
algoritmus Algorithm to use for outlier detection Ne Z_SCORE, MODIFIED_Z_SCORE
práh Threshold for outlier values Z_SCORE or MODIFIED_Z_SCORE Ne Numeric, greater than zero. Default: 3.0
inputIdScheme Schéma identifikátoru, které se má použít pro položky metadat v požadavku na dotaz, může být identifikátor, kód nebo atributy. Ne UID, ID, CODE, NAME
maxResults Maximum rows (responses) Ne 500
skipRounding Skip rounding of data values, i.e. provide fine precision (scale 10). Ne false, true

Request example

GET api/analytics/outlierDetection?ds=BfMAe6Itzgt&ou=ImspTQPwCqd&startDate=2022-07-26&endDate=2022-10-26&algorithm=Z_SCORE&maxResults=30&orderBy=value&threshold=3.0&sortOrder=asc&outputIdScheme=code

Response

Response is delivered in several representation formats. The default format is JSON. The available formats and content types are:

  • json (application/json)
  • xml (application/xml)
  • xsl (application/vnd.ms-excel)
  • csv (application/csv)
  • html (text/html)
  • html+css (text/html)

Response example

{
    "headers": [
        {
            "name": "dx",
            "column": "Data",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "dxname",
            "column": "Data name",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "pe",
            "column": "Period",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "pename",
            "column": "Period name",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "ou",
            "column": "Organisation unit",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "ouname",
            "column": "Organisation unit name",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "ounamehierarchy",
            "column": "Organisation unit name hierarchy",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "coc",
            "column": "Category option combo",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "cocname",
            "column": "Category option combo name",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "aoc",
            "column": "Attribute option combo",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "aocname",
            "column": "Attribute option combo name",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": false
        },
        {
            "name": "value",
            "column": "Value",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "mean",
            "column": "Mean",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "stddev",
            "column": "Standard deviation",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "absdev",
            "column": "Absolute deviation",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "zscore",
            "column": "zScore",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "lowerbound",
            "column": "Lower boundary",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        },
        {
            "name": "upperbound",
            "column": "Upper boundary",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        }
    ],
    "metaData": {
        "maxResults": 30,
        "count": 3,
        "orderBy": "VALUE",
        "threshold": 3.0,
        "algorithm": "Z_SCORE"
    },
    "rowContext": {},
    "width": 18,
    "rows": [
        [
            "DE_22",
            "Q_Early breastfeeding (within 1 hr after delivery) at BCG",
            "202209",
            "September 2022",
            "OU_204860",
            "Sandaru CHC",
            "/Sierra Leone/Kailahun/Penguia/Sandaru CHC",
            "COC_292",
            "Fixed, <1y",
            "default",
            "default",
            "105.0",
            "18.3",
            "28.7",
            "86.7",
            "3.0",
            "-67.9",
            "104.4"
        ],
        [
            "DE_359706",
            "BCG doses given",
            "202208",
            "August 2022",
            "OU_595",
            "Ngalu CHC",
            "/Sierra Leone/Bo/Bargbe/Ngalu CHC",
            "COC_292",
            "Fixed, <1y",
            "default",
            "default",
            "220.0",
            "41.6",
            "57.4",
            "178.3",
            "3.1",
            "-130.7",
            "213.9"
        ],
        [
            "DE_35",
            "Yellow Fever doses given",
            "202209",
            "September 2022",
            "OU_1027",
            "Yemoh Town CHC",
            "/Sierra Leone/Bo/Kakua/Yemoh Town CHC",
            "COC_292",
            "Fixed, <1y",
            "default",
            "default",
            "466.0",
            "48.1",
            "114.2",
            "417.8",
            "3.6",
            "-294.6",
            "391.0"
        ]
    ],
    "headerWidth": 18,
    "height": 3
}

Statistics in response

Statistical Measure Header name Popis Odkaz
Hodnota value The data set/ data element numeric value (Penta1 doses given, Measles doses given, etc.)
Mean mean The average value of a set of numbers. Calculated by summing all values and dividing by the count. https://www.khanacademy.org/math/statistics-probability/summarizing-quantitative-data
Standard Deviation stddev A measure of the amount of variation or dispersion in a set of values. https://www.statisticshowto.com/probability-and-statistics/standard-deviation/
Absolute Deviation absdev The absolute difference between each data value and the middle value. https://www.mathsisfun.com/data/mean-absolute-deviation.html
Z Score zscore A standardized score that represents how many standard deviations a data value is from the mean. https://www.statisticshowto.com/probability-and-statistics/z-score/
Modified Z Score modifiedzscore Similar to the Z score but robust to outliers. It uses the median and median absolute deviation. https://www.statisticshowto.com/modified-z-scores/
Median Absolute Deviation medianabsdeviation A robust measure of the spread of data values, calculated as the median of the absolute deviations from the median. https://math.stackexchange.com/questions/2232309/median-absolute-deviation-mad-formula
Minimum lowerbound The minimum is the smallest value in a dataset. It represents the lowest observed value among all the data values.
Maximum upperbound The maximum is the largest value in a dataset. It represents the highest observed value among all the data values.

Error messages

NOTE: All messages are delivered with http status code 409.

Kód Zpráva
E2200 At least one data element must be specified.
E2201 Start date and end date or relative period must be specified.
E2202 Start date must be before end date.
E2203 Musí být uvedena alespoň jedna organizační jednotka.
E2204 Threshold must be a positive number.
E2205 Max results must be a positive number.
E2206 Max results exceeds the allowed max limit: 500.
E2207 Data start date must be before data end date.
E2208 Non-numeric data values encountered during outlier value detection.
E2209 Data start date not allowed.
E2210 Data end date not allowed.
E2211 Algorithm min-max values not allowed.
E2212 Specifying both a start date/end date and a relative period is not allowed.
E2213 Value of param orderBy is not compatible with algorithm Z_SCORE.
E7180 The analytics outliers data does not exist. Please ensure analytics job was run and did not skip the outliers.
E7181 Column dxname specified in orderBy, is not eligible for orderBy or does not exist.

NOTE: The values in error messages are examples only

Error message example

{
    "httpStatus": "Conflict",
    "httpStatusCode": 409,
    "status": "ERROR",
    "message": "Start date and end date or relative period must be specified",
    "errorCode": "E2201"
}

Analytics query execution plan and costs including execution time estimation

The analytics API provides endpoints for investigation of query performance issues. It is implemented as part of all analytics endpoints:

  • analytics/explain
  • analytics/event/explain
  • analytics/enrollment/explain

Příklad

GET /api/analytics/explain?displayProperty=NAME
  &dimension=dx:Uvn6LCg7dVU;sB79w2hiLp8,ou:USER_ORGUNIT
  &filter=pe:THIS_YEAR&includeNumDen=false&skipMeta=false
  &skipData=true&includeMetadataDetails=true

The response looks like this.

{
    "headers": [
        {
            "name": "dx",
            "column": "Data",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": true
        },
        {
            "name": "ou",
            "column": "Organisation unit",
            "valueType": "TEXT",
            "type": "java.lang.String",
            "hidden": false,
            "meta": true
        },
        {
            "name": "value",
            "column": "Value",
            "valueType": "NUMBER",
            "type": "java.lang.Double",
            "hidden": false,
            "meta": false
        }
    ],
    "metaData": {
        "items": {
            "ImspTQPwCqd": {
                "uid": "ImspTQPwCqd",
                "code": "OU_525",
                "name": "Sierra Leone",
                "dimensionItemType": "ORGANISATION_UNIT",
                "valueType": "NUMBER",
                "totalAggregationType": "SUM"
            },
            "sB79w2hiLp8": {
                "uid": "sB79w2hiLp8",
                "name": "ANC 3 Coverage",
                "description": "Total 3rd ANC visits (Fixed and outreach) by expected number of pregnant women.",
                "legendSet": "fqs276KXCXi",
                "dimensionItemType": "INDICATOR",
                "valueType": "NUMBER",
                "totalAggregationType": "AVERAGE",
                "indicatorType": {
                    "name": "Per cent",
                    "displayName": "Per cent",
                    "factor": 100,
                    "number": false
                }
            },
            "dx": {
                "uid": "dx",
                "name": "Data",
                "dimensionType": "DATA_X"
            },
            "pe": {
                "uid": "pe",
                "name": "Period",
                "dimensionType": "PERIOD"
            },
            "ou": {
                "uid": "ou",
                "name": "Organisation unit",
                "dimensionType": "ORGANISATION_UNIT"
            },
            "Uvn6LCg7dVU": {
                "uid": "Uvn6LCg7dVU",
                "code": "IN_52486",
                "name": "ANC 1 Coverage",
                "description": "Total 1st ANC visits (Fixed and outreach) by expected number of pregnant women.",
                "legendSet": "fqs276KXCXi",
                "dimensionItemType": "INDICATOR",
                "valueType": "NUMBER",
                "totalAggregationType": "AVERAGE",
                "indicatorType": {
                    "name": "Per cent",
                    "displayName": "Per cent",
                    "factor": 100,
                    "number": false
                }
            },
            "THIS_YEAR": {
                "name": "This year"
            },
            "2022": {
                "uid": "2022",
                "code": "2022",
                "name": "2022",
                "dimensionItemType": "PERIOD",
                "valueType": "NUMBER",
                "totalAggregationType": "SUM",
                "startDate": "2022-01-01T00:00:00.000",
                "endDate": "2022-12-31T00:00:00.000"
            }
        },
        "dimensions": {
            "dx": [
                "Uvn6LCg7dVU",
                "sB79w2hiLp8"
            ],
            "pe": [
                "2022"
            ],
            "ou": [
                "ImspTQPwCqd"
            ],
            "co": []
        }
    },
    "performanceMetrics": {
        "totalTimeInMillis": 90.894,
        "executionPlans": [
            {
                "timeInMillis": 12.314,
                "planningTime": 6.801,
                "executionTime": 5.513,
                "query": "select ax.\"dx\",ax.\"uidlevel1\", sum(daysxvalue) / 365 as value from analytics_2022 as ax where ax.\"dx\" in ('h0xKKjijTdI') and ax.\"uidlevel1\" in ('ImspTQPwCqd') and ( ax.\"yearly\" in ('2022') ) and ax.\"year\" in (2022) group by ax.\"dx\",ax.\"uidlevel1\"",
                "plan": {
                    "Node Type": "Aggregate",
                    "Strategy": "Sorted",
                    "Partial Mode": "Simple",
                    "Parallel Aware": false,
                    "Async Capable": false,
                    "Startup Cost": 20.21,
                    "Total Cost": 5602.98,
                    "Plan Rows": 260,
                    "Plan Width": 32,
                    "Actual Startup Time": 5.448,
                    "Actual Total Time": 5.449,
                    "Actual Rows": 1,
                    "Actual Loops": 1,
                    "Group Key": [
                        "dx",
                        "uidlevel1"
                    ],
                    "Plans": [
                        {
                            "Node Type": "Bitmap Heap Scan",
                            "Parent Relationship": "Outer",
                            "Parallel Aware": false,
                            "Async Capable": false,
                            "Relation Name": "analytics_2022",
                            "Alias": "ax",
                            "Startup Cost": 20.21,
                            "Total Cost": 5588.33,
                            "Plan Rows": 1520,
                            "Plan Width": 32,
                            "Actual Startup Time": 0.446,
                            "Actual Total Time": 5.003,
                            "Actual Rows": 1032,
                            "Actual Loops": 1,
                            "Recheck Cond": "(dx = 'h0xKKjijTdI'::bpchar)",
                            "Rows Removed by Index Recheck": 0,
                            "Filter": "((uidlevel1 = 'ImspTQPwCqd'::bpchar) AND (yearly = '2022'::text) AND (year = 2022))",
                            "Rows Removed by Filter": 0,
                            "Exact Heap Blocks": 46,
                            "Lossy Heap Blocks": 0,
                            "Plans": [
                                {
                                    "Node Type": "Bitmap Index Scan",
                                    "Parent Relationship": "Outer",
                                    "Parallel Aware": false,
                                    "Async Capable": false,
                                    "Index Name": "in_dx_ao_ax_2022_MClNI",
                                    "Startup Cost": 0.0,
                                    "Total Cost": 19.83,
                                    "Plan Rows": 1520,
                                    "Plan Width": 0,
                                    "Actual Startup Time": 0.406,
                                    "Actual Total Time": 0.407,
                                    "Actual Rows": 1032,
                                    "Actual Loops": 1,
                                    "Index Cond": "(dx = 'h0xKKjijTdI'::bpchar)"
                                }
                            ]
                        }
                    ]
                }
            },
            {
                "timeInMillis": 38.35,
                "planningTime": 0.627,
                "executionTime": 37.723,
                "query": "select ax.\"dx\",ax.\"uidlevel1\", sum(value) as value from analytics_2022 as ax where ax.\"dx\" in ('Jtf34kNZhzP') and ax.\"uidlevel1\" in ('ImspTQPwCqd') and ( ax.\"yearly\" in ('2022') ) and ax.\"year\" in (2022) group by ax.\"dx\",ax.\"uidlevel1\"",
                "plan": {
                    "Node Type": "Aggregate",
                    "Strategy": "Sorted",
                    "Partial Mode": "Simple",
                    "Parallel Aware": false,
                    "Async Capable": false,
                    "Startup Cost": 193.57,
                    "Total Cost": 47322.83,
                    "Plan Rows": 261,
                    "Plan Width": 32,
                    "Actual Startup Time": 37.685,
                    "Actual Total Time": 37.685,
                    "Actual Rows": 1,
                    "Actual Loops": 1,
                    "Group Key": [
                        "dx",
                        "uidlevel1"
                    ],
                    "Plans": [
                        {
                            "Node Type": "Bitmap Heap Scan",
                            "Parent Relationship": "Outer",
                            "Parallel Aware": false,
                            "Async Capable": false,
                            "Relation Name": "analytics_2022",
                            "Alias": "ax",
                            "Startup Cost": 193.57,
                            "Total Cost": 47191.38,
                            "Plan Rows": 17179,
                            "Plan Width": 32,
                            "Actual Startup Time": 1.981,
                            "Actual Total Time": 32.332,
                            "Actual Rows": 17462,
                            "Actual Loops": 1,
                            "Recheck Cond": "(dx = 'Jtf34kNZhzP'::bpchar)",
                            "Rows Removed by Index Recheck": 0,
                            "Filter": "((uidlevel1 = 'ImspTQPwCqd'::bpchar) AND (yearly = '2022'::text) AND (year = 2022))",
                            "Rows Removed by Filter": 0,
                            "Exact Heap Blocks": 1165,
                            "Lossy Heap Blocks": 0,
                            "Plans": [
                                {
                                    "Node Type": "Bitmap Index Scan",
                                    "Parent Relationship": "Outer",
                                    "Parallel Aware": false,
                                    "Async Capable": false,
                                    "Index Name": "in_dx_ax_2022_Eb64F",
                                    "Startup Cost": 0.0,
                                    "Total Cost": 189.27,
                                    "Plan Rows": 17179,
                                    "Plan Width": 0,
                                    "Actual Startup Time": 1.765,
                                    "Actual Total Time": 1.765,
                                    "Actual Rows": 17462,
                                    "Actual Loops": 1,
                                    "Index Cond": "(dx = 'Jtf34kNZhzP'::bpchar)"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    },
    "width": 0,
    "rows": [],
    "height": 0,
    "headerWidth": 2
}

This response displays the execution plan that the PostgreSQL planner generates for the supplied statement.

The execution plan shows how the table(s) referenced by the statement will be scanned: by plain sequential scan, index scan,and if multiple tables are referenced, what joins will be used to bring together the required rows from each input table.

The most critical part of the display is the estimated statement execution cost, which is the query planner's estimate at how long it will take to run the statement.

All entry points are secured by authorization. The F_PERFORM_ANALYTICS_EXPLAIN role is required.

Analytics vysvětluje

/api/analytics/explain

Analytika událostí vysvětluje

/api/analytics/event/aggregate/{program}/explain

/api/analytics/event/query/{program}/explain

Analytika zápisu vysvětluje

/api/analytics/enrollment/query/{program}/explain

Outliers analytics explain

/api/analytics/outlierDetection/explain