livingdata-co / addok-geocode-stream Goto Github PK
View Code? Open in Web Editor NEWNode.js stream API for addok geocoder
License: MIT License
Node.js stream API for addok geocoder
License: MIT License
http://api-adresse.data.gouv.fr/search/?q=18%20boulevard%20Laromigui%C3%A8re%2012000%20RODEZ
vs.
echo 'adresse\n18 Boulevard Laromiguière 12000 Rodez' | ./cli.js
# adresse,latitude,longitude,result_label,result_score,result_type,result_id,result_housenumber,result_name,result_street,result_postcode,result_city,result_context,result_citycode,result_oldcitycode,result_oldcity,result_district
# 18 Boulevard Laromiguière 12000 Rodez,44.351057,2.577754,18 Boulevard de la R�publique 12000 Rodez,0.61,housenumber,12202_1580_00018,18,Boulevard de la R�publique,,12000,Rodez,"12, Aveyron, Occitanie",12202,,,
echo 'adresse,postcode\n18 Boulevard Laromiguière 12000 Rodez,12000' | ./cli.js --postcode postcode --columns adresse
# adresse,postcode,latitude,longitude,result_label,result_score,result_type,result_id,result_housenumber,result_name,result_street,result_postcode,result_city,result_context,result_citycode,result_oldcitycode,result_oldcity,result_district
# 18 Boulevard Laromiguière 12000 Rodez,12000,44.351057,2.577754,18 Boulevard de la République 12000 Rodez,0.61,housenumber,12202_1580_00018,18,Boulevard de la République,,12000,Rodez,"12, Aveyron, Occitanie",12202,,,
How can I affirm this?
See my commit that described what happen at ThomasG77@dcabb3d and also reference a gist to reproduce the issue on the server side. In the gist, we demonstrate the issue only using curl and playing with csv with different headers name.
The fix is done on the client side as the column geocoder__line
disappearance makes the code failing later and the renamed column does not appear in the end result.
What is more annoying is we got not idea why this behaviour happens on server side.
I can also make a PR using my commit, depending of your feedback. In this case, I will also change code in the tests https://github.com/jdesboeufs/addok-geocode-stream/blob/f312f219ecfedb3a87e34a461228cea308e8dc20/lib/__tests__/geocode.js
I got an issue using the tool
I'm using Node 16.13 on an Ubuntu 18.04
Running the following does not work
npm install -g addok-geocode-stream
wget https://gist.githubusercontent.com/ThomasG77/32329a8557135f11cb5656e3bfd4d35c/raw/9bd7883be31d2c9758d4393d72e9dc1ae4c5bed3/annuaire-des-debits-de-tabac-2018-utf8.csv
cat annuaire-des-debits-de-tabac-2018-utf8.csv | addok-geocode --encoding utf8 --columns adresse,code_postal,commune --semicolon
It returns
Options:
--help Show help [boolean]
--version Show version number [boolean]
--service Set geocoding service URL
[default: "https://api-adresse.data.gouv.fr"]
--columns Select columns to geocode, in the right order
--citycode Filter results by citycode
--postcode Filter results by postcode
--semicolon, --semi Use semicolon (;) as separator [boolean]
--tab Use tabulation as separator [boolean]
--pipe Use pipe as separator [boolean]
--result Select columns you want to be added to the result by the
geocoder. Default: all
--bucket Set how many rows are sent in each request
[number] [default: 200]
--concurrency Set how many requests must be executed concurrently
[number] [default: "1"]
--encoding Set data encoding. Can be detected automatically
[choices: "utf8", "latin1"]
Cannot read properties of undefined (reading 'split')
It's due to trying to split on undefined on arg option --results
.
I've made a commit on a branch to solve the issue ThomasG77@5a20037
Before making a PR, I needed to confirm with you my diagnostic.
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.