Add data generation scripts and public holidays service

- Add scripts for generating booking data, building metadata, and
  updating holidays
- Implement public_holidays.py service with holiday lookup functionality
- Update CSV data with expanded hotel booking records
- Add holidays.json dataset for public holiday dates
- Enhance LLM report service with improved formatting
- Update metadata domain model and API dependencies
- Add test coverage for dataset and public holidays
This commit is contained in:
2026-09-21 14:13:39 +08:00
parent 225d28feb7
commit 769c777b48
19 changed files with 50164 additions and 40297 deletions
+12 -4
View File
@@ -30,11 +30,12 @@ requires a class to generate field validation, JSON (de)serialization, and
the OpenAPI schema FastAPI exposes at `/docs`. Each class is a **data
contract**, not behavior - no methods, just typed fields.
### `src/nf_hotel_api/domain/metadata.py` - classes: `RoomType`, `HotelMetadata`
### `src/nf_hotel_api/domain/metadata.py` - classes: `RoomType`, `Address`, `NearbyEvent`, `HotelMetadata`
Pydantic models for the reference data in `data/hotel_metadata.json`: per room
type its size, standard price per night and (optional) number of rooms.
`HotelMetadata.describe()` renders the catalogue as text for the LLM prompt.
Pydantic models for the reference data in `data/hotel_metadata.json`: address,
per room type its size, standard price per night and number of rooms, plus the
nearby Phnom Penh events (date ranges are validated). Public holidays are not
stored; see `services/public_holidays.py`. `HotelMetadata.describe()` renders it all as text for the LLM prompt.
## Core (config & security)
@@ -85,6 +86,13 @@ standard price, and derives `room_size` and `revenue`. The class keeps these ste
testable (see `tests/test_cleaning.py`), and lets the whole pipeline be
swapped out in `ReportService`.
### `src/nf_hotel_api/services/public_holidays.py` - class `PublicHolidayCalendar`
Thin wrapper over the `holidays` package (country `KH`): returns holidays per
year, looks up a single day, merges consecutive days into `HolidayPeriod`s and
renders them as text for the LLM prompt. `data/holidays.json` is an export of
the periods, regenerated by `scripts/update_holidays.py`.
### `src/nf_hotel_api/services/statistics.py` - class `DescriptiveStatsService`
A single-purpose class computing and JSON-serializing `df.describe()`. It