Skip to content

Conversation

@ponder2342
Copy link
Contributor

Please refer to the documentation for new endpoints added in this PR. I hope I did not clutter the API unnecessarily.

@ponder2342
Copy link
Contributor Author

ponder2342 commented Jan 29, 2018

The following endpoints do not mark weather or not a thing or a version hast the status deleted:

  • /place/all
  • /raw/all
  • /place/UUID/versions
  • /raw/UUID/versions
  • /versions
  • /versions/since/TIMESTAMP
  • /versions/latest/COUNT

The error is in the convertArrayToFeatureCollection function.

@almereyda almereyda self-requested a review January 30, 2018 15:51
Copy link
Member

@almereyda almereyda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Pull Request seems feature complete, documents, tests and implements the desired features and adds helpers which will be reused elsewhere (_timestamp).

For testing these commits in an environment with live data, I have replicated the things database from our staging environment locally and ran this code against it. The follwing results from an integration test look rather promising:

λ ./418-test.sh                                                                                                                                  0 < 20:12:21
+ cat ./418-test.sh
#!/usr/bin/env bash

set -e -x
cat $0

curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/versions
curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/version/e98fb9126657fd09e8c7e432170685cb
curl -w '\n' -s http://localhost:5000/versions | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/e98fb9126657fd09e8c7e432170685cb
curl -w '\n' -s http://localhost:5000/versions/latest/20 | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/since/1506067374171 | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/since/1506060000000 | jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/versions
{"type":"FeatureCollection","source":"https://data.transformap.co/place/e98fb9126657fd09e8c7e43217067ba0/versions","license":"Public Domain","features":[{"type":"Feature","properties":{"name":"Farmhopping","SSEDAS_PARTNER":"BILS","addr:country":"BG","addr:street":"Крум Попов","addr:housenumber":"56","addr:postcode":"1421","addr:city":"София","POI_TYPE":"farmers market","type_of_initiative":"recycling_foodwaste; other_foodrescue","website":"https://farmhopping.com","contact:email":"info@farmhopping.com","contact:phone":"+359700 20 080","description":"The organisation acts as an interface between the food industry and social welfare organisations to increase access to food aid in Bulgaria. It sets up routines for guaranteeing that donated food is safe and properly managed.","free_keywords":"farmer market;local farmers;fresh food","organic":"yes","fair-trade":"yes","regional":"yes","amenity":"marketplace","opening_hours:url":"http://www.betahaus.bg/en/","description:bg":"farmhopping е спасението на градския човек, който иска да пазарува чиста храна от малки български ферми, произведена с грижа както за неговото здраве, така и за природата.","_timestamp":1485272066095,"_id":"e98fb9126657fd09e8c7e43217067ba0","_uri":"https://data.transformap.co/place/e98fb9126657fd09e8c7e43217067ba0/version/undefined"},"geometry":{"type":"Point","coordinates":[23.3264575,42.6812103]}}]}
+ curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/version/e98fb9126657fd09e8c7e432170685cb
{"type":"Feature","properties":{"name":"Farmhopping","SSEDAS_PARTNER":"BILS","addr:country":"BG","addr:street":"Крум Попов","addr:housenumber":"56","addr:postcode":"1421","addr:city":"София","POI_TYPE":"farmers market","type_of_initiative":"recycling_foodwaste; other_foodrescue","website":"https://farmhopping.com","contact:email":"info@farmhopping.com","contact:phone":"+359700 20 080","description":"The organisation acts as an interface between the food industry and social welfare organisations to increase access to food aid in Bulgaria. It sets up routines for guaranteeing that donated food is safe and properly managed.","free_keywords":"farmer market;local farmers;fresh food","organic":"yes","fair-trade":"yes","regional":"yes","amenity":"marketplace","opening_hours:url":"http://www.betahaus.bg/en/","description:bg":"farmhopping е спасението на градския човек, който иска да пазарува чиста храна от малки български ферми, произведена с грижа както за неговото здраве, така и за природата."},"geometry":{"type":"Point","coordinates":[23.3264575,42.6812103]},"_id":"e98fb9126657fd09e8c7e43217067ba0","_versionId":"e98fb9126657fd09e8c7e432170685cb"}
+ jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/versions
2342
+ curl -w '\n' -s http://localhost:5000/versions/e98fb9126657fd09e8c7e432170685cb
{"type":"Feature","properties":{"name":"Farmhopping","SSEDAS_PARTNER":"BILS","addr:country":"BG","addr:street":"Крум Попов","addr:housenumber":"56","addr:postcode":"1421","addr:city":"София","POI_TYPE":"farmers market","type_of_initiative":"recycling_foodwaste; other_foodrescue","website":"https://farmhopping.com","contact:email":"info@farmhopping.com","contact:phone":"+359700 20 080","description":"The organisation acts as an interface between the food industry and social welfare organisations to increase access to food aid in Bulgaria. It sets up routines for guaranteeing that donated food is safe and properly managed.","free_keywords":"farmer market;local farmers;fresh food","organic":"yes","fair-trade":"yes","regional":"yes","amenity":"marketplace","opening_hours:url":"http://www.betahaus.bg/en/","description:bg":"farmhopping е спасението на градския човек, който иска да пазарува чиста храна от малки български ферми, произведена с грижа както за неговото здраве, така и за природата."},"geometry":{"type":"Point","coordinates":[23.3264575,42.6812103]},"_id":"e98fb9126657fd09e8c7e43217067ba0","_versionId":"e98fb9126657fd09e8c7e432170685cb"}
+ curl -w '\n' -s http://localhost:5000/versions/latest/20
+ jq '.features | length'
20
+ curl -w '\n' -s http://localhost:5000/versions/since/1506067374171
+ jq '.features | length'
4
+ curl -w '\n' -s http://localhost:5000/versions/since/1506060000000
+ jq '.features | length'
7

