SSB Altinn Python
Project description
SSB Altinn Python
Features
This is work-in-progress Python-package for dealing with xml-data from Altinn3.
from altinn import FileInfo, ParseSingleXml
file = "gs://ssb-prod-dapla-felles-data-delt/altinn3/form_dc551844cd74.xml"
# Create an instance of FileInfo
form = FileInfo(file)
# Create an instance of ParseSingleXml
form_content = ParseSingleXml(file)
# Get file filename without '.xml'-postfix
form.filename()
# Returns: 'form_dc551844cd74'
# Print a nicely formatted version of the file
form.pretty_print()
# Print an unformatted version of the file. Does not require the file to be parseable by an xml-library. Useful for inspecting unvalid xml-files.
form.print()
# Check if xml-file is valid. Useful to inspect xml-files with formal errors in the xml-schema.
form.validate()
# Returns True og False
# Get a dictionary representation of the contents of the file
form_content.to_dict()
# Get a Pandas Dataframe representation of the contents of the file
form_content.to_dataframe()
Requirements
- dapla-toolbelt >=1.6.2,<2.0.0
- defusedxml >=0.7.1,<0.8.0
- pytest >=7.2.2,<8.0.0
Installation
You can install SSB Altinn Python via [poetry] from PyPI:
poetry add ssb-altinn-python
To install this in the Jupyter-environment on Dapla, where it is ment to be used, it is required to install it in an virtual environment. It is recommended to do this in an ssb-project where the preferred tool is poetry.
Usage
Please see the Command-line Reference for details.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, SSB Altinn 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 @cjolowicz's Hypermodern Python Cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ssb_altinn_python-0.2.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6117a9cf83e73b031020f1cde5e98477172330663f49df23a6cf1072a1d5df9c |
|
MD5 | e31bfa2570fc5f86294eb4fd3a0dca53 |
|
BLAKE2b-256 | ddb6e18c89df9ef73c248c624c6cf2630c57f58e5ba74f6a3858e457c61a235f |