esri / crowdsource-reporter-scripts Goto Github PK
View Code? Open in Web Editor NEWScripts that can be used to extend the functionality of crowdsource reporter
License: Apache License 2.0
Scripts that can be used to extend the functionality of crowdsource reporter
License: Apache License 2.0
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
Should investigate if we can just query features whose field to be enriched is null.
def enrich_layer(source, target, settings):
wkid = target.properties.extent.spatialReference.wkid
# Query for target features
rows = _get_features(target, """{} is null""".format(settings['target']), return_geometry=True)
When an non- text field is used in the "Field" parameter in the script - no values are written to that field when looked at the service. I would be nice to have an error message thrown in the log.
Line # 24
Step: 6
'field': Name of the field that will hold the calculated identifiers.
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.
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
assign status, priority, dept based on values
Current calls are retrieving/sending ALL of the attributes and increasing the amount of data sent back and forth to service.
Use this pattern
features = fl.query(where_clause, out_fields = [list of needed fields for attribute changes])
for feature in features:
feature.set_value("necessary field", "updated value")
fl.edit_features(updates=features)
At the line below substitutions can be None which raises an exception falsely reporting that their was a failure reading the email template
https://github.com/Esri/crowdsource-reporter-scripts/blob/single-tool/servicefunctions.py#L207
@aparker-cityworks please review the following so I can move this tool into Master:
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.
Step 9 in the http://solutionsdev.arcgis.com/local-government/help/crowdsource-reporter/get-started/generate-ids/
In the doc, replace "sequence type" with "id-name" to match with the column name in the csv.
when problem type isn't found in cityworks, it could be either of 2 reasons
PReserve the enrichment layer and the target field (when logical to do so) when choosing a new target layer.
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.
Mention to specify the service with layer id in the doc
Step 6: 'url': The URL to the REST endpoint of the service (ArcGIS Online and Portal) or the path to the feature class that is the source of the service data (ArcGIS Server)
Couldn't use SQL parameters in v1 due to pro bug. Try to re-implement SQL builder param
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]))
attribute should not update if email server returns an error.
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']:
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:
The line 245 in my script is relate to the authentication:
And here is what I have in the script for establishing the connection:
I was wondering if something has changed in the Cityworks 15.6.1 and how authentication is done?
Thanks,
Nataliya
The variable name is 'path' in the script, please change 'url' to 'path' in the doc to avoid confusion in Step 6 in the doc http://solutionsdev.arcgis.com/local-government/help/crowdsource-reporter/get-started/generate-ids/
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')
also fix SQL syntax in comments (fixed in Master)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.