Skip to main content

No project description provided

Project description

OTLMOW-Converter

PyPI otlmow-converter-downloads Unittests PyPI - Python Version GitHub issues coverage

OTLMOW Project

This project aims to implement the Flemish data standard OTL (https://wegenenverkeer.data.vlaanderen.be/) in Python. It is split into different packages to reduce compatibility issues

Functionality

The core functionality of this library is creating instances of otlmow_model classes by converting or creating them. The instances can then be manipulated and finally exported to a different format. When exporting to a file, a DAVIE compliant format can be chosen so that the data can be imported in the DAVIE application.

Supported formats and objects

Using this library, you can convert between the following objects and formats

  1. otlmow class objects
    • class objects can simply be instantiated in code or created using the helpers in the otlmow-model library
  2. files
    • chose one of the many supported file formats to read from or write data to
    • some file formats are DAVIE compliant, meaning they can be imported in the DAVIE application
  3. dictionaries
    • class objects have a simple dictionary representation and are more efficient to work with in memory
    • some attribute values can be dictionaries themselves
    • because of cardinality, dictionary values can be a list of values or a list of dictionaries
    • with rdf as true, the dictionary uses the RDF representation with full URIs as keys (and some of the values)
  4. dotnotation dictionaries
    • these are similar to dictionaries, but they use dotnotation to access values
    • as a result these are never nested and lists are converted to a string per convention
  5. pandas dataframes
    • the popular pandas library is supported for reading and writing data, but it is not DAVIE compliant
    • it uses the dotnotation convention

Converter class

The main class in this library is the OtlmowConverter class. This class is a facade class and has a couple of methods to convert between the different types of objects. The main methods are:

  • to_objects: converts to instantiated otlmow class objects
  • to_file: converts to a file
  • to_dicts: converts to an iterable of dictionaries
  • to_dotnotation_dicts: converts to an iterable of to_dotnotation dictionaries
  • to_dataframe: converts to a pandas dataframe (or a dictionary holding multiple dataframes)

These methods can use any of the supported formats as input (subject). The methods determine the format of the subject and convert it to the desired format.

There are also from_A_to_B methods (i.e. from_dicts_to_objects) where either A or B are otlmow class objects. These methods are more efficient as they do not need to determine the format of the subject.

Installation and requirements

I recommend working with uv. Install this first:

pip install uv

Then install this package by using the uv pip install command:

uv pip install otlmow-converter

If you are a developer, use this command to install the dependencies, including those needed to run the test suite.

uv pip install -r pyproject.toml --extra test

Code examples and usage

See the Readme notebook

Supported file formats

The following file formats are supported in OtlmowConverter

File format Read Write DAVIE compliant
CSV Yes Yes Yes
Excel Yes Yes Yes
JSON Yes Yes Yes
GeoJSON Yes Yes Yes
JSON-LD Yes Yes No
Pandas Dataframe Yes Yes No
TTL No Yes No

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

otlmow_converter-1.17rc1.tar.gz (77.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otlmow_converter-1.17rc1-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

Details for the file otlmow_converter-1.17rc1.tar.gz.

File metadata

  • Download URL: otlmow_converter-1.17rc1.tar.gz
  • Upload date:
  • Size: 77.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for otlmow_converter-1.17rc1.tar.gz
Algorithm Hash digest
SHA256 0b332a0b57bf2cdd1c675976fc1c2818b88049e465339c1016d705b6f91bf418
MD5 1efa988ca0c1a611272dc3ec7f18b8c5
BLAKE2b-256 24ea9caf9d498d0ff37231bd6fabb5b0bd1bd047abfd4634402f9a3905e03113

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlmow_converter-1.17rc1.tar.gz:

Publisher: release.yml on davidvlaminck/OTLMOW-Converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file otlmow_converter-1.17rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for otlmow_converter-1.17rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0753f0a36d02197f907dc7d748caacd0e22975b91e7b78ff50734c73aa2dc24
MD5 ae9a831c2169e49f81085d06b2c6b65f
BLAKE2b-256 b7269771fc84113e426e607dfdf2dc9b9900fc31c60f1887ebf0fdf839631906

See more details on using hashes here.

Provenance

The following attestation bundles were made for otlmow_converter-1.17rc1-py3-none-any.whl:

Publisher: release.yml on davidvlaminck/OTLMOW-Converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page