api/push_notifications_api.py
def send_survey_notification():
    """
    Sends a push notification to the participant with survey data, used for testing
    Expects a patient_id in the request body
    """
    participant = get_session_participant()
    survey_ids = list(
        participant.study.surveys.filter(deleted=False).exclude(survey_type="image_survey")
            .values_list("object_id", flat=True)[:4]
    )
    message = messaging.Message(
        data={
            'type': 'survey',
            'survey_ids': json.dumps(survey_ids),
            'sent_time': datetime.now().strftime(constants.API_TIME_FORMAT),
        },
        token=participant.get_fcm_token().token,
    )
    response = messaging.send(message)
    print('Successfully sent survey message:', response)
    return '', 204

    Sends a push notification to the participant with survey data, used for testing
    Expects a patient_id in the request body
    
Sends a push notification to the participant with survey data, used for testing
Expects a patient_id in the request body
Sends a push notification to the participant with survey data used for testing Expects a patient_id in the request body
def send_survey_notification():
    participant = get_session_participant()
    survey_ids = list(
        participant.study.surveys.filter(deleted=False).exclude(survey_type="image_survey")
            .values_list("object_id", flat=True)[:4]
    )
    message = messaging.Message(
        data={
            'type': 'survey',
            'survey_ids': json.dumps(survey_ids),
            'sent_time': datetime.now().strftime(constants.API_TIME_FORMAT),
        },
        token=participant.get_fcm_token().token,
    )
    response = messaging.send(message)
    print('Successfully sent survey message:', response)
    return '', 204
def send_survey_notification ( ) : participant = get_session_participant ( ) survey_ids = list ( participant . study . surveys . filter ( deleted = False ) . exclude ( survey_type = "image_survey" ) . values_list ( "object_id" , flat = True ) [ : 4 ] ) message = messaging . Message ( data = { 'type' : 'survey' , 'survey_ids' : json . dumps ( survey_ids ) , 'sent_time' : datetime . now ( ) . strftime ( constants . API_TIME_FORMAT ) , } , token = participant . get_fcm_token ( ) . token , ) response = messaging . send ( message ) print ( 'Successfully sent survey message:' , response ) return '' , 204
Sends a push notification to the participant with survey data, used for testing
Expects a patient_id in the request body
Sends a push notification to the participant with survey data used for testing Expects a patient_id in the request body
"""
    Sends a push notification to the participant with survey data, used for testing
    Expects a patient_id in the request body
    """