Skip to content

Commit

Permalink
Merge pull request #29 from prrao87/reorg
Browse files Browse the repository at this point in the history
Reorg and renaming
  • Loading branch information
prrao87 committed May 8, 2023
2 parents bae2e55 + 2ab7230 commit a95e4a6
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions dbs/elasticsearch/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from fastapi import FastAPI

from api.config import Settings
from api.routers.wine import wine_router
from api.routers import rest


@lru_cache()
Expand Down Expand Up @@ -60,4 +60,4 @@ async def root():


# Attach routes
app.include_router(wine_router, prefix="/wine", tags=["wine"])
app.include_router(rest.router, prefix="/wine", tags=["wine"])
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
TopWinesByProvince,
)

wine_router = APIRouter()
router = APIRouter()


# --- Routes ---


@wine_router.get(
@router.get(
"/search",
response_model=list[FullTextSearch],
response_description="Search wines by title, description and variety",
Expand All @@ -22,7 +22,7 @@ async def search_by_keywords(
request: Request,
terms: str = Query(description="Search wine by keywords in title, description and variety"),
max_price: int = Query(
default=10000.0, description="Specify the maximum price for the wine (e.g., 30)"
default=100.0, description="Specify the maximum price for the wine (e.g., 30)"
),
) -> list[FullTextSearch] | None:
result = await _search_by_keywords(request.app.client, terms, max_price)
Expand All @@ -34,7 +34,7 @@ async def search_by_keywords(
return result


@wine_router.get(
@router.get(
"/top_by_country",
response_model=list[TopWinesByCountry],
response_description="Get top-rated wines by country",
Expand All @@ -54,7 +54,7 @@ async def top_by_country(
return result


@wine_router.get(
@router.get(
"/top_by_province",
response_model=list[TopWinesByProvince],
response_description="Get top-rated wines by province",
Expand All @@ -74,7 +74,7 @@ async def top_by_province(
return result


@wine_router.get(
@router.get(
"/count_by_country",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country",
Expand All @@ -92,7 +92,7 @@ async def count_by_country(
return result


@wine_router.get(
@router.get(
"/count_by_filters",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country, filtered by points and price",
Expand Down
4 changes: 2 additions & 2 deletions dbs/meilisearch/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from meilisearch_python_async import Client

from api.config import Settings
from api.routers.wine import wine_router
from api.routers import rest


@lru_cache()
Expand Down Expand Up @@ -56,4 +56,4 @@ async def root():


# Attach routes
app.include_router(wine_router, prefix="/wine", tags=["wine"])
app.include_router(rest.router, prefix="/wine", tags=["wine"])
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
TopWinesByProvince,
)

wine_router = APIRouter()
router = APIRouter()


# --- Routes ---


@wine_router.get(
@router.get(
"/search",
response_model=list[FullTextSearch],
response_description="Search wines by title, description and variety",
Expand All @@ -21,7 +21,7 @@ async def search_by_keywords(
request: Request,
terms: str = Query(description="Search wine by keywords in title, description and variety"),
max_price: int = Query(
default=10000.0, description="Specify the maximum price for the wine (e.g., 30)"
default=100.0, description="Specify the maximum price for the wine (e.g., 30)"
),
) -> list[FullTextSearch] | None:
result = await _search_by_keywords(request.app.client, terms, max_price)
Expand All @@ -33,7 +33,7 @@ async def search_by_keywords(
return result


@wine_router.get(
@router.get(
"/top_by_country",
response_model=list[TopWinesByCountry],
response_description="Get top-rated wines by country",
Expand All @@ -53,7 +53,7 @@ async def top_by_country(
return result


@wine_router.get(
@router.get(
"/top_by_province",
response_model=list[TopWinesByProvince],
response_description="Get top-rated wines by province",
Expand Down
4 changes: 2 additions & 2 deletions dbs/neo4j/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from neo4j import AsyncGraphDatabase

from api.config import Settings
from api.routers.wine import wine_router
from api.routers import rest


@lru_cache()
Expand Down Expand Up @@ -48,4 +48,4 @@ async def root():


# Attach routes
app.include_router(wine_router, prefix="/wine", tags=["wine"])
app.include_router(rest.router, prefix="/wine", tags=["wine"])
12 changes: 6 additions & 6 deletions dbs/neo4j/api/routers/wine.py → dbs/neo4j/api/routers/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
TopWinesByProvince,
)

wine_router = APIRouter()
router = APIRouter()


# --- Routes ---


@wine_router.get(
@router.get(
"/search",
response_model=list[FullTextSearch],
response_description="Search wines by title and description",
Expand All @@ -22,7 +22,7 @@ async def search_by_keywords(
request: Request,
terms: str = Query(description="Search wine by keywords in title or description"),
max_price: float = Query(
default=10000.0, description="Specify the maximum price for the wine (e.g., 30)"
default=100.0, description="Specify the maximum price for the wine (e.g., 30)"
),
) -> list[FullTextSearch] | None:
session = request.app.session
Expand All @@ -35,7 +35,7 @@ async def search_by_keywords(
return result


@wine_router.get(
@router.get(
"/top_by_country",
response_model=list[TopWinesByCountry],
response_description="Get top-rated wines by country",
Expand All @@ -56,7 +56,7 @@ async def top_by_country(
return result


@wine_router.get(
@router.get(
"/top_by_province",
response_model=list[TopWinesByProvince],
response_description="Get top-rated wines by province",
Expand All @@ -77,7 +77,7 @@ async def top_by_province(
return result


@wine_router.get(
@router.get(
"/most_by_variety",
response_model=list[MostWinesByVariety],
response_description="Get the countries with the most wines above a points-rating of a specified variety (blended or otherwise)",
Expand Down
4 changes: 2 additions & 2 deletions dbs/qdrant/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from qdrant_client import QdrantClient

from api.config import Settings
from api.routers.wine import wine_router
from api.routers import rest

try:
from optimum.onnxruntime import ORTModelForCustomTasks
Expand Down Expand Up @@ -75,4 +75,4 @@ async def root():


# Attach routes
app.include_router(wine_router, prefix="/wine", tags=["wine"])
app.include_router(rest.router, prefix="/wine", tags=["wine"])
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

from schemas.retriever import CountByCountry, SimilaritySearch

wine_router = APIRouter()
router = APIRouter()


# --- Routes ---


@wine_router.get(
@router.get(
"/search",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms",
Expand All @@ -30,7 +30,7 @@ def search_by_similarity(
return result


@wine_router.get(
@router.get(
"/search_by_country",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms from a particular country",
Expand All @@ -52,7 +52,7 @@ def search_by_similarity_and_country(
return result


@wine_router.get(
@router.get(
"/search_by_filters",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms with added filters",
Expand All @@ -76,7 +76,7 @@ def search_by_similarity_and_filters(
return result


@wine_router.get(
@router.get(
"/count_by_country",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country",
Expand All @@ -95,7 +95,7 @@ def count_by_country(
return result


@wine_router.get(
@router.get(
"/count_by_filters",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country, filtered by points and price",
Expand Down
4 changes: 2 additions & 2 deletions dbs/weaviate/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from fastapi import FastAPI

from api.config import Settings
from api.routers.wine import wine_router
from api.routers import rest

try:
from optimum.onnxruntime import ORTModelForCustomTasks
Expand Down Expand Up @@ -77,4 +77,4 @@ async def root():


# Attach routes
app.include_router(wine_router, prefix="/wine", tags=["wine"])
app.include_router(rest.router, prefix="/wine", tags=["wine"])
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from fastapi import APIRouter, HTTPException, Query, Request
from schemas.retriever import CountByCountry, SimilaritySearch

wine_router = APIRouter()
router = APIRouter()


# --- Routes ---


@wine_router.get(
@router.get(
"/search",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms",
Expand All @@ -28,7 +28,7 @@ def search_by_similarity(
return result


@wine_router.get(
@router.get(
"/search_by_country",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms from a particular country",
Expand All @@ -50,7 +50,7 @@ def search_by_similarity_and_country(
return result


@wine_router.get(
@router.get(
"/search_by_filters",
response_model=list[SimilaritySearch],
response_description="Search for wines via semantically similar terms with added filters",
Expand All @@ -74,7 +74,7 @@ def search_by_similarity_and_filters(
return result


@wine_router.get(
@router.get(
"/count_by_country",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country",
Expand All @@ -93,7 +93,7 @@ def count_by_country(
return result


@wine_router.get(
@router.get(
"/count_by_filters",
response_model=CountByCountry,
response_description="Get counts of wine for a particular country, filtered by points and price",
Expand Down

0 comments on commit a95e4a6

Please sign in to comment.