Code Monkey home page Code Monkey logo

Comments (11)

juftin avatar juftin commented on July 28, 2024 1

Hey @stjohnjohnson apologies for the late reply here, I'm just getting back into things after a camping trip actually. I've been digging into this more and here's what I've found:

  • The existing endpoint camply uses to search for campsite availabilities is https://www.recreation.gov/api/camps/availability/campground/<campground_id>/month?start_date=<start_date>

    • Here's an example
    • This endpoint only accepts a single Query String Parameter, start_date, and fails when you give it more than one param. The data returned also doesn't tell us anything about what equipment is allowed at each individual spot - so we can't leverage this particular endpoint for our purpose unfortunately.
  • The place where we do get information about what equipment is allowed is when we retrieve metadata for the campsites themselves.

So here's my idea: when camply validates the underlying campgrounds it's going to be searching through it will also make an additional call to retrieve information about all of the related Equipment / Attributes of the underlying campsites it searches. Subsequently, when it finds available campsites within those campgrounds, it will look up that metadata and join it on the Campsite object. Once that data is included on the campsite object it will be relatively simple to filter on it during the search process.

I have code I've been experimenting with, I will open up a branch and share that shortly. Hopefully we'll have a solution to this very soon.

from camply.

juftin avatar juftin commented on July 28, 2024

Okay, following up. I've been working on it over here and I'm close: #88

The trickiest part has been modifying how the underlying Data Containers handle hashing when some of their properties are lists (like attributes permitted equipment). Now that that is out of the way the last bits of work are in the details of the Implementation.

Here are some remaining questions:

  • How should we standardize on equipment names. Here are the various names I've found so far after scaning ~3000 campsites:
    • 'Tent', 'RV', 'Trailer', 'Pickup Camper', 'Pop up', 'Vehicle',
      'Large Tent Over 9X12`', 'Small Tent', 'Caravan/Camper Van', 'Car',
      'Hammock', 'RV/Motorhome', 'Fifth Wheel', 'Horse', nan, 'Boat'
    • I'm thinking that we want to include a few generic categories like Tent, RV, Trailer and roll these up into one of those

What should the user interface look like? Will someone only specify that they have a trailer/tent/RV or should they also specify the maximum length?

from camply.

stjohnjohnson avatar stjohnjohnson commented on July 28, 2024

Awesome! I would use the standard filters that Recreation.gov has: vehicle length, site type, amenities, allowable equipment, and electrical hookup 2430CD40-5795-40C6-BDD8-93DC3DA52AF4
F56B6E51-F046-46E6-80DB-5FF57E3A2D3E
D7952381-10ED-4A91-A648-5CA63C0DE425

from camply.

juftin avatar juftin commented on July 28, 2024

Okay @stjohnjohnson I've made a ton of progress on this and just pushed the latest feature, the --equipment flag. Read more about it here: https://juftin.com/camply/README.html#searching-for-a-campsite-that-fits-your-equipment

As part of this I've surfaced two new attributes on the AvailableCampsite object, campsite_attributes and permitted_equipment which will be useful for expanding the filtering potential of campsites.

Check out some of the data here:

❯ export LOG_LEVEL=debug
❯ camply campsites \
    --campground 232338 \
    --start-date 2022-09-09 \
    --end-date 2022-09-17 \
    --nights 3 \
    --equipment RV 75 \
    --continuous \
    --notifications silent
