Skip to main content

No project description provided

Project description

Dapla Suv Tools

A collection of tools for integrating with the SUV-platform

Install dapla-suv-tools from PyPI

pip install dapla-suv-tools

Initialize a client using SuvClient

from dapla_suv_tools.suv_client import SuvClient

client = SuvClient()

Setup pagination using PaginationInfo

from dapla_suv_tools.pagination import PaginationInfo

p_info = PaginationInfo(page=1, size=5)

Example 1: fetch skjema by id

from dapla_suv_tools.suv_client import SuvClient

client = SuvClient()

x = client.get_skjema_by_id(skjema_id=116)

print(x)

Example 2: fetch skjema's with PaginationInfo

from dapla_suv_tools.suv_client import SuvClient
from dapla_suv_tools.pagination import PaginationInfo

client = SuvClient()
p_info = PaginationInfo(page=1, size=5)

y = client.get_skjema_by_ra_nummer(
    ra_nummer="RA-5566", max_results=0, latest_only=False, pagination_info=p_info
)

print(y)

Function get_skjema_by_ra_nummer

output = client.get_skjema_by_ra_nummer(ra_nummer="RA-5566", max_results=0, latest_only=False)
print(output)

Parameters:

  • ra_number (str): Skjema's RA-number.
  • max_results (int, optional): Maximum number of results int the result set. A value of 0 will get ALL results. Default is 0.
  • latest_only (bool, optional): A boolean flag to trigger a special condition. Default is 'False'.
  • pagination_info (PaginationInfo, optional): An object holding pagination metadata. Default is 'None'.

Returns:

  • dict: A list of skjema json objects matching the RA-number

Function get_periode_by_id

output = client.get_periode_by_id(periode_id=123)
print(output)

Parameters:

  • periode_id (int): The ID of the period to retrieve.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the period information if found, or an error message if the retrieval fails.

Function get_perioder_by_skjema_id

output = client.get_perioder_by_skjema_id(skjema_id=123,periode_type="KVRT", periode_aar=2023)
print(output)

Parameters:

  • skjema_id (int): The skjema_id of the period to retrieve.
  • periode_type (Optional[str]): The type of the period to filter by. If None, periods of any type will be retrieved.
  • periode_nr (Optional[int]): The number of the period to filter by. If None, periods of any number will be retrieved.
  • periode_aar (Optional[int]): The year of the period to filter by. If None, periods of any year will be retrieved.
  • delreg_nr (Optional[int]): The delreg_nr of the period to filter by. If None, periods of any delreg_nr will be retrieved.
  • enhet_type (Optional[int]): The enhet_type of the period to filter by. If None, periods of any enhet_type will be retrieved.
  • max_results (int): Maximum number of results in the result set. A value of 0 will get ALL results. Defaults to 0
  • latest_only (bool): A boolean flag to trigger a special condition. A True value will retrieve the latest periode added. Defaults to False.
  • pagination_info (Optional[int]): An object holding pagination metadata. Defaults to None.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the period information if found, or an error message if the retrieval fails.

Function update_periode_by_id

output = client.update_periode_by_id(
        periode_id=456, vis_oppgavebyrde=True
    )
print(output)

Parameters:

  • periode_id (int): The ID of the period to update.
  • periode_dato (Optional[date]): Date for the period. If None, the existing date will be used.
  • delreg_nr (Optional[int]): delreg_nr. If None, the existing number will be used.
  • enhet_type (Optional[str]): enhet_type. If None, the existing type will be used.
  • vis_oppgavebyrde (Optional[bool]): A boolean flag to indicate visibility of "oppgavebyrde". Defaults to None.
  • vis_brukeropplevelse (Optional[bool]): A boolean flag to indicate visibility of "brukeropplevelse". Defaults to None.
  • har_skjemadata (Optional[bool]): A boolean flag to indicate the presence of schema data. Defaults to None.
  • journalnummer (Optional[str]): Journal number. If None, the existing number will be used.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the updated period information, or an error message if the update fails.

Function update_periode_by_skjema_id

output = client.update_periode_by_skjema_id(skjema_id=456, periode_type="KVRT", periode_aar=2023, periode_nr=1, delreg_nr=3)
print(output)

Parameters:

  • skjema_id (int): The skjema_id of the period to update.
  • periode_type (str): Periode type of the period to update.
  • periode_aar (int): Year of the period to update.
  • periode_nr (int): Periode number of the period to update.
  • periode_dato (Optional[date]): Date for the period. If None, the existing date will be used.
  • delreg_nr (Optional[int]): The delreg_nr of the period to filter by. If None, periods of any delreg_nr will be retrieved.
  • enhet_type (Optional[int]): The enhet_type of the period to filter by. If None, periods of any enhet_type will be retrieved.
  • vis_oppgavebyrde (Optional[bool]): A boolean flag to indicate visibility of "oppgavebyrde". Defaults to None.
  • vis_brukeropplevelse (Optional[bool]): A boolean flag to indicate visibility of "brukeropplevelse". Defaults to None.
  • har_skjemadata (Optional[bool]): A boolean flag to indicate the presence of schema data. Defaults to None.
  • journalnummer (Optional[str]): Journal number. If None, the existing number will be used.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the updated period information, or an error message if the update fails.

Function create_periode

output = client.create_periode(
        skjema_id=456, periode_type="KVRT", periode_aar=2023, periode_nr=1
    )
print(output)

Parameters:

  • skjema_id (int): The skjema_id associated with the new period.
  • periode_type (Optional[str]): Periode type of the new periode.
  • periode_aar (Optional[int]): Year of the new periode.
  • periode_nr (Optional[int]): Periode number of the new periode.
  • periode_dato (Optional[date]): Date for the period.
  • delreg_nr (Optional[int]): delreg_nr
  • enhet_type (Optional[int]): enhet_type
  • vis_oppgavebyrde (Optional[bool]): A boolean flag to indicate visibility of "oppgavebyrde". Defaults to None.
  • vis_brukeropplevelse (Optional[bool]): A boolean flag to indicate visibility of "brukeropplevelse". Defaults to None.
  • har_skjemadata (Optional[bool]): A boolean flag to indicate the presence of schema data. Defaults to None.
  • journalnummer (Optional[str]): Journal number. If None, the existing number will be used.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the ID of the created period, or an error message if the creation fails.

Function delete_periode

output = client.delete_periode(periode_id=123)
print(output)

Parameters:

  • periode_id (int): The ID of the period to delete.
  • context (SuvOperationContext): Operation context for logging and error handling. This is injected by the underlying pipeline. Adding a custom context will result in an error

Returns:

  • OperationResult: An object containing the result of the deletion operation, or an error message if the deletion fails.

=======

  • ra_number (str, required): Skjema's RA-number.
  • max_results (int, optional): Maximum number of results in the result set. A value of 0 will get ALL results. Defaults to 0.
  • latest_only (bool, optional): A boolean flag to trigger a special condition. Defaults to False.
  • pagination_info (PaginationInfo, optional): An object holding pagination metadata. Defaults to None.

Returns:

  • dict: A list of skjema json objects matching the RA-number

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

dapla_suv_tools-0.1.34.tar.gz (12.8 kB view hashes)

Uploaded Source

Built Distribution

dapla_suv_tools-0.1.34-py3-none-any.whl (20.0 kB view hashes)

Uploaded Python 3

Supported by

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