from fastapi import (APIRouter, Depends)
from app.dependers import (SimpleQueryStringSearch, GetByAccession)
from app.response_models import ResponseModel
from enum import Enum
from app.elasticsearch.utils import (get_flattened_mapping_from_index)


router = APIRouter()

# TODO: may want to implement stuff for bioproject


@router.get("/fields/{entity}")
def mapping(entity: str) -> dict:
    #entity_string = str(entity.name)
    #print(entity_string)
    #return get_flattened_mapping_from_index('sra_' + entity_string)
    return get_flattened_mapping_from_index('biosample')

@router.get("/samples", response_model=ResponseModel)
async def biosamples(
        searcher: SimpleQueryStringSearch = Depends(SimpleQueryStringSearch)):
    return searcher.search('biosample')


# TODO: implement biosample pydandic model
@router.get("/samples/{accession}")
async def biosample_by_accession(
        getter: GetByAccession = Depends(GetByAccession)):
    return getter.get('biosample')

021cb9ee60142a6cb41662ee4e6b54ff540e5730
<mask token>


@router.get('/fields/{entity}')
def mapping(entity: str) ->dict:
    return get_flattened_mapping_from_index('biosample')


<mask token>

<mask token>


@router.get('/fields/{entity}')
def mapping(entity: str) ->dict:
    return get_flattened_mapping_from_index('biosample')


@router.get('/samples', response_model=ResponseModel)
async def biosamples(searcher: SimpleQueryStringSearch=Depends(
    SimpleQueryStringSearch)):
    return searcher.search('biosample')


@router.get('/samples/{accession}')
async def biosample_by_accession(getter: GetByAccession=Depends(GetByAccession)
    ):
    return getter.get('biosample')

<mask token>
router = APIRouter()


@router.get('/fields/{entity}')
def mapping(entity: str) ->dict:
    return get_flattened_mapping_from_index('biosample')


@router.get('/samples', response_model=ResponseModel)
async def biosamples(searcher: SimpleQueryStringSearch=Depends(
    SimpleQueryStringSearch)):
    return searcher.search('biosample')


@router.get('/samples/{accession}')
async def biosample_by_accession(getter: GetByAccession=Depends(GetByAccession)
    ):
    return getter.get('biosample')

from fastapi import APIRouter, Depends
from app.dependers import SimpleQueryStringSearch, GetByAccession
from app.response_models import ResponseModel
from enum import Enum
from app.elasticsearch.utils import get_flattened_mapping_from_index
router = APIRouter()


@router.get('/fields/{entity}')
def mapping(entity: str) ->dict:
    return get_flattened_mapping_from_index('biosample')


@router.get('/samples', response_model=ResponseModel)
async def biosamples(searcher: SimpleQueryStringSearch=Depends(
    SimpleQueryStringSearch)):
    return searcher.search('biosample')


@router.get('/samples/{accession}')
async def biosample_by_accession(getter: GetByAccession=Depends(GetByAccession)
    ):
    return getter.get('biosample')

from fastapi import (APIRouter, Depends)
from app.dependers import (SimpleQueryStringSearch, GetByAccession)
from app.response_models import ResponseModel
from enum import Enum
from app.elasticsearch.utils import (get_flattened_mapping_from_index)


router = APIRouter()

# TODO: may want to implement stuff for bioproject


@router.get("/fields/{entity}")
def mapping(entity: str) -> dict:
    #entity_string = str(entity.name)
    #print(entity_string)
    #return get_flattened_mapping_from_index('sra_' + entity_string)
    return get_flattened_mapping_from_index('biosample')

@router.get("/samples", response_model=ResponseModel)
async def biosamples(
        searcher: SimpleQueryStringSearch = Depends(SimpleQueryStringSearch)):
    return searcher.search('biosample')


# TODO: implement biosample pydandic model
@router.get("/samples/{accession}")
async def biosample_by_accession(
        getter: GetByAccession = Depends(GetByAccession)):
    return getter.get('biosample')
