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.
You can install SSB Tbmd Apis Python via pip from PyPI:
poetry add ssb-tbmd-apis-pythonOpen 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.
Distributed under the terms of the MIT license, SSB Tbmd Apis Python is free and open source software.
If you encounter any problems, please file an issue along with a detailed description.
This project was generated from Statistics Norway's SSB PyPI Template.