[2022-06-30 15:27:37] CAMPLY   camply, the campsite finder ⛺️
[2022-06-30 15:27:37] INFO     8 booking nights selected for search, ranging from 2022-09-09 to 2022-09-16
[2022-06-30 15:27:37] INFO     Searching for availabilities with 3 consecutive night stays.
[2022-06-30 15:27:37] DEBUG    Starting new HTTPS connection (1): ridb.recreation.gov:443
[2022-06-30 15:27:39] DEBUG    https://ridb.recreation.gov:443 "GET /api/v1/facilities/232338?full=True HTTP/1.1" 200 None
[2022-06-30 15:27:39] INFO     1 Matching Campgrounds Found
[2022-06-30 15:27:39] INFO     ⛰  Rio Grande National Forest, CO (#2018) - 🏕  Thirty Mile (#232338)
[2022-06-30 15:27:39] INFO     Filtering Campsites based on Equipment: RV
[2022-06-30 15:27:39] INFO     Searching for campsites every 10 minutes.
[2022-06-30 15:27:39] INFO     Notifications active via: <SilentNotifications>
[2022-06-30 15:27:39] INFO     Only <SilentNotifications> enabled. I hope you're watching these logs.
[2022-06-30 15:27:39] INFO     Searching across 1 campgrounds
[2022-06-30 15:27:39] DEBUG    Starting new HTTPS connection (1): www.recreation.gov:443
[2022-06-30 15:27:39] DEBUG    https://www.recreation.gov:443 "GET /api/search/campsites?start=0&size=1000&fq=asset_id%3A232338&include_non_site_specific_campsites=True HTTP/1.1" 200 None
[2022-06-30 15:27:39] INFO     Metadata fetched for 35 campsites
[2022-06-30 15:27:39] INFO     Searching Thirty Mile, Rio Grande National Forest, CO (232338) for availability: September, 2022
[2022-06-30 15:27:39] DEBUG    Starting new HTTPS connection (1): www.recreation.gov:443
[2022-06-30 15:27:39] DEBUG    https://www.recreation.gov:443 "GET /api/camps/availability/campground/232338/month?start_date=2022-09-01T00%3A00%3A00.000Z HTTP/1.1" 200 None
[2022-06-30 15:27:39] INFO             ⛺️      175 total sites found in month of September
[2022-06-30 15:27:39] INFO     ⛺️ ⛺️ ⛺️ ⛺️ 1 Reservable Campsites Matching Search Preferences
[2022-06-30 15:27:39] INFO     📅 Fri, September 09 🏕  1 sites
[2022-06-30 15:27:39] INFO             ⛰️  Rio Grande National Forest, CO  🏕  Thirty Mile: ⛺ 1 sites
[2022-06-30 15:27:39] INFO                     🔗 https://www.recreation.gov/camping/campsites/38346 (3 nights)
[2022-06-30 15:27:39] INFO     1 New Campsites Found.
[2022-06-30 15:27:39] DEBUG    SilentNotification:
                                       • 2022-09-09 - 2022-09-12
                                       • STANDARD NONELECTRIC
                                       • 012
                                       • Rio Grande National Forest, CO
                                       • Thirty Mile
                                       • https://www.recreation.gov/camping/campsites/38346
[2022-06-30 15:27:39] DEBUG    Campsite Info: {'availability_status': 'Available',
                                'booking_date': Timestamp('2022-09-09 00:00:00'),
                                'booking_end_date': Timestamp('2022-09-12 00:00:00'),
                                'booking_nights': 3,
                                'booking_url': 'https://www.recreation.gov/camping/campsites/38346',
                                'campsite_attributes': [{'attribute_category': 'site_details',
                                                         'attribute_id': 56,
                                                         'attribute_name': 'Min Num of People',
                                                         'attribute_value': '1'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 0,
                                                         'attribute_name': 'Campfire Allowed',
                                                         'attribute_value': 'Yes'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 12,
                                                         'attribute_name': 'Checkout Time',
                                                         'attribute_value': '12:00 PM'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 77,
                                                         'attribute_name': 'Shade',
                                                         'attribute_value': 'Yes'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 52,
                                                         'attribute_name': 'Max Num of People',
                                                         'attribute_value': '16'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 10,
                                                         'attribute_name': 'Capacity/Size Rating',
                                                         'attribute_value': 'Double'},
                                                        {'attribute_category': 'site_details',
                                                         'attribute_id': 11,
                                                         'attribute_name': 'Checkin Time',
                                                         'attribute_value': '2:00 PM'},
                                                        {'attribute_category': 'equipment_details',
                                                         'attribute_id': 23,
                                                         'attribute_name': 'Driveway Entry',
                                                         'attribute_value': 'Pull-Through'},
                                                        {'attribute_category': 'equipment_details',
                                                         'attribute_id': 54,
                                                         'attribute_name': 'Max Vehicle Length',
                                                         'attribute_value': '80'},
                                                        {'attribute_category': 'equipment_details',
                                                         'attribute_id': 0,
                                                         'attribute_name': 'Is Equipment Mandatory',
                                                         'attribute_value': 'false'},
                                                        {'attribute_category': 'equipment_details',
                                                         'attribute_id': 53,
                                                         'attribute_name': 'Max Num of Vehicles',
                                                         'attribute_value': '2'},
                                                        {'attribute_category': 'equipment_details',
                                                         'attribute_id': 26,
                                                         'attribute_name': 'Driveway Surface',
                                                         'attribute_value': 'Gravel'},
                                                        {'attribute_category': 'amenities',
                                                         'attribute_id': 301,
                                                         'attribute_name': 'Map Y Coordinate',
                                                         'attribute_value': '725.36'},
                                                        {'attribute_category': 'amenities',
                                                         'attribute_id': 300,
                                                         'attribute_name': 'Map X Coordinate',
                                                         'attribute_value': '576.64'},
                                                        {'attribute_category': 'amenities',
                                                         'attribute_id': 314,
                                                         'attribute_name': 'Placed on Map',
                                                         'attribute_value': '1'}],
                                'campsite_id': 38346,
                                'campsite_loop_name': 'THIR',
                                'campsite_occupancy': (1, 16),
                                'campsite_site_name': '012',
                                'campsite_type': 'STANDARD NONELECTRIC',
                                'campsite_use_type': 'Overnight',
                                'facility_id': 232338,
                                'facility_name': 'Thirty Mile',
                                'permitted_equipment': [{'equipment_name': 'Tent', 'max_length': 80.0},
                                                        {'equipment_name': 'RV', 'max_length': 80.0},
                                                        {'equipment_name': 'Trailer', 'max_length': 80.0}],
                                'recreation_area': 'Rio Grande National Forest, CO',
                                'recreation_area_id': 2018}
[2022-06-30 15:27:39] CAMPLY   Exiting camply 👋

from camply.

juftin avatar juftin commented on July 28, 2024

@stjohnjohnson one more follow up. Will you test the Telegram notifications for me on camply 0.4.2? I tried to standardize notifications but haven't been able to test that Telegram notifications still look the same.

from camply.

ArtixZ avatar ArtixZ commented on July 28, 2024

A related question here: how can I filter by site type as shown in the screenshot above? e.g. Tent Only / Boat in / Hike to

from camply.

juftin avatar juftin commented on July 28, 2024

Hey @ArtixZ those properties are campsite_attributes properties on the AvailableCampsite objects - right now I only support filtering on the permitted_equipment properties using the --equipment option: https://juftin.com/camply/README.html#searching-for-a-campsite-that-fits-your-equipment

Filtering on attributes is coming as soon as I get some time to code it up

from camply.

ArtixZ avatar ArtixZ commented on July 28, 2024

@juftin Thanks a lot working on this! This project is really a high quality stuff. I'm an outdoor hiking/backpacking lover, and a SDE. If I can contribute anything on this, do let me know.

from camply.

rexxars avatar rexxars commented on July 28, 2024

@juftin Is there a way to filter on campsite type? Or an arbitrary filter string that includes/exclude on campsite name? I'm getting a lot of "boat in only" results ('campsite_type': 'BOAT IN') that would be amazing to exclude.

from camply.

juftin avatar juftin commented on July 28, 2024

Not yet, I'll find a way to eventually incorporate that into the campsite filtering feature.

from camply.

rtmlp avatar rtmlp commented on July 28, 2024

Hi. Thanks for creating this awesome repository. I am interested in the campsite_attributes feature as well. Let me know if you need any help in implementation or testing?

from camply.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.