GithubHelp home page GithubHelp logo

esri / crowdsource-reporter-scripts Goto Github PK

View Code? Open in Web Editor NEW
13.0 32.0 11.0 1004 KB

Scripts that can be used to extend the functionality of crowdsource reporter

License: Apache License 2.0

Python 99.83% HTML 0.17%
data-management solutions local-government crowdsource-reporter python government crowdsourcing

crowdsource-reporter-scripts's Issues

issue selecting a table from the current map

Using either the Moderate or the Email tools:
When I select a table layer as the input layer (eg the comments layer from a Reporter config), I'm having a hard time getting the URL to that layer. The object that is returned is a geoprocessing value object that has no .describe, .properties, or .connectionProperties.

I can get to the URL if the map containing that layer is active by navigating through the current project and active map properties (thanks @cosbyr !). If the user navigates away from that map after selecting the table, I lose the URL. I also can't get the URL in the first place if that map isn't active, even though the table will show in the drop down.

suggestions?
@chris-fox @cosbyr @ChrisBuscaglia

review instructions

@aparker-cityworks please review the following so I can move this tool into Master:

  • Review the instructions for this tool in the ReadMe
  • Review the in-tool parameter help
  • Verify that you guys are ok with the tool & toolbox names ( @ScottOppmann would like your ok here, too)

No module named 'send_email'

Hello,
I'm attempting to run servicefunctions.py from Jupyter Notebook, but it doesn't recognize the send_email module:
from send_email import EmailServer

Connect2Cityworks.pyt KeyError operationalLayers

When I try to run the Connect2Cityworks tool in ArcGIS Pro, I get a KeyError on 'operationalLayers'. It looks like this line is causing the issue:
for layer in webmap['operationalLayers']:

Changing the line to the following appears to resolve the issue:
for layer in webmap.definition['operationalLayers']:

BUG-000113756 The ServiceFunction.py script produces errors indicating it could not read the email template when no substitution is used in the email.

Salesforce ID: BUG-000113756
Salesforce Submitter: Andy Shoemaker
Salesforce Submit Date: 5/04/2018 1:35 AM
Salesforce Bug Type: Usability
Salesforce Severity: High
Repro Data: (n/a)
Work Around: Set a substitution in the SendEmails tool.
Product: ArcGIS Pro
Functional Category: ArcGIS for Local Government
Client Platform: (n/a)
Version Found: 2.1.2
Planned Version Fixed: (n/a)
Comment: (n/a)

reduce connections to email server to 1/script run

Causes connection failures to AWS when too many connections are attempted too quickly.

script currently connects to email server for every service. Remove With statement that initiates email server connection and move the connection to outside the services loop. Reference the server connection inside the email processing section for each service. Close email server connection as part of Finally block.

ENH-000114300 Allow apps that use crowd source reporter to moderate comments.

Salesforce ID: ENH-000114300
Salesforce Submitter: Katrina McLean
Salesforce Submit Date: 5/29/2018 10:57 AM
Salesforce Bug Type: Product
Salesforce Severity: Low
Repro Data: (n/a)
Work Around: User Story: It would be good to be able to moderate the comments so that any inappropriate comments can be removed. It would be best to have this adapted in the moderate reports stand alone script, but alternatively this would be a great option in ArcGIS Online from the solutions deployment tool.

Steps to Demonstrate:
Install the moderate reports toolbox and try to moderate comments in a related table. It will give an error.
Deploy Crowd Reporting application. There is no option to moderate incoming comments.

Product: ArcGIS for Local Government
Functional Category: ArcGIS for Local Government
Client Platform: (n/a)
Version Found: (n/a)
Planned Version Fixed: (n/a)
Comment: (n/a)

sql parameters

Couldn't use SQL parameters in v1 due to pro bug. Try to re-implement SQL builder param

Recommend using %c for strftime of value subsitution

In the _get_value function dates are being formatted as '%d-%m-%Y %H:%M:%S'. If you use '%c' instead the date/time will be returned in the system locale’s appropriate date and time representation.

            try:
                val = dt.fromtimestamp(
                    row.attributes[sub]).strftime('%c')
            except OSError:  # timestamp in milliseconds
                val = dt.fromtimestamp(
                    row.attributes[sub] / 1000).strftime('%c')

Suggestion - Step 6- Type vairable

Type Variable - either we can specify this is not a datatype of the field (in addition to the description we have already) or change the variable name, so end users don't get confused (if they are skimming through the doc) as 'type' is preceded by 'field' variable.

Send Email parameter help

  • email spelled wrong in tool metadata tags
  • typo in 'Sent Values' in SQL Query description in email settings param
  • typo in 'sending' in Sent Value description in email settings param
  • I think the information about authenticating through a port is misleading in the smtp_server, username and password params. To send an e-mail through my gmail I need to provide the port and my gmail username and password. I think the fact that username and password are optional params is enough to say they are not required and it is unrelated to providing a port.
  • typo in Reply Address param help 'replies sto the'

