Coder Social home page Coder Social logo

pricegram_search's Introduction

Installing

# clone the repo
git clone https://github.com/geetu040/pricegram_search.git

# go inside the code
cd pricegram_search

# install the requirements
pip install -r requirements.txt

# setup the package
pip install -e .

Usage

from pricegram_search import SearchEngine

def data_fetcher(ids):
    """
    - ids: product ids that are to be fetched from the database
    - this function loads data from the databased based on these ids and returns python list of dictionaries
    - replace this with your code
    """
    return []

engine = SearchEngine(
    data_fetcher = data_fetcher,
    dump_path = "./utils",    # path to utils
)
engine.search(
    keywords = [    # keywords to look for
        "core i5",
        "16gb RAM",
        "512GB SSD"
    ],
    cluster_size = 50,    # create clusters of this size to sort intra
    k = 200,    # fetch these many products
)

Folder Structure

.
├── pricegram_search
│   ├── config.py
│   ├── engine.py
│   ├── __init__.py
│   ├── loader.py
│   ├── tests
│   │   ├── integration_tests
│   │   │   ├── test_engine.py
│   │   │   └── test_loader.py
│   │   ├── test_pricegram_search.py
│   │   └── unit_tests
│   │       ├── test_config.py
│   │       └── test_utils.py
│   └── utils.py
├── README.md
├── requirements.txt
├── setup.py

The folder structure for the pricegram_search Python package is organized as follows:

  • pricegram_search: This directory serves as the root folder of the Python package.

    • config.py: Contains configuration settings for the search engine.
    • engine.py: Contains the main implementation of the search engine.
    • init.py: This file makes the pricegram_search folder a Python package.
    • loader.py: Provides functionality for loading data into the search engine.
    • tests: Contains all test files for the package.
      • integration_tests: Contains integration test files.
        • test_engine.py: Integration test for the engine module.
        • test_loader.py: Integration test for the loader module.
      • test_pricegram_search.py: Test file for the overall pricegram_search package.
      • unit_tests: Contains unit test files.
        • test_config.py: Unit test for the config module.
        • test_utils.py: Unit test for the utils module.
    • utils.py: Contains utility functions used by the search engine.
  • README.md: A Markdown file containing information about the project, including installation and usage instructions.

  • requirements.txt: Lists the Python packages required by the project.

  • setup.py: Contains metadata about the project, such as its name, version, and dependencies, used for packaging and distribution.

Testing

For pre-commit checks

pre-commit run --all-files

For unit and integration testing

pytest

For scalability testing

python pricegram_search/tests/test_scalability.py -t 10

pricegram_search's People

Contributors

geetu040 avatar taimoorikram avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.