Skip to content

Commit

Permalink
Set crossids which are asteroids to inactive. Set NEOs or comets to i…
Browse files Browse the repository at this point in the history
…nactive if more than 3 days have passed since the confirm date
  • Loading branch information
talister committed Apr 29, 2015
1 parent 0296f4c commit bb81739
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions neoexchange/ingest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,25 @@ def update_crossids(astobj, dbg=False):


def clean_crossid(astobj, dbg=False):
'''Takes an <astobj> (a list of new designation, provisional designation,
reference and confirm date produced from the MPC's Previous NEOCP Objects
page) and determines the type and whether it should still be followed.
Objects that were not confirmed, did not exist or "were not interesting
(normally a satellite) are set inactive immediately. For NEOs and comets,
we set it to inactive if more than 3 days have passed since the
confirmation date'''

interesting_cutoff = 3 * 86400 # 3 days in seconds

confirm_date = parse_neocp_date(astobj[3])
obj_id = astobj[0].rstrip()
desig = astobj[1]
reference = astobj[2]

time_from_confirm = datetime.utcnow() - confirm_date
time_from_confirm = time_from_confirm.total_seconds()

active = True
if obj_id != '' and desig == 'wasnotconfirmed':
# Unconfirmed, no longer interesting so set inactive
Expand All @@ -265,12 +278,17 @@ def clean_crossid(astobj, dbg=False):
# There is a reference to an CBET so we assume it's "very
# interesting" i.e. a comet
objtype = 'C'
if time_from_confirm > interesting_cutoff:
active = False
elif 'MPEC' in reference:
# There is a reference to an MPEC so we assume it's
# "interesting" i.e. an NEO
objtype = 'N'
if time_from_confirm > interesting_cutoff:
active = False
else:
objtype = 'A'
active = False

params = { 'source_type' : objtype,
'name' : desig,
Expand Down

0 comments on commit bb81739

Please sign in to comment.