issue with subbing values not from fields

There is an error in the script. Line that says:
email_subject = email_subject.replace(sub, str(feature.attributes[message['body substitutions'][sub]]))

This tries to replace using a field value, but you are building the URL with configured strings, not field values. It works if you change this line to say:
email_subject = email_subject.replace(sub, str(message['body substitutions'][sub]))

Crowdsource to Cityworks integration error: json.decoder.JSONDecodeError

I couple months ago I updated my test Cityworks instance to the 15.6.1. Ever since I am not able to run the Crowdsource to Cityworks integration script. I am getting the following error:
image

The line 245 in my script is relate to the authentication:
image

And here is what I have in the script for establishing the connection:
image

I was wondering if something has changed in the Cityworks 15.6.1 and how authentication is done?

Thanks,
Nataliya

One of maps wouldn't open on a mobile

In our citizen reporter application one of the maps stopped working (wouldn't open) when using application on a mobile device. It works as expected on the desktop.

Here is our application: Omaha Hotline

The problem category is Graffiti

Thank you,
Nataliya

Define Portal Settings enhancement to get Portal connections in Pro

What if instead of asking the user to input their Portal URL, you make it a pick list using URLs the user added to Pro. You can use arcpy.ListPortalURLs() to return all the Portal URLs the user currently has added to Pro. You can use GetActivePortalURL() to set the default for the parameter to the active portal. I think this would be a nice enhancement and get around the issue of the user typing in the url incorrectly. I think it is ok to restrict them to Portals defined in Pro because the Feature Layer params in other tools will fail to validate the service if it is secured and you don’t have a valid Portal connection to it.

Similarly for the username you can use arcpy.GetPortalDescription(URL)['user']['username'] to get the username for the portal connection and default that when they select a Portal URL. You need to check if the key ‘user’ exists in the returned dictionary because if they are not signed in this key won’t exist.

ENH-000116673 Provide the ability to enter multiple email addresses in the Recipient Email Address section when using the Send Emails script found within the ServiceFunctions toolbox.

Salesforce ID: ENH-000116673
Salesforce Submitter: Matthew Metten
Salesforce Submit Date: 9/10/2018 2:37 AM
Salesforce Bug Type: Product
Salesforce Severity: Medium
Repro Data: (n/a)
Work Around: User Story: The user and his organization is utilizing this Solution/Send Email tool to send emails to a large number of people (20 to 40). The overall workflow would require the user to redundantly add the same information (Email Template, SQL Query, etc) 20 to 40 times just to include more than recipient. Providing/allowing this functionality would increase the efficiency of the tool and also allow for a more streamlined/modern tool for setting up such a function. 

Steps to Demonstrate: 
  1. Download and extract the ServiceFunctions toolbox.
  2. Open the toolbox in ArcGIS Pro 2.x and, if you've never used the toolbox before, run the Define Connection Settings tool to establish a connection between the toolbox and the ArcGIS Enterprise portal or ArcGIS Online organization containing the layers which will be used to trigger and generate the emails.
  3. Open the Send Emails tool.
  4. If the tool has not been run previously, start by specifying the connection information for your SMTP server in the General Email Settings section of the tool by providing the following values:
  • SMTP Server—URL of the SMTP server used for sending emails (within Esri network: SMTP.esri.com:25)
  • If outside the network:
  • SMTP Username—The username required to authenticate to the SMTP server. This is not required if authenticating through a port.
  • SMTP Password—The password required to authenticate to the SMTP server. This is not required if authenticating through a port.
  • From Address—The address from which the emails should be sent.
  • Reply Address—The address that should be used for any replies to the email message.
  1. Browse to the path of an HTML template for the body of the email (found in the servicesupport download folder).
  2. Provide a valid SQL Query (1=1)
  3. Provide the email address of the recipient and note that nowhere in the doc or the tool does it explain if you can or cannot add multiple recipients. Additionally, adding any delimiter and an additional email address does not provide the ability to send the email to multiple recipients.
  4. Provide a subject and a field to update and select Run.
  5. Navigate to the send_email Python script and run with ArcGIS Pro IDLE.
  6. Overall outcome will be one recipient even if multiple addresses are added. In the received email it shows the other addresses but these are never actually sent properly.

Product: ArcGIS for Local Government
Functional Category: ArcGIS for Local Government
Client Platform: (n/a)
Version Found: 2.2
Planned Version Fixed: (n/a)
Comment: (n/a)

add message to cityworks tool

when problem type isn't found in cityworks, it could be either of 2 reasons

  • typo/problem doesn't exist as written
  • report type in CW doesn't have 'For Public Website' option enabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.