Select to view content in your preferred language

Retrieve and duplicate previous inspection recommendations

922
5
10-23-2024 05:25 AM
HanliePetoors
Frequent Contributor

Hi,

I'm working in ArcGIS Enterprise 11.3.

I want to create a Survey123 form for dam safety inspections. Each inspection will have a list of recommendations and each recommendation will have a status: incomplete, ongoing or complete.

When a follow-up inspection is conducted in the same place as a previous inspection, I would like to duplicate the incomplete and ongoing recommendations from the previous inspection for the follow-up inspection. So they will be new recommendation records, now connected to the follow-up inspection.

Is this possible in Survey123? Or is there some other way of achieving this so that the results are seen in Survey123?

Thanks

Hanlie

Tags (2)
0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

From the sound of things, there are multiple inspections that need to happen for a single dam. Is the data set up that way, with a related table for inspections? Or *can* it be set up that way, if the schema isn't set in stone yet?

To answer your question, I believe you could do this with Field Maps and a dynamic URL. More information about the data structure would be helpful, but I'm going to make some assumptions here. For one, we'll assume there's a field to differentiate between routine and followup inspections. Two, we'll assume that the inspections happen in a related table connected to the dam features.

The Form

In our Survey123 Connect XLSX form, we create a series of hidden questions at the top of the form. Each of these corresponds to the recommendations in the survey itself. Be sure to set the field type to null, as we do not want these fields to actually exist in the layer. And the "inspection_type" form can default to "routine" and be hidden as well, though that one isn't null.

question typenamedefaultbind::esri:fieldType
hiddenrecommendation1_relevant

N

null
hiddenrecommendation2_relevantNnull
hiddeninspection_typeroutineesriFieldTypeString

 

Later in the form, we use the value of these fields to drive the visibility of the real questions.

namerelevant
recommendation1${recommendation1_relevant} = 'Y' or ${inspection_type} = 'routine'
recommendation2

${recommendation2_relevant} = 'Y' or ${inspection_type} = 'routine'

 

Since these are hidden, null fields, they generally won't have an impact on the form, but that's where our URL comes in.

Survey Link from Popup

In our web map, we put use an Arcade popup element to generate a link. This link will use URL parameters to set "inspection_type" to "followup", and then set the various recommendationX_relevant fields to "Y" as needed.

// get the most recent inspection for the clicked feature

var insp = FeatureSetByRelationshipName(
  $feature,
  'dams_inspections'
)

var insp = OrderBy(
  insp,
  "inspection_date DESC"
)

latest = First(insp_sorted)

// start making survey link
var surveyURL = 'https://survey123.arcgis.com/share/your-survey-itemid?field:inspection_type=followup'

// list of recommendation field names
var recs = [
  'recommendation1',
  'recommendation2'
  // and so on
]

// go through list of field names; check value of routine inspection recommendations, add to URL as needed

var followup_values = ['incomplete', 'ongoing']

for (var r in recs) {
  if (Includes(followup_values, latest[recs[r]])) {
    surveyURL += `&field:${recs[r]}_relevant=Y`
  }
}

return surveyURL

 

This should spit out a URL, which will include a "&field:recommendationX_relevant=Y" parameter for each item set to "incomplete" or "ongoing" from the most recent inspection.

Clicking the link will open the form as usual, but because we've changed the inspection type and specified which relevant fields will be set to "Y", the form should hide all irrelevant fields, prompting only for those incomplete and ongoing items.

It's a lot to set up, and will need some tweaking to meet your data's particulars, but it's possible.

- Josh Carlson
Kendall County GIS
0 Kudos
HanliePetoors
Frequent Contributor

@jcarlson thanks for the reply, it's a good start.

For clarity here are some details about the envisaged data model. The ERD will be something like this:

HanliePetoors_2-1729752394374.png

 

And a data example would look like this:

HanliePetoors_1-1729751906506.png

 

So I actually want to duplicate recommendations that carry over to the next inspection. In the example above Recommendation 1A is duplicated as 2A for Inspection 2 because it is incomplete. The reason for this is that a report of each inspection must be submitted to another system and so the previous and current recommendations need to be permanent for each inspection. 

I don't really want to differentiate between initial and follow-up inspections because each dam will have regular inspections. I want to just retrieve the last inspection if it exist, along with its incomplete and ongoing recommendations. 

Thanks

Hanlie

0 Kudos
jonisilva
New Contributor

Hi Hanlie,

I am working exactly on the same thing. I am creating a concrete dam safety inspection form...perhaps we could exchange some ideas...

Let me know if you are keen to get in contact!

 

Thanks,

João

0 Kudos
HanliePetoors
Frequent Contributor

Hi @jonisilva ,

I have not made any progress on this. Other than copying the whole survey to a new survey from the Inbox I can't see how it could be done. The user would then have to update what has changed, such as the inspection date.

Regards

Hanlie

I'm happy to chat with you about this.

Regards

Hanlie

0 Kudos
HanliePetoors
Frequent Contributor
0 Kudos