Hotel-Rate-Radar / README.md
CodeAntidote's picture
Fix Google competitor pricing lookup and starting-rate parsing
d5a9b02 verified
|
Raw History Blame Contribute Delete
7.63 kB

A newer version of the Gradio SDK is available: 6.30.0

Upgrade
metadata
title: Hotel Rate Radar
emoji: 🏨
colorFrom: blue
colorTo: blue
sdk: gradio
sdk_version: 6.5.1
python_version: '3.12'
app_file: app.py
pinned: false

Hotel Rate Radar — data validation update

Preserves the compact blue interface, navy hotel banner, copyright John DM, room ladder and rate movement chart. Recommendations are a model, not verified selling prices.

Install on your existing Space

Upload app.py, verified_rates.py, requirements.txt, README.md and hotel_bed_background.png into the Space root. Retain your existing Secrets; never put keys in uploaded files. SERPAPI_API_KEY is needed for Google Hotels requests. Restart the Space after upload. This ZIP does not deploy anything automatically.

What public prices mean

Shopping is fixed to one night, two adults, no children, USD, advertised 1 Queen rooms and explicitly pre-tax nightly prices. The provider must confirm hotel identity, Santa Cruz location and query parameters. Generic property-level prices are excluded. One lowest accepted offer per seller is averaged arithmetically; the competitor average weights each available hotel equally. Missing competitors are omitted, never treated as zero.

Cancellation terms are not fully verified. These are advertised room comparisons, not guaranteed identical rate plans or booking quotes. Public offers cannot establish remaining inventory. Unavailable does not mean sold out. Exact room current prices and rooms left remain manual inputs; suggested room prices use the existing model.

The source-status accordion reports each hotel, failure and timestamp; CSV exports include source audit JSON. Blank occupancy and pickup add no demand adjustment. Current entered prices are not automatically copied from suggested rates.

Refresh bypasses both the one-hour local cache and SerpApi cache. A selected date can use up to 10 requests; the explicitly enabled 30-day mode can use up to 300 and be slow. Normal cached responses retain original timestamps. Booking.com, Expedia, Super.com and official offers appear only when Google returns accepted seller/room details. No independent scraper or automatic source fallback is claimed.

For initial verification, use one future date, open Source status, then compare its linked seller offers using the same stay and tax basis. Run python test_accuracy.py for the offline regression checks. Live paid-provider results have not been tested with your secret in this environment.

See DATA_ACCURACY_REVIEW.md for research and limitations.

Last known prices

When refresh fails, Source status shows the last successfully validated seller average for that exact hotel, check-in, room category, stay length, guests, currency and tax basis. Original observation timestamps are preserved. No saved observation displays “— · No saved price for this stay”. Historical prices are display-only and do not enter current averages or automatic recommendations.

Public price summaries are saved in rate_history.sqlite3. They survive Python restarts on the same disk, but an ephemeral Space rebuild may erase them. For durable history, configure RATE_HISTORY_PATH to a writable file on an existing persistent volume. No historical prices are bundled in this ZIP; history begins with successful lookups after installation. Keep the existing valid SERPAPI_API_KEY Secret.

Professional dashboard update

  • Compact navy header, ice-blue surfaces, responsive cards and clear keyboard focus.
  • Useful initial state without fabricated example prices.
  • Five hotel snapshot cards distinguish observed quotes, historical quotes and no saved quote; timestamps stay visible.
  • Historic fallback remains display-only. Pricing controls, room recommendations and market sources remain separate.
  • Advanced settings are collapsed initially; the main input panel stays compact.
  • Manual and timer analyses share one concurrency queue. Past live-shopping dates and nonpositive rate limits are rejected before provider calls.
  • PREVIEW.html is a static visual preview of the real dashboard cards and room table. It is not an interactive application or a live rate feed.

Keep the existing valid API Secrets. Upload the application files and restart your existing Space; deployment is not performed by this ZIP. Offline regression tests and Gradio import checks pass. Live prices still require validation with your configured provider account.

Changing pricing inputs clears previous results before a new analysis. Browser screenshot verification could not be completed in the build environment because the browser download timed out. The preview is static; runtime Gradio rendering should be checked in the Space before publishing further changes.

Hourly pricing update

Hourly refresh and fresh provider requests default ON; the initial view uses Live now in Santa Cruz. Leave the page open and Space awake. This is not an unattended background scheduler. Each refresh may use up to 10 searches for one date or 300 for an explicitly enabled 30-day scenario; it never writes to ASI.

Starting policy (operator-adjustable): 2% reduction per elapsed hour after 6 PM, capped at 10%. Set the hourly reduction slider to zero to disable. Closing-time discounts combine with this up to 20%. After 6 PM, high traffic disables its positive demand uplift; room types with known remaining inventory at or below 25% receive −3% instead of the scarcity premium. Zero available rooms get no suggested price. Unknown inventory does not trigger this rule. These are configured business assumptions, not statistically learned effects. Other market signals may still change the final recommendation.

Room spacing now interpolates the supplied ASI reference profiles at $85, $199 and $269 base rates; these reference profiles are not assigned permanently to dates or weekdays. Default maximum increases to $599 to permit the screenshot's $409 room. All room recommendations respect the operator's minimum and maximum. Original public quotes remain unchanged. Last known quotes stay labeled historical.

Usable reference fallback

Zero/negative current manual rates are treated as missing. When live and manual market rates are absent, the model uses the 1 Queen rate transcribed from the supplied ASI screenshots for September 20–October 3, 2026. Outside that range it uses the screenshot's $85 weekday baseline, explicitly labeled an estimate for the selected date. This is not a live rate, last-known provider observation or competitor quote. Date-matched screenshot references are $199 on September 25 and October 2, $269 on September 26, $229 on October 3, and $85 on the remaining dates in that interval. Operator rules may adjust recommendations from these amounts. The dashboard displays reference provenance; absent competitor quotes remain blank rather than invented.

Google starting-price fix (latest behavior)

This update supersedes the earlier strict 1 Queen shopping description. Google listing-level seller prices and hotel starting rates are now accepted for the verified property and stay, without requiring a named room. An aggregate is used only when seller prices are absent; it is never an extra seller in the average. Date, guest, currency and location checks remain. Unknown-tax prices appear on hotel cards and in source audit, but do not enter pre-tax model averages. Room types and refund terms may differ. Listing prices avoid an unnecessary property-detail request. SERPAPI_API_KEY must be valid with available quota; no live API success is claimed without testing your Space credentials.

Documentation: https://serpapi.com/google-hotels-api