@@ -180,6 +180,7 @@ def get_360(matching_id):
180180
181181
182182@common_api .route ('/api/person/<matching_id>/animals' , methods = ['GET' ])
183+ @jwt_ops .jwt_required ()
183184def get_animals (matching_id ):
184185 result = {
185186 "person_details" : {},
@@ -207,6 +208,7 @@ def get_animals(matching_id):
207208
208209
209210@common_api .route ('/api/person/<matching_id>/animal/<animal_id>/events' , methods = ['GET' ])
211+ @jwt_ops .jwt_required ()
210212def get_person_animal_events (matching_id , animal_id ):
211213 result = {}
212214 events = []
@@ -228,6 +230,7 @@ def get_person_animal_events(matching_id, animal_id):
228230 return result
229231
230232@common_api .route ('/api/person/<matching_id>/support' , methods = ['GET' ])
233+ @jwt_ops .jwt_required ()
231234def get_support_oview (matching_id ):
232235 """Return these values for the specified match_id:
233236 largest gift, date for first donation, total giving, number of gifts,
@@ -376,3 +379,31 @@ def get_support_oview(matching_id):
376379 current_app .logger .debug ('No SF contact IDs found for matching_id ' + str (matching_id ))
377380 oview_fields ['number_of_gifts' ] = 0 # Marker for no data
378381 return jsonify (oview_fields )
382+
383+
384+ @common_api .route ('/api/last_analysis' , methods = ['GET' ])
385+ @jwt_ops .jwt_required ()
386+ def get_last_analysis ():
387+ """ Return the UTC string (e.g., '2021-12-11T02:29:14.830371') representing
388+ when the last analysis run succesfully completed.
389+ Returns an empty string if no results.
390+ """
391+
392+ last_run = ''
393+
394+ last_stamp = """
395+ select update_stamp
396+ from execution_status
397+ where stage = 'flow' and status = 'complete'
398+ order by update_stamp desc
399+ limit 1;
400+ """
401+
402+ with engine .connect () as connection :
403+ result = connection .execute (last_stamp )
404+ if result .rowcount :
405+ row = result .fetchone ()
406+ last_run_dt = row [0 ] # We get as a datetime object
407+ last_run = last_run_dt .isoformat ()
408+
409+ return last_run
0 commit comments