Service bookkeeper
bookkeeper.py
The bookkeeper service of mercure, which receives notifications from all mercure services and stores the information in a database.
- bookkeeping.bookkeeper.app: Starlette
- bookkeeping.bookkeeper.main(args=['-b', 'html', '-d', '_build/doctrees', '.', '_build/html']) None [source]
- async bookkeeping.bookkeeper.parse_and_submit_tags(payload) None [source]
Helper function that reads series information from the request body.
- async bookkeeping.bookkeeper.post_mercure_event(request) JSONResponse [source]
Endpoint for receiving mercure system events.
- async bookkeeping.bookkeeper.post_task_event(request) JSONResponse [source]
Endpoint for logging all events related to one series.
- async bookkeeping.bookkeeper.post_webgui_event(request) JSONResponse [source]
Endpoint for logging relevant events of the webgui.
- async bookkeeping.bookkeeper.processor_logs(request) JSONResponse [source]
Endpoint for receiving mercure system events.
- async bookkeeping.bookkeeper.register_dicom(request) JSONResponse [source]
Endpoint for registering newly received DICOM files. Called by the getdcmtags module.
- async bookkeeping.bookkeeper.register_series(request) JSONResponse [source]
Endpoint that is called by the router whenever a new series arrives.
config.py
Handling of configuration setting for the bookkeeper service
- bookkeeping.config.API_KEY: Optional[str]
- bookkeeping.config.BOOKKEEPER_HOST: str
- bookkeeping.config.BOOKKEEPER_PORT: int
- bookkeeping.config.DATABASE_SCHEMA: Optional[str]
- bookkeeping.config.DATABASE_URL: str
- bookkeeping.config.DEBUG_MODE: bool
- bookkeeping.config.bookkeeper_config: Config
database.py
Database functions needed for the bookkeeper service.
- bookkeeping.database.database: Database
- bookkeeping.database.dicom_files: Table
- bookkeeping.database.dicom_series: Table
- bookkeeping.database.dicom_series_map: Table
- bookkeeping.database.file_events: Table
- bookkeeping.database.mercure_events: Table
- bookkeeping.database.metadata: MetaData
- bookkeeping.database.processor_logs_table: Table
- bookkeeping.database.processor_outputs_table: Table
- bookkeeping.database.series_sequence_data: Table
- bookkeeping.database.task_events: Table
- bookkeeping.database.tasks_table: Table
- bookkeeping.database.tests_table: Table
- bookkeeping.database.webgui_events: Table
helper.py
Helper functions for the bookkeeper service.
- class bookkeeping.helper.CustomJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
Bases:
JSONEncoder
- default(obj)[source]
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
query.py
Entry functions of the bookkeeper for querying processing information.
- bookkeeping.query.convert_to_serializable(obj)[source]
Converts non-serializable objects to serializable types.
- bookkeeping.query.dicom_to_readable_json(ds: Dataset)[source]
Converts a DICOM file to a human-readable JSON format.
- Args:
file_path (str): Path to the DICOM file. output_file_path (str): Path to save the JSON output.
- async bookkeeping.query.get_dicom_files(request) JSONResponse [source]
Endpoint for getting all events related to one series.
- async bookkeeping.query.get_series(request) JSONResponse [source]
Endpoint for retrieving series in the database.
- async bookkeeping.query.get_task_events(request) JSONResponse [source]
Endpoint for getting all events related to one task.
- async bookkeeping.query.get_task_process_logs(request) JSONResponse [source]
Endpoint for getting all processing logs related to one series.
- async bookkeeping.query.get_task_process_results(request) JSONResponse [source]
Endpoint for getting all processing results from a task.