def gi_patient_view(): """ Inserts a GI patient_view document directly to the database. """ # authorize request. not_authed = authorize_custom_request(request) if not_authed: resp = Response(response="not authorized route", status=401, mimetype="application/json") return resp # create document data = request.get_json() all_protocol_nos = data['all_protocol_nos'] mrn = data['mrn'] documents = [] for protocol_no in all_protocol_nos: document = { 'requires_manual_review': False, 'user_user_name': 'gi-automation', 'user_first_name': 'gi-automation', 'user_last_name': 'gi-automation', 'mrn': mrn, 'view_date': datetime.datetime.now(), 'protocol_no': protocol_no } documents.append(document) # insert into mongodb patient_view_conn = app.data.driver.db['patient_view'] patient_view_conn.insert(documents) return json.dumps({"success": True}), 201
def send_emails(): # authorize request. not_authed = authorize_custom_request(request) if not_authed: resp = Response(response="not authorized route", status=401, mimetype="application/json") return resp # trigger email. matchminer.miner.email_matches() return json.dumps({"success": True}), 201