from archemist.state.state import State
from archemist.state.batch import Batch
from archemist.persistence.persistenceManager import PersistenceManager

pers_manager = PersistenceManager('algae_bot_test2')
state = pers_manager.construct_state_from_db()
batches = state.get_completed_batches()
for batch in batches:
   samples = batch.get_samples_list()
   for sample in samples:
    operation_ops = sample.operation_ops
    out_str = f'batch: {batch.id} - sample_indx: {sample.rack_index} - R:{operation_ops[-1].output.red_value} G:{operation_ops[-1].output.green_value} B:{operation_ops[-1].output.blue_value} - filename: {operation_ops[-1].output.file_name}'
    print(out_str)
