pacsifier.core.sanity_checks module

This module contains sanity checks for the functions employed in the pacsifier script.

pacsifier.core.sanity_checks.check_AET(AET: str, server=False) None[source]

Check the validity of an application entity title (AET).

Parameters:
  • AET – application entity title

  • server – boolean indicating if it is a AE title of a server or not

Raises:

ValueError if it is not valid and use a boolean to print a relevant error message

pacsifier.core.sanity_checks.check_config_parameters(config_parameters: Dict[str, str]) None[source]

Check that the dictionary containing config parameters is valid.

This function check if all the keys are present and if the values are valid by using the jsonschema library.

Parameters:

config_parameters – dictionary loaded from the config json file

Raises:

ValueError if the config file is not valid or if the parameters are not valid

pacsifier.core.sanity_checks.check_date(date: str) None[source]

Check that a date is valid.

Parameters:

date – date to be checked

pacsifier.core.sanity_checks.check_date_range(date: str) None[source]

Check that a date (possibly a date range) is valid.

Parameters:

date – date or date range to be checked

pacsifier.core.sanity_checks.check_filter(filter_text: str) None[source]

Check if an additional input filter is valid.

Parameters:

filter_text – additional attribute to the query command

pacsifier.core.sanity_checks.check_ids(uid: str, attribute: str = 'Patient ID') None[source]

Check if a patient ID is valid.

Parameters:
  • uid – unique identifier

  • attribute – attribute name

Raises:
  • ValueError if it is not valid and print a relevant error message

  • using the argument called attribute

pacsifier.core.sanity_checks.check_ip(ip_address: str) None[source]

Check if an ip adress is valid.

Parameters:

ip_address – IP address

Raises:

ValueError if it is not valid

pacsifier.core.sanity_checks.check_parameters_inputs(AET: str, server_address: str, server_aet: str, port: int) None[source]

Check if the parameters are valid using helper functions.

Parameters:
  • AET – called AET

  • server_address – PACS server IP address

  • server_aet – PACS server AET

  • port – port

Raises:

ValueError if at least one parameter is invalid

pacsifier.core.sanity_checks.check_port(port: int) None[source]

Check if a port value is valid.

Parameters:

port – port number

Raises:

ValueError if it is not valid

pacsifier.core.sanity_checks.check_query_attributes(query_attributes: Dict[str, str]) None[source]

Check that the table has an acceptable input parameters.

Parameters:

query_attributes – dictionary that contains all parameters for query

pacsifier.core.sanity_checks.check_query_retrieval_level(query_retrieval_level: str) None[source]
pacsifier.core.sanity_checks.check_server_address(server_address: str) None[source]

Check if a server address is valid.

Parameters:

server_address – server address

Raises:

ValueError if it is not valid