Skip to content

shivankwaghray/turquoise_contract_search_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contract Temporal Search - Django Take Home Test

Overview

Extend this Django shell application to answer the question: "What is the contract rate for a specific service type on a specific date?"

Time Expectation: 2 hours Difficulty: Intermediate

Background Context

You're working on a contract management platform where users need to query contract rates for different service types at different points in time. Contracts have rates for multiple service types when first created, but amendments can selectively change rates for specific services on different effective dates.

The Task

Build Django models and search functionality that can accurately determine an active contract rate for a specific service type for a specific date, accounting for amendments that can selectively override specific service rates.

Your task is to:

  1. Design Django models to store the contract data
  2. Implement a search function that returns the correct rate for a service type on any date
  3. Write tests to ensure your solution works correctly

Sample Data Structure

You'll be working with contracts that look like this:

{
  "contract_id": "CTR-001",
  "effective_date": "2024-01-01",
  "service_rates": [
    {"service_type": "office_visit", "rate": 100.00},
    {"service_type": "lab_work", "rate": 50.00},
    {"service_type": "imaging", "rate": 200.00}
  ],
  "amendments": [
    {"effective_date": "2024-06-01", "service_type": "office_visit", "rate": 120.00},
    {"effective_date": "2024-09-01", "service_type": "office_visit", "rate": 130.00},
    {"effective_date": "2024-09-01", "service_type": "lab_work", "rate": 55.00},
    {"effective_date": "2024-12-01", "service_type": "telehealth", "rate": 80.00}
  ]
}

Requirements

1. Django Models (models.py)

Design Django models that can store the contract data structure shown above. Consider what models and relationships you'll need.

2. Search Function (services.py)

Implement: get_service_rate_on_date(contract_id, service_type, query_date)

  • Returns the rate for a specific service that was active on the specified date
  • Must handle amendments correctly

3. Tests (tests.py)

Include any tests you feel are necessary to validate your solution.

Getting Started

  1. Setup the environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
  2. Verify the environment works:

    python manage.py test

    You should see 1 test pass.

  3. Implement your solution in these files:

    • contracts/models.py - Django models for contracts and amendments
    • contracts/services.py - Search function implementation
    • contracts/tests.py - Test suite
  4. Run tests as you develop:

    python manage.py test contracts

About

Contract Search Take Home Test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages