How to iterate through Survey123 responses for specific names, find missing names, and send missing names via email?

151
3
11-07-2019 03:38 PM
NDFAdmin
New Contributor III

Hello,

I've been trying to figure out the best way using Integromat, to iterate through a series of survey submissions for a specific day (by noon each day), find names missing from the submissions, and then email those missing names to a supervisor. I've played with a number of options, including using filters but keep coming up short.

It would also be of interest to be able to iterate through a set of responses, find names that are missing and then notify those missing people via email.

Has anyone tried to do this or know of a method?

Thanks!

Aaron

Reply
0 Kudos
3 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Aaron,

This concerns less Survey123 than simply accessing the feature service (as is done in A simple e-mail notification system for Survey123 for ArcGIS v2 ); it may also be a bit more straightforward to do in python than a webhook framework.  I would query the feature service, asking for the count of features grouped by submitter name for the time period (see Query (Feature Service/Layer)—ArcGIS REST API: Services Directory | ArcGIS for Developers , particularly using the returnDistinctValues option with your submitter field as the only entry in outFields). The comparison is fairly straightforward in Python; in a webhook context, you would probably need to use an iterator object to do the check along with an Array.contains function.

Reply
0 Kudos
DougBrowning
MVP Frequent Contributor

This is exactly how we do our QA.  I have a Python script that hits the HFS directly.  Brings all the data down into a search cursor.  Then it does a bunch of checks and creates a csv file.

Code is something like this

endURL = "/query?f=json&where=1=1&outFields=*&returnGeometry=true"

#item_id_to_query = r'9cffbbee279f43b0af9a9ef65ddfe3237'

plotsURL = "/" + "0" + endURL

response = s.post(url+"/content/items/{}?f=json".format(item_id_to_query))
fs_endpoint = response.json().get('url')

# plots
q_response = s.get(fs_endpoint + plotsURL)
plotsF = arcpy.FeatureSet()
plotsF.load(q_response.url)

plotKeys = []
# get a list of Eval PlotKeys from Plots
whereClause = "EvalStatus = 'Eval'"
with arcpy.da.SearchCursor(plotsF,"PlotKey", whereClause) as cursor:
for row in cursor:
plotKeys.append(row[0])

Reply
0 Kudos
NDFAdmin
New Contributor III

Thanks! I will give the Python method a go.

Reply
0 Kudos