HK-dir kanalregister
The Hkdir client (bibliofabric.hkdir) reads the publication-channel
tables of the Norwegian Register for Scientific Publication
Channels through its DBH API
(https://kanalregister.hkdir.no/api/krtabeller/). Table 850 carries the
publishers (forlag), 851 the journals (tidsskrift), 852 the publisher
level per year, and 853 the journal level per year. An async client and a
generated sync twin expose the same calls.
The tables are open data under the Norsk lisens for offentlige data (CC BY 4.0); name HK-dir/DBH as the source when you publish results built on them.
Credentials
The API needs no credentials. HK-dir names no rate limit for it; the
client paces itself to one request per second and can be tuned with
HKDIR_MAX_REQUESTS_PER_SECOND and HKDIR_MAX_CONCURRENCY, as the
settings guide describes.
Quick start
import asyncio
from bibliofabric.hkdir import DbhFilter, HkdirClient
async def main() -> None:
async with HkdirClient() as client:
journal = await client.journals.get("478900")
print(journal.original_tittel, journal.online_issn)
print("level 2026:", journal.levels[2026])
page = await client.publishers.search()
print(len(page.results), "publishers")
page = await client.journals.search(
filters=DbhFilter(
variabel="Original tittel", filter="like", values=["%Nature%"]
)
)
for row in page.results[:5]:
print(row.tidsskrift_id, row.original_tittel)
page = await client.journal_levels.search(
filters=DbhFilter(
variabel="Tidsskrift id", filter="item", values=["478900"]
)
)
for row in page.results:
print(row.year, row.level)
asyncio.run(main())
Insects 2075-4450
level 2026: 1
3362 publishers
437744 Annales des Sciences Naturelles-Zoologie et Biologie Animale
490845 Antennae: The Journal of Nature in Visual Culture
475082 Beliefs and Values: Understanding the Global Implications of Human Nature
481365 Biodiversity, biogeography and nature conserbation in Wallacea and New Guinea
449461 Bulletin (Muséum national d'histoire naturelle), Adansonia
2012 1
2013 1
…
2026 1
2027 0
Sync quick start
from bibliofabric.hkdir import HkdirSyncClient
with HkdirSyncClient() as client:
journal = client.journals.get("478900")
print(journal.original_tittel, journal.online_issn)
The sync client uses plain httpx.Client and never starts or touches an
event loop, so it fits scripts, notebooks, and threads; see
async and sync clients.
What the client offers
| Attribute | Table | Model | Methods |
|---|---|---|---|
client.publishers |
850 forlag | Publisher |
search, get, exists, search_csv, download_csv |
client.journals |
851 tidsskrift | Journal |
search, get, exists, search_csv, download_csv |
client.publisher_levels |
852 forlag per year | PublisherLevel |
search, search_csv, download_csv |
client.journal_levels |
853 tidsskrift per year | JournalLevel |
search, search_csv, download_csv |
Every read runs one DBH query. The API has no paging and no totals, so
each search() answer carries every matching record, page.total is
None, and count() raises ConfigurationError. batch_get() raises
ConfigurationError on every resource because the API has no multi-id
route; call get() per id. The level tables key rows by channel id and
year together, so their get() is unsupported. iterate(), collect(),
and first() run over the single full answer; first() returns the
first matching record or None.
search(filters=None) sends a match-all clause and returns the whole
table. Pass clauses of the DBH query language as a DbhFilter or a
DbhFilterSet; see the query language.
For the whole table as one file, download_csv() streams the bulk-csv
snapshot (about 0.8 MB for table 850, 15 MB for 851, 2.7 MB for 852, and
36 MB for 853), and iter_table_csv() reads it row by row into typed
records:
from bibliofabric.hkdir import iter_table_csv
path = await client.journals.download_csv("journals.csv")
journals = list(iter_table_csv(path, Journal))
Examples
Runnable scripts live in packages/bibliofabric/examples/hkdir:
quickstart.py: one lookup, one search, and one level query per table.snapshot.py: download every table and count the parsed rows (downloads about 55 MB).
Next
- Upstream quirks: the query language, response shapes, and error answers.
- API reference: the client, resources, models, and helpers.