Source code for API

#!/usr/bin/python3

from os.path import dirname,realpath,join
import sys
sys.path.append(dirname(__file__))
from pathlib import Path
from eventmodule import EventHandler

[docs]class API(EventHandler): """An example API class This class is used to implement the interface of a software module """ def __init__(self): """ With the constructor you can set the example event values such that it will always work when calling handle_example. Furthermore the __init__ class of the parent super(). :any:`eventmodule.EventHandler` must be called as well """ self.example_event_number = "-1" self.example_patient_xml = dirname(realpath(__file__)) + "/eventmodule/example_patient.xml" super().__init__()
[docs] def handle_event(self): """ Implementation of the placeholder function :any:`eventmodule.EventHandler.handle_event` """ patient_dir = self.patient.find("Patient_directory").text Path(patient_dir + "/clot_present").touch()
[docs] def handle_example(self): """ Implementation of the placeholder function :any:`eventmodule.EventHandler.handle_example` """ # No other special treatment for example now, # but there could be visualization for example self.handle_event()
[docs] def handle_tests(self): """ Implementation of the placeholder function :any:`eventmodule.EventHandler.handle_tests` """ self.handle_example()
if __name__ == "__main__": api = API()