Skip to main content

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, and NoShowStrictPolicy each 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. OccupancyBasedPricing raises price as service bays fill up; LastMinuteDiscountPricing discounts slots that are still empty close to the appointment date; BlendedPricing combines both. LaborPricingEngine is 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vehicle_service_engine_nci-1.0.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vehicle_service_engine_nci-1.0.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file vehicle_service_engine_nci-1.0.0.tar.gz.

File metadata

File hashes

Hashes for vehicle_service_engine_nci-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8056e5161a1943a2c7d30e660ee224ff46d59dbfb28ba4c1783428286d2bb15b
MD5 5d120bbb27e36e558fa61544aeb7e0b2
BLAKE2b-256 16e9fa30f25e0bc08692289d51b54fbedcd90c3dc86d368023d9e2da688f5c0b

See more details on using hashes here.

File details

Details for the file vehicle_service_engine_nci-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vehicle_service_engine_nci-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd1586cba7b866b0963c03c6678237393a5ec6f5be6198a820191eceb61e4bca
MD5 a020df77f12c72c8d3fdd3f20500f50b
BLAKE2b-256 b50ed460cc7bed5c3a3d0122aaa0889740020da1d7bc54880b7a6a0e8017cd84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page