Before there had been a small glitch due to an unupdated Desgin Document, which can be solved with terminating and restarting the daemon.

λ ./418-test.sh                                                   0 < 20:05:23
+ cat ./418-test.sh
#!/usr/bin/env bash

set -e -x
cat $0

curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/versions
curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/version/e98fb9126657fd09e8c7e432170685cb
curl -w '\n' -s http://localhost:5000/versions | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/e98fb9126657fd09e8c7e432170685cb
curl -w '\n' -s http://localhost:5000/versions/latest/20 | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/since/1506067374171 | jq '.features | length'
curl -w '\n' -s http://localhost:5000/versions/since/1506060000000 | jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/versions
{"status":"missing_named_view"}
+ curl -w '\n' -s http://localhost:5000/place/e98fb9126657fd09e8c7e43217067ba0/version/e98fb9126657fd09e8c7e432170685cb
{"status":"missing_named_view"}
+ curl -w '\n' -s http://localhost:5000/versions
+ jq '.features | length'
2342
+ curl -w '\n' -s http://localhost:5000/versions/e98fb9126657fd09e8c7e432170685cb
{"type":"Feature","properties":{"name":"Farmhopping","SSEDAS_PARTNER":"BILS","addr:country":"BG","addr:street":"Крум Попов","addr:housenumber":"56","addr:postcode":"1421","addr:city":"София","POI_TYPE":"farmers market","type_of_initiative":"recycling_foodwaste; other_foodrescue","website":"https://farmhopping.com","contact:email":"info@farmhopping.com","contact:phone":"+359700 20 080","description":"The organisation acts as an interface between the food industry and social welfare organisations to increase access to food aid in Bulgaria. It sets up routines for guaranteeing that donated food is safe and properly managed.","free_keywords":"farmer market;local farmers;fresh food","organic":"yes","fair-trade":"yes","regional":"yes","amenity":"marketplace","opening_hours:url":"http://www.betahaus.bg/en/","description:bg":"farmhopping е спасението на градския човек, който иска да пазарува чиста храна от малки български ферми, произведена с грижа както за неговото здраве, така и за природата."},"geometry":{"type":"Point","coordinates":[23.3264575,42.6812103]},"_id":"e98fb9126657fd09e8c7e43217067ba0","_versionId":"e98fb9126657fd09e8c7e432170685cb"}
+ jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/versions/latest/20
20
+ jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/versions/since/1506067374171
4
+ jq '.features | length'
+ curl -w '\n' -s http://localhost:5000/versions/since/1506060000000
7

These commits will go live tonight, as I will need them for the Date of Entry story in https://discourse.transformap.co/t/invitation-of-tenders/1435

Thank your for the timely and short notice effort @ponder2342 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants