Ironhack-Data-Madrid-Octubre-2021 / W4-geospatial-data-project

0 stars 5 forks source link

[W4-geospatial-data-project] Luis Serrano Cerame #12

Closed LuisSerranoCerame closed 2 years ago

LuisSerranoCerame commented 2 years ago

https://github.com/LuisSerranoCerame/GeoProject

yamadajc commented 2 years ago

Muy buenas Luis , como siempre digo voy a intentar darte todo el feedback con la intención de que realices un cambio positivo, para que mejores todo lo posible.

Pero antes de nada tu print infinito 😜

{ "html_attributions" : [], "results" : [ { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.087491, "lng" : -118.381002 }, "viewport" : { "northeast" : { "lat" : 34.08878757989272, "lng" : -118.3796275201073 }, "southwest" : { "lat" : 34.08608792010727, "lng" : -118.3823271798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "VCA Los Angeles Veterinary Specialists", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 933, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/102858483740347847338\"\u003eVCA Los Angeles Veterinary Specialists\u003c/a\u003e" ], "photo_reference" : "Aap_uECjIapsh0ibTqzucj5-uF6JhTYu45CJz4KcQKn7QQcGhcnkAE4M4DxH6Hgbb2oSVhjvWVE4JAnTM4pD0u6cX-zS6JfGpl4Z1ms1orgwU9125-7SIWtubsTUIY1yTzewtzRIBOA-lSzzLdPSvA6XpzhL2y8JWEt2ymGvIEjjF8Hr2tg8", "width" : 700 } ], "place_id" : "ChIJI_nc1rq-woARAuKvfkmozg0", "plus_code" : { "compound_code" : "3JP9+XH West Hollywood, California, USA", "global_code" : "85633JP9+XH" }, "rating" : 4.4, "reference" : "ChIJI_nc1rq-woARAuKvfkmozg0", "scope" : "GOOGLE", "types" : [ "veterinary_care", "health", "point_of_interest", "establishment" ], "user_ratings_total" : 25, "vicinity" : "8723 Santa Monica Blvd, West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0906767, "lng" : -118.3639609 }, "viewport" : { "northeast" : { "lat" : 34.09205342989272, "lng" : -118.3625442201073 }, "southwest" : { "lat" : 34.08935377010727, "lng" : -118.3652438798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Laurel Pet Hospital", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 3265, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/110854164034814697389\"\u003eAaron Johnson\u003c/a\u003e" ], "photo_reference" : "Aap_uEBs7nEB0rFkeJsSj74Qfa8GTdjamnoB9ca4v3bIjFqKjYr35kOuMnjO6Z6xOMcxQVyfXIBc-UTF6muLb8jHP0tHor_IomWYKR_vwcXqic0oOxqd9Hc3bwtjkOXxa8Vc3fN46VHO5FIioJ2-2LuLQhn8G599RcVJGwuy_oq5kX-Murgj", "width" : 4898 } ], "place_id" : "ChIJZ_pBdMa-woARJjlbErWYmKM", "plus_code" : { "compound_code" : "3JRP+7C West Hollywood, California, USA", "global_code" : "85633JRP+7C" }, "rating" : 4.4, "reference" : "ChIJZ_pBdMa-woARJjlbErWYmKM", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 379, "vicinity" : "7970 Santa Monica Blvd, West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0758119, "lng" : -118.3666205 }, "viewport" : { "northeast" : { "lat" : 34.07730047989272, "lng" : -118.3652745701073 }, "southwest" : { "lat" : 34.07460082010728, "lng" : -118.3679742298928 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Modern Animal", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 3588, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/117003498813143836440\"\u003eA Google User\u003c/a\u003e" ], "photo_reference" : "Aap_uEB070mmuEDne6R_eu-yCHSDUMYxTtiGITmhuAlw9FrA2Xjo4zDjusJratst6kx6h_i_IwxjBEMAZRnPTWtrXWI864PlQU3R8ZWPt9KUBqPu3IWwlfQWIM7-JprnlmRwrjRW6N5PRhTg0EYRBkLwLaw_i6BPRjD7WAwnSuPs6_b1k6h0", "width" : 5382 } ], "place_id" : "ChIJv6Lv7nW5woAREAO1vWjtYE8", "plus_code" : { "compound_code" : "3JGM+89 Los Angeles, California, USA", "global_code" : "85633JGM+89" }, "rating" : 5, "reference" : "ChIJv6Lv7nW5woAREAO1vWjtYE8", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 113, "vicinity" : "8122 Beverly Blvd, Los Angeles" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0825249, "lng" : -118.3869839 }, "viewport" : { "northeast" : { "lat" : 34.08394612989272, "lng" : -118.3856275201073 }, "southwest" : { "lat" : 34.08124647010728, "lng" : -118.3883271798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "West Hollywood Animal Hospital", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 2988, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/111416246863942432406\"\u003eKim Steadman\u003c/a\u003e" ], "photo_reference" : "Aap_uEBNK8vOYdtzMjJnkIkfKrKJ6DcCzzMbJn4QBaDqoSjvKE1Pi1jwnPaFxTdkhzNcUYHdSK9fSt9DE6mVRL2SC0mbuZS_WqUm2us-T23bT9473JgwFEiUSOXlrB8bb1oXE_rZ0HhZUcOTvPqM6Z4g3WQmwRr28-MmplKS_yjTjDnjh46J", "width" : 5312 } ], "place_id" : "ChIJTy7rUq--woARVdNaN_fLqGk", "plus_code" : { "compound_code" : "3JM7+26 West Hollywood, California, USA", "global_code" : "85633JM7+26" }, "rating" : 4.3, "reference" : "ChIJTy7rUq--woARVdNaN_fLqGk", "scope" : "GOOGLE", "types" : [ "veterinary_care", "park", "point_of_interest", "establishment" ], "user_ratings_total" : 91, "vicinity" : "9000 N Santa Monica Blvd, West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.087472, "lng" : -118.381025 }, "viewport" : { "northeast" : { "lat" : 34.08877842989272, "lng" : -118.3796358201072 }, "southwest" : { "lat" : 34.08607877010728, "lng" : -118.3823354798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "VCA TLC Animal Hospital", "opening_hours" : { "open_now" : true }, "photos" : [ { "height" : 3024, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/117475805565749811792\"\u003eA Google User\u003c/a\u003e" ], "photo_reference" : "Aap_uEAHQGcB5Z0_RctVcsdHWphQd7J6hxRMd-pSTkDIZfvaTzAMYbglGgWfbEnRarHQXKhImA4r6zFVa4E_kmcv39eguzwPjcAXz6Lm8wbDOdXLbnX940zVAZvqszYoCkqqgwnnBx7egwbUhggQcXGUySY06n1wOESx-3qDTG4P3W5T_RWv", "width" : 4032 } ], "place_id" : "ChIJI_nc1rq-woARbir8f9TC-qo", "plus_code" : { "compound_code" : "3JP9+XH West Hollywood, California, USA", "global_code" : "85633JP9+XH" }, "rating" : 2.9, "reference" : "ChIJI_nc1rq-woARbir8f9TC-qo", "scope" : "GOOGLE", "types" : [ "veterinary_care", "health", "point_of_interest", "establishment" ], "user_ratings_total" : 82, "vicinity" : "8725 Santa Monica Blvd, West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.081096, "lng" : -118.385869 }, "viewport" : { "northeast" : { "lat" : 34.08236702989272, "lng" : -118.3844473701073 }, "southwest" : { "lat" : 34.07966737010727, "lng" : -118.3871470298927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "VCA Miller-Robertson Animal Hospital", "opening_hours" : { "open_now" : true }, "photos" : [ { "height" : 3326, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/106110977744141742361\"\u003eVCA Miller-Robertson Animal Hospital\u003c/a\u003e" ], "photo_reference" : "Aap_uEAbwpjf49Mo1ndtHHAVXB6EpkSqf72abNQL2diP-h8atdm1qQhqmbzoLYoaKZLzCxv5J8Jpg5p-j4PvgfLFsHES-EbVw-p_kFcDHPtcH6HC0gy-mPR739RbZgV7Vb9RONyKooVST-5LNF-5RGKHfmeoxxI-ATnUQo8CdKZqVpjueheH", "width" : 5184 } ], "place_id" : "ChIJG8Ou366-woAR0GDZX5cbDEM", "plus_code" : { "compound_code" : "3JJ7+CM Los Angeles, California, USA", "global_code" : "85633JJ7+CM" }, "rating" : 4.3, "reference" : "ChIJG8Ou366-woAR0GDZX5cbDEM", "scope" : "GOOGLE", "types" : [ "veterinary_care", "health", "point_of_interest", "establishment" ], "user_ratings_total" : 61, "vicinity" : "8807 Melrose Ave, Los Angeles" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.08345, "lng" : -118.370683 }, "viewport" : { "northeast" : { "lat" : 34.08478952989272, "lng" : -118.3692320201073 }, "southwest" : { "lat" : 34.08208987010727, "lng" : -118.3719316798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "The Melrose Vet", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 900, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/100498816474829522792\"\u003eA Google User\u003c/a\u003e" ], "photo_reference" : "Aap_uEC-lEew4dEo6H6r9jo8TlpL38KbouZEEMUQC_XsXRXhvpoZ6qxP_eEWmqwDFC-MbTrbbUXdw8tLVD902toXWHEdb4RtZnLo8nt8tTgOzQSnR_geRkTN-rhMcaT8_9N4WiLfDQotsoPfx4AuYqYA8LUrkGQS5mEc9jsgiNLFNDxkaRiD", "width" : 1600 } ], "place_id" : "ChIJQxbmXmW_woAR_Lpwaz1UgMw", "plus_code" : { "compound_code" : "3JMH+9P Los Angeles, California, USA", "global_code" : "85633JMH+9P" }, "rating" : 4.6, "reference" : "ChIJQxbmXmW_woAR_Lpwaz1UgMw", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 48, "vicinity" : "8304 Melrose Ave, Los Angeles" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0900091, "lng" : -118.3617443 }, "viewport" : { "northeast" : { "lat" : 34.09135927989272, "lng" : -118.3603036701073 }, "southwest" : { "lat" : 34.08865962010728, "lng" : -118.3630033298928 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Fox Companion Care", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 2028, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/100177863409882034611\"\u003eCharis Fifield\u003c/a\u003e" ], "photo_reference" : "Aap_uEBkKyYLgzabyQmCD7TdUhFMezVnWccCqV9rI6Z5ret_qOg_iuSmvhqVRiGiQCv4sbrxZ29AQLL2TpDfxFhMYtfd3cWc8OQ-tNTL64LDnR0MR5G_ZpIWUnCnsi6Gg4YRiztA1Xl6Wl-DGhQj5dUh-H-zAgXRX36es2lIjbLDOpvbKqEQ", "width" : 2028 } ], "place_id" : "ChIJdzzajsW-woAR008tffQY2Uk", "rating" : 5, "reference" : "ChIJdzzajsW-woAR008tffQY2Uk", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 19, "vicinity" : "West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0752234, "lng" : -118.3963964 }, "viewport" : { "northeast" : { "lat" : 34.07658277989272, "lng" : -118.3949044201073 }, "southwest" : { "lat" : 34.07388312010728, "lng" : -118.3976040798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Beverly Hills Small Animal Hospital - John Winters DVM", "opening_hours" : { "open_now" : true }, "place_id" : "ChIJUSKgwjm9woAR2S1OjvoIbQE", "plus_code" : { "compound_code" : "3JG3+3C Beverly Hills, California, USA", "global_code" : "85633JG3+3C" }, "rating" : 4.2, "reference" : "ChIJUSKgwjm9woAR2S1OjvoIbQE", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 19, "vicinity" : "353 Foothill Rd, Beverly Hills" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.075126, "lng" : -118.396385 }, "viewport" : { "northeast" : { "lat" : 34.07636087989273, "lng" : -118.3950159201073 }, "southwest" : { "lat" : 34.07366122010728, "lng" : -118.3977155798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Dr Shipp's Animal Hospital", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 960, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/114980427582166340204\"\u003eA Google User\u003c/a\u003e" ], "photo_reference" : "Aap_uEBOKHiDkzXi7MY_43fOadgdHb0VcQgYNJC3aEZFH2rDZrN8Px1FpYI1kGhFfMVdkYsTPt0MrvhuwwKYIoIfxG5G8eefjC59VePuwP4MnUxG4AJwkdF5RjAMiyNnXanR1rp43omhT0pJTl773Q1QuTaU2T6QQw06Cb0RLDtmRDrufvIY", "width" : 770 } ], "place_id" : "ChIJY5eMcAG8woARKecXU8Nbqa0", "plus_code" : { "compound_code" : "3JG3+3C Beverly Hills, California, USA", "global_code" : "85633JG3+3C" }, "rating" : 4.4, "reference" : "ChIJY5eMcAG8woARKecXU8Nbqa0", "scope" : "GOOGLE", "types" : [ "lodging", "veterinary_care", "health", "point_of_interest", "establishment" ], "user_ratings_total" : 35, "vicinity" : "351 Foothill Rd, Beverly Hills" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0905796, "lng" : -118.3639835 }, "viewport" : { "northeast" : { "lat" : 34.09198342989271, "lng" : -118.3625552701073 }, "southwest" : { "lat" : 34.08928377010727, "lng" : -118.3652549298927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Hu Gloria DVM", "opening_hours" : { "open_now" : false }, "place_id" : "ChIJNWsqdMa-woARCdhFhnZaVqc", "plus_code" : { "compound_code" : "3JRP+6C West Hollywood, California, USA", "global_code" : "85633JRP+6C" }, "rating" : 0, "reference" : "ChIJNWsqdMa-woARCdhFhnZaVqc", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 0, "vicinity" : "7970 Santa Monica Blvd, West Hollywood" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : 34.0752234, "lng" : -118.3963964 }, "viewport" : { "northeast" : { "lat" : 34.07660837989273, "lng" : -118.3949045201073 }, "southwest" : { "lat" : 34.07390872010728, "lng" : -118.3976041798927 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png", "icon_background_color" : "#7B9EB0", "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet", "name" : "Beverly Hills Animal Hospital", "opening_hours" : { "open_now" : true }, "photos" : [ { "height" : 2340, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/105582406605306350805\"\u003eLuna Quest\u003c/a\u003e" ], "photo_reference" : "Aap_uEAYafkcY7dAxSK-lUu2HleGNpna7eK9wRksvT57x4C8iALjZzIHfpnZGH7q2A5-8xkJRkbzrOMlOrhZ5rbucegwKcji1OUJV_bo0m7YFGj3Lgmhtsw2Z2AoZz1nZc3djlDMlgzGIQYc5bSLq8xsrryJwRAqENUs-PMaFkClKdvhS-Of", "width" : 4160 } ], "place_id" : "ChIJwQwqfwG8woARKAzJc7L1cv0", "plus_code" : { "compound_code" : "3JG3+3C Beverly Hills, California, USA", "global_code" : "85633JG3+3C" }, "rating" : 4.6, "reference" : "ChIJwQwqfwG8woARKAzJc7L1cv0", "scope" : "GOOGLE", "types" : [ "veterinary_care", "point_of_interest", "establishment" ], "user_ratings_total" : 100, "vicinity" : "353 Foothill Rd, Beverly Hills" } ], "status" : "OK" }

Ahora si que si ...¡Vamos a ello!

README

Te digo exactamente lo mismo que la ultima vez.

El readme esta como el anterior. Me dices que vas a hacer, como la vas a hacer, nombras la tecnología que vas a utilizar. Pero en esta ocasión no me mencionas nada sobre la API ni la base de datos.

Recuerda que si a alguien le interesa el tema y de repente aterriza a tu git quizás quiera reproducir tu proyecto y aprender de el.

¿Como podías mejorarlo?

Estructura del repo

En este proyecto se deberían de haber suficientes archivos como para crear 2 o 3 directorios. Por lo que se me queda un poco escaso a la vista el ver solo un jupyter y el readme. Pero en general te digo lo mismo que la ultima vez.

Sintaxis de código

Importas muchísimas librerías que al final no usas. Revíselas y elimina las que no utilices. Y recuerda, si importas una librería no es necesario que la vuelvas a importar mas tarde.

Veo que en el punto Exact location from our three options me has hardcodeado las latitude y longitudes en vez de extraerlas. En el caso en el que tuviese muchas localizaciones invertirías demasiado tiempo en poner una a una las coordenadas.

Cuando haces esto esta genial pero debes ser capaz de saber acceder a los elementos de una lista de diccionarios.

    list(c.find({"$and": [cond1,cond2,cond3,cond4,cond5]},proy))

Repites mucho código. Por ejemplo, en cada uno de los apartados Location me repites exactamente los mismos pasos incluyendo los imports. Estoy seguro que podrías crear alguna función para este proceso y el resto.

# Clubs near company a
import requests
url = f"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={lata},{longa}&radius={party}&keyword={club}&key={clave}"
payload={}
headers = {}
response1 = requests.request("GET", url, headers=headers, data=payload)
print(response11.text)

Feed back

Me ha encantado la gráfica con la comparativa de las distintas localizaciones. Pero lo suyo es que me selecciones la localización en función de datos que tengan que ver con la distancia y no con la cantidad de oferta al rededor de la oficina.

Tienes unos prints infinitos que me han dificultado la tarea de revision. Por lo que he tenido que clonarme tu repo para ver el trabajo que has hecho. Si los quitas y atomizas cada una de las partes del código creo que podrías tener un buen proyecto para enseña.

Ademas me has ploteado mapas, lo cual me encanta.

Otra cosita... Has utilizado near y eso es canela pero en mongo tenemos un método que aun mejor. GeoNear nos calcula la distancia entre cada uno de nuestros puntos de nuestra BBDD y nuestras ciudades. Echale un ojo a esto

SEGUIMOS!!!🚀