-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new Node.js demo for batch geocoding a .csv #105
Conversation
very, very cool @mpayson! i've got other fires blazing now, but i'll find time to review and help you get this landed soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great! we can merge after you have a chance to address my feedback.
demos/batch-geocoder/README.md
Outdated
@@ -0,0 +1,7 @@ | |||
# Running this demo | |||
|
|||
1. `$ git clone https://github.com/mpayson/arcgis-rest-js.git` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the other demo instructions assume the repo has already been cloned.
nothing wrong with you deviating, but if you do, you should point folks at Esri/arcgis-rest-js 😄.
demos/batch-geocoder/README.md
Outdated
|
||
1. `$ git clone https://github.com/mpayson/arcgis-rest-js.git` | ||
2. `$ cd arcgis-rest-js/demos/batch-geocoder/` | ||
3. `$ npm install` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is a monorepo, we shouldn't direct them to npm install
inside individual packages.
instead they should run npm run bootstrap
in the root of the repo to appropriately symlink the needed dependencies.
resultMap = mapResults(res); | ||
output = data.map((row, i) => { | ||
id = row[config.fieldmap.OBJECTID] || i; | ||
return {...row, ...resultMap[id]}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you're using spread operators and other fancy new JS stuff, you need to make a point in the doc of explaining that Node.js 8.x or higher is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ added dependency to readme.
I think spread etc only requires >6.x? Can also update to support older versions?
un: "<USERNAME>", | ||
pw: "<PASSWORD>", | ||
csv: "<PATH/TO/CSV>", | ||
fieldmap: "<CSV TO REQUEST FIELD MAP OR ADDRESS FIELD>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd recommend:
- encasing
un
and your other properties as strings - just hardcoding the .csv path to use your example file.
- either doing the same with the fieldmap or at least including it in copy/pasteable form in a code comment in the same file.
{
"fieldmap": {
"postal": "ZIPCODE"
}
}
in general, the fieldmap was the biggest point of confusion when i ran your app. it'd make this sample substantially more self explanatory if you talked through what it is and what it is doing.
demos/batch-geocoder/package.json
Outdated
@@ -0,0 +1,36 @@ | |||
{ | |||
"name": "batch-geocoder", | |||
"version": "0.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the same version number as everything else in the repo. 1.0.2
.
demos/batch-geocoder/package.json
Outdated
"arcgis-rest-js" | ||
], | ||
"author": "Max Payson (mpayson)", | ||
"license": "ISC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
demos/batch-geocoder/package.json
Outdated
"@esri/arcgis-rest-request": "^1.0.2", | ||
"isomorphic-fetch": "^2.2.1", | ||
"isomorphic-form-data": "^1.0.0", | ||
"papaparse": "^4.3.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should include "private": true
to ensure this doesn't accidentally get published to npm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ here
demos/batch-geocoder/package.json
Outdated
{ | ||
"name": "batch-geocoder", | ||
"version": "0.0.1", | ||
"description": "arcgis-res-js batch geocode sample", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arcgis-res-js > arcgis-rest-js (with a 't')
at some point, it'd be worth considering using something like Sanitize.js or even a simple regex to remove <script> tags from within values inside the .csv (in the unlikely event of an |
are you going to have a chance in the next two weeks to take one more pass at this? i'd like to show it off at DevSummit so i can get it landed if push comes to shove. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object spread properties > 8.6.0
other than that, the PR looks great.
nah, lets keep them separate. i'd like to see our collection of demos grow to include lots of different browser samples and lots of Node.js samples too. |
pushed one more commit to rename the directory thx again @mpayson for contributing this sweet demo! |
…v in node AFFECTS PACKAGES: batch-geocoder @esri/arcgis-rest-geocoder-vanilla @esri/arcgis-rest-demo-vanilla ISSUES CLOSED: Esri#97
5b10616
to
152c9d8
Compare
Hey team, first take on a batch geocode sample for Node, would love feedback on:
Excel thinks the outputmight be local problem.csv
is corrupt, not sure why or how to fix?@phpmaps @jgravois