arcgis.apps.survey123 module

SurveyManager

class arcgis.apps.survey123.SurveyManager(gis, baseurl=None)

Bases: object

Survey Manager allows users and administrators of Survey 123 Surveys to analysis, report on , and access the data for various surveys.

get(survey_id)

returns a single Survey object from and Item ID or Item

property surveys

returns a list of existing Survey

Survey

class arcgis.apps.survey123.Survey(item, sm, baseurl=None)

Bases: object

A Survey is a single instance of a survey project. This class contains the Item information and properties to access the underlying dataset that was generated by the Survey form.

Data can be exported to Pandas DataFrames, shapefiles, CSV, and File Geodatabases.

In addition to exporting data to various formats, a Survey’s data can be exported as reports.

check_template_syntax(template_file=None)

A sync operation to check any syntax which will lead to a failure when generating reports in the given feature.

Argument

Description

template_file

Required String. The report template file which syntax to be checked.

Returns

dictionary {Success or Failure}

create_report_template(template_type=None)

The create_report_template creates a simple default template that can be downloaded locally, editted and uploaded back up as a report template.

Argument

Description

template_type

Optional String. Specify which sections to include in the template. Acceptable types are individual, summary, and summaryIndividual. Default is individual.

Returns

string

create_sample_report(report_template, where='1=1', utc_offset='+00:00', report_title=None, merge_files=None, survey_item=None, webmap_item=None, map_scale=None, locale='en')

Similar task to generate_report for creating test sample report, and refining a report template before generating any formal report.

Argument

Description

report_template

Required Item. The report template Item.

where

Optional String. This is the select statement used to export part or whole of the dataset. If the record count is > 1, then the item must be saved to your organization.

utc_offset

Optional String. This is the time offset from UTC to match the users timezone. Example: EST - “+04:00”

report_title

Optional String. Specify the file name (without extension) of the result report file. For example, if outputFormat is .pdf, input: “abc” -> output: “abc.pdf”; input: “abc.docx” -> output: “abc.docx.pdf”.

If packageFiles is true, outputReportName will be used for report files inside the packaged file. If mergeFiles is either nextPage or continuous, outputReportName will be used as the merged file name.

merge_files

Optional String. Specify if print multiple records into a single report file (merged mode) or multiple files (split mode), and if in merge mode, start the next record on a new page or continue with the current page. Note: A merged file larger than 500MB will be split into mulitple files.

  • none - Print multiple records in split mode, each record becomes a separated report file. This is the default value.

  • nextPage - Print multiple records in merge mode, the content of the next record starts on the next new page.

  • continuous - Print multiple records in merge mode, the content of the next record starts on the same page of the previous record.

survey_item

Optional Item. Survey Item, to make the operation survey awareness.

webmap_item

Optional Item. Specify the base map for printing task when printing a point/polyline/polygon. This takes precedence over the map set for each question inside a survey.

map_scale

Optional Float. Specify the map scale when printing, the map will center on the feature geometry.

locale

Optional String. Specify the locale setting to format number and date values.

Returns

string

download(export_format, save_folder=None)

Exports the Survey’s data to other format

Argument

Description

export_format

Required String. This is the acceptable export format that a user can export the survey data to. The following formats are acceptable: File Geodatabase, Shapefile, CSV, and DF.

save_folder

Optional String. The full save path. This is optional.

Returns

string or pd.DataFrame

estimate(report_template, where='1=1')

An operation to estimate how many credits are required for a task with the given parameters.

Argument

Description

report_template

Required Item. The report template Item.

where

Optional String. This is the select statement used to export part or whole of the dataset. If the filtered result has more than one feature/record, the request will be considered as a batch printing. Currently, one individual report will be generated for each feature/record.

Returns

dictionary {totalRecords, cost(in credits)}

generate_report(report_template, where='1=1', utc_offset='+00:00', report_title=None, package_name=None, output_format='docx', folder_id=None, merge_files=None, survey_item=None, webmap_item=None, map_scale=None, locale='en')

Creates a MS Word Report or PDF. The generate_report method allows users to either save the report to the enterprise or export it directly to disk.

To save to disk, do not specify a folder_id.

For additional information on parameters, see Create Report.

Argument

Description

report_template

Required Item. The report template Item.

where

Optional String. This is the select statement used to export part or whole of the dataset. If the record count is > 1, then the item must be saved to your organization.

utc_offset

Optional String. This is the time offset from UTC to match the users timezone. Example: EST - “+04:00”

report_title

Optional String. Specify the file name (without extension) of the result report file. For example, if outputFormat is .pdf, input: “abc” -> output: “abc.pdf”; input: “abc.docx” -> output: “abc.docx.pdf”.

If mergeFiles is either nextPage or continuous, outputReportName will be used as the merged file name. See Create Report for detailed explanation.

package_name

Optional String. Specify the file name (without extension)of the packaged file when packageFiles is true, for example, <outputPackageName>.zip.

output_format

Optional string. Currently only docx and pdf are supported.

folder_id

Optional String. The folder ID of the user’s content.

merge_files

Optional String. Specify if print multiple records into a single report file (merged mode) or multiple files (split mode), and if in merge mode, start the next record on a new page or continue with the current page. Note: A merged file larger than 500MB will be split into mulitple files.

  • none - Print multiple records in split mode, each record becomes a separated report file. This is the default value.

  • nextPage - Print multiple records in merge mode, the content of the next record starts on the next new page.

  • continuous - Print multiple records in merge mode, the content of the next record starts on the same page of the previous record.

survey_item

Optional Item. Survey Item, to make the operation survey awareness.

webmap_item

Optional Item. Specify the base map for printing task when printing a point/polyline/polygon. This takes precedence over the map set for each question inside a survey.

map_scale

Optional Float. Specify the map scale when printing, the map will center on the feature geometry.

locale

Optional String. Specify the locale setting to format number and date values.

Returns

Item or string upon completion of Job.

For details on the return value, see Response Parameters for generate_report() job.

property properties

returns the properties of the survey

property report_templates

Returns a list of saved report items

Returns

list of Items

property reports

returns a list of generated reports

update_report_template(template_file=None)

Check report template syntax to idenfify any syntax which will lead to a failure when generating reports in the given feature and updates existing Report template Org item.

Argument

Description

template_file

Required String. The report template file which syntax to be checked, and uploaded. The updated template name must match the name of the existing template item.

Returns

item {Success) or string (Failure}

upload_report_template(template_file=None, template_name=None)

Check report template syntax to idenfify any syntax which will lead to a failure when generating reports in the given feature. Uploads the report to the organization and associates it with the survey.

Argument

Description

template_file

Required String. The report template file which syntax to be checked, and uploaded.

template_name

Optional String. If provided the resulting item will use the provided name, otherwise the name of the docx file will be used.

Returns

item {Success) or string (Failure}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.