OOP business-rules engine for vehicle service bookings: cancellation policy, dynamic labor pricing, and bay-overbooking resolution.
Project description
vehicle-service-engine-nci
A small, dependency-free, object-oriented Python library implementing the business-rule logic for a vehicle service booking platform. Built for a cloud computing coursework project (NCI) and used inside AWS Lambda handlers, but has no AWS dependency itself, so it is fully unit-testable in isolation and reusable elsewhere.
What it does
cancellation_policy— Strategy pattern.FlexiblePolicy,StandardPolicy, andNoShowStrictPolicyeach compute a deposit refund percentage based on how many hours before the appointment a customer cancels.get_policy()is a small factory that resolves a policy name (e.g. from a database record) to an instance.labor_pricing— Strategy pattern.OccupancyBasedPricingraises price as service bays fill up;LastMinuteDiscountPricingdiscounts slots that are still empty close to the appointment date;BlendedPricingcombines both.LaborPricingEngineis the façade callers use, with the strategy swappable at construction time.bay_allocation_resolver— Resolves overbooking: given a list of competing appointments and the number of bays actually available, decides which appointments keep their slot (highest customer tier first, then earliest booking time) and suggests compensation for the rest.
Install
pip install vehicle-service-engine-nci
Quick example
from vehicle_service_engine import LaborPricingEngine, BlendedPricing, get_policy
# Dynamic labor pricing
engine = LaborPricingEngine(BlendedPricing())
price = engine.price_for(
base_rate=119.80,
bay_occupancy_pct=0.8,
days_until_appointment=1,
is_peak_day=True,
)
# Cancellation refund calculation
policy = get_policy("STANDARD")
refund = policy.compute_refund(
deposit_amount=50.0,
appointment_time=some_datetime,
)
Why a separate library
Both the appointment-booking Lambda and (potentially) an admin/rescheduling tool need the same pricing and allocation rules. Keeping this logic in one importable, AWS-agnostic package means it is unit tested once, versioned independently of the Lambda deployment packages, and can be reused outside the serverless backend if needed.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vehicle_service_engine_nci-1.0.0.tar.gz.
File metadata
- Download URL: vehicle_service_engine_nci-1.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8056e5161a1943a2c7d30e660ee224ff46d59dbfb28ba4c1783428286d2bb15b
|
|
| MD5 |
5d120bbb27e36e558fa61544aeb7e0b2
|
|
| BLAKE2b-256 |
16e9fa30f25e0bc08692289d51b54fbedcd90c3dc86d368023d9e2da688f5c0b
|
File details
Details for the file vehicle_service_engine_nci-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vehicle_service_engine_nci-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd1586cba7b866b0963c03c6678237393a5ec6f5be6198a820191eceb61e4bca
|
|
| MD5 |
a020df77f12c72c8d3fdd3f20500f50b
|
|
| BLAKE2b-256 |
b50ed460cc7bed5c3a3d0122aaa0889740020da1d7bc54880b7a6a0e8017cd84
|