()
return {
        "script_pact_id": {
            "script": """if(_source['form']['note'] != null) { _source['form']['note']['pact_id']['#value']; }
                      else if (_source['form']['pact_id'] != null) { _source['form']['pact_id']['#value']; }
                      else {
                          null;
                      }
                      """
        },
        "script_encounter_date": {
            "script": """if(_source['form']['note'] != null) { _source['form']['note']['encounter_date']['#value']; }
        else if (_source['form']['encounter_date'] != null) { _source['form']['encounter_date']['#value']; }
        else {
            _source['received_on'];
        }
        """
        }
    }
This is a hack of the query to allow for the encounter date and pact_ids to show up as first class properties
This is a hack of the query to allow for the encounter date and pact_ids to show up as first class properties
This is a hack of the query to allow for the encounter date and pact_ids to show up as first class properties
def pact_script_fields():
    """
    This is a hack of the query to allow for the encounter date and pact_ids to show up as first class properties
    """
    return {
        "script_pact_id": {
            "script": """if(_source['form']['note'] != null) { _source['form']['note']['pact_id']['#value']; }
                      else if (_source['form']['pact_id'] != null) { _source['form']['pact_id']['#value']; }
                      else {
                          null;
                      }
                      """
        },
        "script_encounter_date": {
            "script": """if(_source['form']['note'] != null) { _source['form']['note']['encounter_date']['#value']; }
        else if (_source['form']['encounter_date'] != null) { _source['form']['encounter_date']['#value']; }
        else {
            _source['received_on'];
        }
        """
        }
    }
def pact_script_fields ( ) : return { "script_pact_id" : { "script" : """if(_source['form']['note'] != null) { _source['form']['note']['pact_id']['#value']; }
                      else if (_source['form']['pact_id'] != null) { _source['form']['pact_id']['#value']; }
                      else {
                          null;
                      }
                      """ } , "script_encounter_date" : { "script" : """if(_source['form']['note'] != null) { _source['form']['note']['encounter_date']['#value']; }
        else if (_source['form']['encounter_date'] != null) { _source['form']['encounter_date']['#value']; }
        else {
            _source['received_on'];
        }
        """ } }