Skip to main content

CTK Specific Information

See this page for general documentation about Genja.

CTK Specific Domains

We use domains as sets of filters, pre/post-processing and usable GKB bucket.

There are two generic domains:

  • general_en - domain for general English texts
  • general_cs - domain for general Czech texts

and several CTK-specific domains:

  • Czech:
    • petrol – petrol prices
    • accidents – car accident statistics
    • parlelect – elections for the Chamber of Deputies
    • senelect – Senate elections
    • regelect – regional elections
    • munielect – municipal elections
  • English:
    • enelect – elections

CTK Specific Filters

See this page for general documentation about Genja Filters.

Senate Candidate Name Filter (cname)

Special filter for senate candidate names. It allows multiple output formats optionally containing

  • f (cname('f')) – first name
  • s (cname('s')) – surname
  • p (cname('p')) – party (ctk_party)
  • i (cname('i')) – adds the senátor/senátorka string if the candidate is an incumbent.

Note: cname does not support the short m notation, the full morph specification is required (see morphology ).

Examples:

  • {{candidates[0]|cname('sp')}}Pavera (TOP 09)
  • {{candidates[1]|cname('ifsp', morph='Case=Gen')}}senátora Václava Lásky (SEN 21)

Custom Property Filter (prop)

The filter is currently enabled for the elect domain and allows retrieving any property defined in 'election sheet'. The property names are identical to the column names in the sheet.

Examples:

  • {{candidates[0]|prop('bydlisten')}}Znojmo

Knowledge Base API

The API requires an X-API-Key.

Knowledge Base Viewer API

The GKB viewer API supports read-only access to Geneea Knowledge Base:

  • listing items in a bucket,
  • displaying properties of individual items.

Below, we describe the API as used to CTK-specific data.

For accessing the ctkele bucket in GKB at https://kb.geneea.com/, an X-API-Key is used: X-API-Key : EzvnZq8ebV7cETXfbpn9ll0OIYZYKat4aPuILdY5

For filters accessing knowledge base items and their properties, see <genja_filters_kb>

Accessing List of Items in the "ctkele" Bucket

To display only a list of IDs in the ctkele bucket, you can use the following command:

# list item IDs in 'ctkele' bucket
curl -v 'https://kb.geneea.com/items?bucket=ctkele&idsonly=True&limit=5' -H 'X-API-Key: EzvnZq8ebV7cETXfbpn9ll0OIYZYKat4aPuILdY5'

The result is:

{
"items": ["CTKELE-1000-VS", "CTKELE-1001-VS", "CTKELE-1002-VS", "CTKELE-1003-VS", "CTKELE-1004-VS"],
"paging": {
"next": "/items?bucket=ctkele&idsonly=True&pager=eyJwYWdlU2l6ZSI6IDEwLCAib2Zmc2V0R2lkIjogIkNUS0VMRS0xMDA5LVZTIn0%3D"
}
}

There are a few parameters to this URL:

  • bucket=ctkele – fixed option, other buckets are not allowed
  • idsonly=[True|False] – to choose whether you want to see full items or only their IDs
  • limit=5 – specifies the number of items or IDs in the response (up to 100 items, which is the default option)

If the list is longer than the specified number of items, you will get a string value paging.next for the next list of items. With this you can read the next items with the parameter pager=<string> by appending the paging.next1 value after https://kb.geneea.com/ as is shown:

# use "paging.next" from the API response for listing another page
curl -v 'https://kb.geneea.com/items?bucket=ctkele&idsonly=False&pager=eyJwYWdlU2l6ZSI6IDEwLCAib2Zmc2V0R2lkIjogIkNUS0VMRS0xMDA5LVZTIn0%3D' -H 'X-API-Key: ... '

Reading Properties of an Item

To access a full item with its properties by item ID (CTKELE-53-VS, CTKELE-193266, for example), the following command with the right X-API-Key is used.

# ODS
curl -v 'https://kb.geneea.com/items/CTKELE-53-VS' -H 'X-API-Key: ... '

# Liberec region
curl -v 'https://kb.geneea.com/items/CTKELE-193266' -H 'X-API-Key: ... '

You can search the items also with external IDs (as nutscode or localadminunit):

# find 'STAROSTOVÉ A NEZÁVISLÍ' item by 'ctk_comb_kz_strana' external ID '31/12/7'
curl -v 'https://kb.geneea.com/search/ids?buckets=ctkele&externalSource=ctk_comb_kz_strana&externalIds=31/12/7&idsonly=False' -H 'X-API-Key: ... '

# find 'Liberec region' item by 'nutscode' external ID 'CZ051'
curl -v 'https://kb.geneea.com/search/ids?buckets=ctkele&externalSource=nutscode&externalIds=CZ051&idsonly=False' -H 'X-API-Key: ... '

The URL parameters for this type of command are:

  • bucket=ctkele – fixed option, other buckets are not allowed
  • externalSource – name of external source (e.g., localadminunit, nutscode, id_cvs, vstrana, elections, csu_sen_obvod, etc.)
  • externalIds – external ID. It's a multi-value HTTP GET parameter which can be used multiple times to specify more IDs in one request
  • idsonly=[True|False] – to choose whether you want to see full items or only their IDs