package LIMS::Controller::Local::Worklist::FishWorksheet;
use base 'LIMS::Base';
use Moose;
with (
'LIMS::Controller::Roles::Misc',
'LIMS::Controller::Roles::User',
'LIMS::Controller::Roles::DataMap',
);
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
use Data::Dumper;
# ------------------------------------------------------------------------------
sub default : StartRunmode {
my $self = shift;
my @request_ids = $self->query->param('request_id');
{ # warn Dumper \@request_ids; # check at least 1 submitted:
my $url = $self->query->url()
. '/local_worklist?function_name=fish_worksheets';
return $self->redirect($url) unless @request_ids
}
# get request & report data for request_ids:
my %args = ( # to use existing method used by Search function
search_constraints => { id => \@request_ids },
); # warn Dumper \%args;
my $requests = $self->model('Request')->find_requests(\%args);
$self->tt_params( requests => $requests ); # warn Dumper $requests;
{ # get flow section result summary:
my @args = (\@request_ids, 'Flow cytometry'); # method accepts list mode args
my $o = $self->model('LabSection')->get_section_result_summaries(@args);
# convert to hashref map for tt:
my %map = map { $_->request_id => $_->results_summary } @$o;
$self->tt_params( result_summaries => \%map ); # warn Dumper \%map;
}
{ # get lab-test data from FISH section:
my %args = (
section_name => 'FISH',
request_id => \@request_ids,
);
my $o = $self->model('LabTest')->get_request_lab_tests_for_section(\%args);
# convert to hashref map for tt:
my %map = (); # need hash of arrays of objects - 1 request to many tests:
push @{ $map{$_->request_id} }, $_->lab_test->as_tree for @$o;
$self->tt_params( fish_data => \%map ); # warn Dumper $fish_tests;
}
{ # get probesets for fish panels from yaml config:
my $cfg = $self->get_yaml_file('fish_panel_probes');
$self->tt_params( panel_probes => $cfg );
}
return $self->tt_process('worklist/local/fish/worksheets_wrapper.tt');
}
1;