Skip to content

statisticsnorway/ssb-tbmd-apis-python

SSB Tbmd Apis Python

PyPI Status Python Version License

Documentation Tests Coverage Quality Gate Status

pre-commit Black Ruff Poetry

Tjenestebibliotek for metadata

Is an API built on top of Oracle in SSBs ON-prem environment for getting at metadata.
This package is written for extracting the information where possible.

Lenker ssb onprem:

Installation

You can install SSB Tbmd Apis Python via pip from PyPI:

poetry add ssb-tbmd-apis-python

Usage examples

Open a flatfile as a pandas dataframe with only the path to the datafile.

from ssb_tbmd_apis.imports.datadok_open_flatfile import datadok_open_flatfile_from_path

df = datadok_open_flatfile_from_path(
    "/ssb/stam/utdanning/vgogjen/mappe/g2023"
)

Store a json of the "filbeskrivelse" - the metadata to interpret a "fixed-width-file" / "flatfile". This stores the json next to the datafile, with the suffix "__MIGRERDOK.json"

from ssb_tbmd_apis.exports.migrerdok import save_migrerdok_for_flatfile
migrer_path = save_migrerdok_for_flatfile(
    "$DOLLAR/team/archive/folder/g2001", overwrite=True
)

Get metadata from the old "vardok".

from ssb_tbmd_apis.operations.operations_vardok import (
    vardok_concept_variables_by_name_def,
    vardok_concept_variables_by_owner
)

len(vardok_concept_variables_by_owner("360"))

print(vardok_concept_variables_by_owner("360"))

print(vardok_concept_variables_by_name_def("nus2000"))

Please see the Reference Guide for further details.

License

Distributed under the terms of the MIT license, SSB Tbmd Apis Python is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from Statistics Norway's SSB PyPI Template.

About

Utilize the old TBMD (TjenesteBibliotek for MetaData) APIs in Statistics Norways prodsone.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages