def METHOD_NAME(event, sender_app, **kwargs):
    """Build a record-view event.
    *Note* that this function assumes a request context by accessing properties of
    Flask's global ``request`` object.
    """
    assert "record" in kwargs
    record = kwargs["record"]
    is_published = getattr(record, "is_published", False)
    is_draft = getattr(record, "is_draft", True)
    # drop not published records
    if is_published and not is_draft:
        event.update(
            {
                # When:
                "timestamp": datetime.utcnow().isoformat(),
                # What:
                "recid": record["id"],
                "parent_recid": record.parent["id"],
                # Who:
                "referrer": request.referrer,
                **get_user(),
                # TODO probably we can add more request context information here for
                #      extra filtering (e.g. URL or query params for discarding the event
                #      when it's a citation text export)
            }
        )
        return event
    return None