SSB Altinn Form Tools
Project description
SSB Altinn Form Tools
Features
- Tools for automatically handling forms from Altinn3
- Transforms the data to the standard schema for SSBs editing framework
- Ingests the data using SQLAlchemy og Parquedit.
Requirements
- TODO
Installation
You can install SSB Altinn Form Tools via pip from PyPI:
pip install ssb-altinn-form-tools
Example
See docs/documentation for further information.
Walkthrough provides a deeper guide through the example and how everything works.
import logging
logging.basicConfig(
level=logging.DEBUG, # Set minimum log level
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
force=True,
)
from sqlalchemy import create_engine
from ssb_altinn_form_tools.default_form_processor import DefaultFormProcessor
from ssb_altinn_form_tools.default_form_extractor import DefaultFormExtractor
from ssb_altinn_form_tools.sqlalchemy_storage_connector import (
SqlAlchemyStorageConnector,
)
extractor = DefaultFormExtractor()
engine = engine = create_engine("sqlite:///./db.db", echo=False)
connector = SqlAlchemyStorageConnector(engine)
for form_number in ["RA0187", "RA0297", "RA0307", "RA0366", "RA0479", "RA0481", "RA0530", "RA0536", "RA0689", "RA0745", "RA0825"]:
processor = DefaultFormProcessor(
form_name=form_number,
form_base_path=f"/home/onyxia/work/ssb-altinn-form-tools/tests/testdata/{form_number}",
extractor=extractor,
connector=connector,
alias_mapping={"omsVirksomhetPerioden": "omsetning"},
)
processor.process_new_forms()
from sqlalchemy import text
with engine.connect() as conn:
tables = conn.execute(text("SELECT name FROM sqlite_master WHERE type='table';")).fetchall()
print("Tables:", tables)
with engine.connect() as conn:
rows = conn.execute(text("SELECT * FROM enheter LIMIT 10;")).mappings().all()
for row in rows:
print(dict(row))
Usage
Please see the Reference Guide 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 Form Tools 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.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ssb_altinn_form_tools-0.0.4.tar.gz.
File metadata
- Download URL: ssb_altinn_form_tools-0.0.4.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
384b65f6d02f1307eed751e811d6bfeaf851aca08350d33df3ab608d2de2636d
|
|
| MD5 |
1f909ca8d17195fd65855f91d4569bfe
|
|
| BLAKE2b-256 |
b437488f1edbd5d20eacf3a4f45ad26be6d7a8aca117ce1e69f1143e0f3b993a
|
Provenance
The following attestation bundles were made for ssb_altinn_form_tools-0.0.4.tar.gz:
Publisher:
release.yml on statisticsnorway/ssb-altinn-form-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ssb_altinn_form_tools-0.0.4.tar.gz -
Subject digest:
384b65f6d02f1307eed751e811d6bfeaf851aca08350d33df3ab608d2de2636d - Sigstore transparency entry: 1251655736
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-altinn-form-tools@4e0e504d4f1e8eeec527b4237e1c89c7fdb7e162 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e0e504d4f1e8eeec527b4237e1c89c7fdb7e162 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ssb_altinn_form_tools-0.0.4-py3-none-any.whl.
File metadata
- Download URL: ssb_altinn_form_tools-0.0.4-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86bb07ba8856c38cfa0d2022d640804bdfc2b97e89380c98244237bb69b299f3
|
|
| MD5 |
480e51704f6f7ef8b1a17706bfdf2d19
|
|
| BLAKE2b-256 |
006141eb86b2faffa7159e2bb69f4caef66a855065606d2525f87b5bc1a1d336
|
Provenance
The following attestation bundles were made for ssb_altinn_form_tools-0.0.4-py3-none-any.whl:
Publisher:
release.yml on statisticsnorway/ssb-altinn-form-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ssb_altinn_form_tools-0.0.4-py3-none-any.whl -
Subject digest:
86bb07ba8856c38cfa0d2022d640804bdfc2b97e89380c98244237bb69b299f3 - Sigstore transparency entry: 1251655741
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-altinn-form-tools@4e0e504d4f1e8eeec527b4237e1c89c7fdb7e162 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e0e504d4f1e8eeec527b4237e1c89c7fdb7e162 -
Trigger Event:
push
-
Statement type: