Skip to main content

Python wrapper for the Diavgeia Open Data API

Project description

Diavgeia API Client

A Python wrapper for the Diavgeia Open Data API

Table of Contents

Features

Makes easy to:

  • Fetch:
    1. decisions (and their version log)
    2. organizations (with their respective:
      1. units like "ΓΡΑΦΕΙΟ ΑΝΤΙΔΗΜΑΡΧΟΥ",
      2. positions, like "Προϊστάμενος Διεύθυνσης", "Δήμαρχος", etc.
      3. specific signers
    3. types (of government actions, like "ΠΡΑΞΕΙΣ ΚΑΝΟΝΙΣΤΙΚΟΥ ΠΕΡΙΕΧΟΜΕΝΟΥ", "ΠΡΑΞΕΙΣ ΟΙΚΟΝΟΜΙΚΟΥ ΠΕΡΙΕΧΟΜΕΝΟΥ", etc.),
    4. dictionaries where various unique id's are explained, for example:
      1. "uid": "FEKTYPES" --> "label": "Τύποι τευχών ΦΕΚ"
  • Search decisions using advanced criteria (like issue date - Ημερομηνία έκδοσης- or signer - Κωδικός υπογράφοντα -) and their combinations (both a specific signer and a specific date range)

Installation

pip install diavgeia-api

Usage

Overview

As is described in an example, right now there are these methods:

Available methods:
- get_a_decision: Return a specific decision's details.
- get_a_decisions_specific_version: Returns details of a specific version of a decision.
- get_a_decisions_version_log: Returns details of a specific version of a decision.
- get_a_types_details: Returns details of a type.
- get_a_types_summary: Returns a summary of a specific type.
- get_all_types: Returns all existing types.
- get_dictionaries: Return the list of available dictionaries.
- get_dictionary: Return all items for a specific dictionary.
- get_organization: Returns details of a specific organization.
- get_organization_positions: Returns positions of a specific organization.
- get_organization_signers: Returns signers of a specific organization.
- get_organization_units: Returns units of a specific organization.
- get_organizations: Returns a list of registered organizations.
- search_advanced: Search for decisions with advanced query syntax.
- search_decisions: Search for decisions with simple parameters.

Examples

This package includes several examples to help you get started:

You can find all examples in the examples folder.

Decisions

from diavgeia_api import DiavgeiaClient

# Initialize client
client = DiavgeiaClient()

decision = client.get_a_decision("Ψ11446ΜΓΨ7-ΠΚΛ")
print(f"Subject: {decision.subject}")
print(f"Organization: {decision.organization.label}")
print(f"Decision date: {decision.issue_date}")

Organizations

# Organizations example
organizations = client.get_organizations()
for org in organizations.organizations[:5]:
    print(f"{org.label} ({org.uid})")

Types

# Types example
types = client.get_all_types()
for type_item in types.types[:5]:
    print(f"{type_item.label} ({type_item.uid})")

# Get details for a specific type
type_details = client.get_a_types_details("Β.1.3")
print(f"Type: {type_details.label}")
print(f"Description: {type_details.description}")

Dictionaries

# Dictionaries example
dictionaries = client.get_dictionaries()
print("Available dictionaries:")
for dictionary in dictionaries.dictionaries[:5]:
    print(f"- {dictionary.label} (ID: {dictionary.uid})")

# Get items from a specific dictionary
org_category_dict = client.get_dictionary("ORG_CATEGORY")
print("\nOrganization categories:")
for item in org_category_dict.items[:5]:
    print(f"- {item.label} (ID: {item.uid})")

Search

# Simple search example
search_results = client.search_decisions(
    term="προμήθεια υπολογιστών",
    date_from="2023-01-01",
    date_to="2023-12-31"
)

print(f"Found {search_results.info.total} decisions")
for decision in search_results.decisions[:3]:
    print(f"- {decision.subject[:50]}... (ΑΔΑ: {decision.ada})")

# Advanced search example
advanced_search = client.search_advanced(
    q="subject:(προμήθεια υπολογιστών) AND issueDate:[2023-01-01 TO 2023-12-31] AND organizationUid:6321",
    sort="issueDate:desc"
)

print(f"\nAdvanced search found {advanced_search.info.total} decisions")
for decision in advanced_search.decisions[:3]:
    print(f"- {decision.subject[:50]}... (ΑΔΑ: {decision.ada})")
    

Testing

This project uses pytest for testing. To run the tests:

# Install development dependencies
poetry install --with dev

# Run the tests
poetry run pytest

# Run with coverage report
poetry run pytest --cov=diavgeia_api

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

diavgeia_api-0.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

diavgeia_api-0.0.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file diavgeia_api-0.0.1.tar.gz.

File metadata

  • Download URL: diavgeia_api-0.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.8 Windows/11

File hashes

Hashes for diavgeia_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 34d77170332648f7a7664316fffd6518717df1cefd5099b439805e29aa9bcb5b
MD5 366782f50dc626ab199e0ba74c1d62af
BLAKE2b-256 5da0b1fa6b396c682c5446cf3737451e9c5f4ab72361a6f74b36a2822a3b1392

See more details on using hashes here.

File details

Details for the file diavgeia_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: diavgeia_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.8 Windows/11

File hashes

Hashes for diavgeia_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4eb659af0fd9eb0b2d90d9b07be2d175a33b6a0a88b23d02b96c69fbdef55aa
MD5 c26291b2d1131bc3cab90ed06a07548b
BLAKE2b-256 556b4ee179c6e25acf9c2386f7606537294ef15120169eb11bfe66c64ea43a57

See more details on using hashes here.

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