<& /htmlfooter &>
<%args>
$desig
%args>
<%init>
use Astro::Time;
use PS::MOPS::Lib qw(:all);
use PS::MOPS::Constants qw(:all);
use PS::MOPS::MPC;
use PS::MOPS::DC::Instance;
my %dispmap = (
'1' => 'NEOCP (1-NIGHTER)',
'2' => 'NEOCP (FOLLOWED UP)',
S => 'SUBMITTED',
T => 'SUBMITTED, NON-NEO',
C => 'DISCOVERY, NEO',
A => 'DISCOVERY, PHA',
M => 'DISCOVERY, COMET',
N => 'DISCOVERY, NON-NEO',
R => 'RECOVERY, NEO',
K => 'KNOWN',
D => 'DOWNGRADED',
O => 'OUTREACH',
J => 'REJECTED',
);
my @dispsel = qw(1 2 S T C A M N R K D O J); # allowed dispositions
# LD XXX need to wrap this into PS::MOPS::MPC::Export.
my $inst = PS::MOPS::DC::Instance->new(DBNAME => 'psmops_export');
my $dbh = $inst->dbh();
my @obs;
my $sql = <<"SQL";
select
epoch_mjd,
survey_mode,
ra_deg,
dec_deg,
filter_id,
mag,
obscode,
desig,
mpc_desig,
digest,
dbname,
tracklet_id,
disposition,
submitter,
revised
from export.mpc_sub
where desig=?
order by epoch_mjd desc
SQL
my $sth = $dbh->prepare($sql) or die $dbh->errstr;
$sth->execute($desig) or die $sth->errstr;
my $href;
while (my $h = $sth->fetchrow_hashref()) {
push @obs, {
epoch => $h->{epoch_mjd},
ra => $h->{ra_deg},
dec => $h->{dec_deg},
mag => $h->{mag},
filter => $h->{filter_id},
obscode => $h->{obscode}
};
$href = $h unless $href; # keep first one only as ref to group
}
$sth->finish();
%init>