Skip to content

Commit

Permalink
Merge pull request #107 from databio/dev
Browse files Browse the repository at this point in the history
Release 0.4.1
  • Loading branch information
khoroshevskyi authored Apr 11, 2024
2 parents e238aca + e6caf14 commit 5509eb1
Show file tree
Hide file tree
Showing 25 changed files with 510 additions and 867 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ geniml

local_cache

environment/
environment/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.DS_store
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
It needs a path to the *bedbase configuration file*, which can be provided either via `-c`/`--config` argument or read from `$BEDBASE_CONFIG` environment variable.

---
dfgeaf
**Deployed public instance**: <a href="https://bedbase.org/" target="_blank">https://bedbase.org/</a>

**Documentation**: <a href="https://docs.bedbase.org/" target="_blank">https://docs.bedbase.org/bedhost</a>

**API**: <a href="https://api.bedbase.org/" target="_blank">https://api.bedbase.org/</a>

**DEV API**: <a href="https://dev.bedbase.org/" target="_blank">https://api-dev.bedbase.org/</a>

**UI**: <a href="https://bedbase.org/" target="_blank">https://bedbase.org/</a>

**DEV UI**: <a href="https://dev.bedhost.pages.dev/" target="_blank">https://dev.bedhost.pages.dev/</a>

**Source Code**: <a href="https://github.com/databio/bedhost/" target="_blank">https://github.com/databio/bedhost/</a>

---
Expand Down
2 changes: 1 addition & 1 deletion bedhost/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.0"
__version__ = "0.4.1"
10 changes: 0 additions & 10 deletions bedhost/const.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import os
from platform import python_version
from bbconf import __version__ as bbconf_v

from ._version import __version__ as SERVER_VERSION

PKG_NAME = "bedhost"

# for now bedstat version is hard coded
ALL_VERSIONS = {
"bedhost_version": SERVER_VERSION,
"bbconf_version": bbconf_v,
"python_version": python_version(),
}
TEMPLATES_DIRNAME = "templates"
STATIC_DIRNAME = "../docs"
STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), STATIC_DIRNAME)
Expand Down
8 changes: 8 additions & 0 deletions bedhost/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ class ComponentVersions(BaseModel):
bedhost_version: str
bbconf_version: str
python_version: str
geniml_version: str
openapi_version: str


class EmbeddingModels(BaseModel):
vec2vec: str
region2vec: str
text2vec: str


class ServiceInfoResponse(BaseModel):
id: str
name: str
Expand All @@ -62,3 +69,4 @@ class ServiceInfoResponse(BaseModel):
environment: str
version: str
component_versions: ComponentVersions
embedding_models: EmbeddingModels
10 changes: 4 additions & 6 deletions bedhost/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse, HTMLResponse
from fastapi.responses import HTMLResponse

import markdown
from fastapi.templating import Jinja2Templates
from bbconf.exceptions import (
MissingObjectError,
MissingThumbnailError,
BadAccessMethodError,
BEDFileNotFoundError,
BedSetNotFoundError,
)
Expand All @@ -24,11 +23,10 @@
drs_response,
)
from .cli import build_parser
from ._version import __version__ as bedhost_version
from .const import (
ALL_VERSIONS,
PKG_NAME,
STATIC_PATH,
SERVER_VERSION,
)


Expand Down Expand Up @@ -62,7 +60,7 @@
app = FastAPI(
title=PKG_NAME,
description="BED file/sets statistics and image server API",
version=SERVER_VERSION,
version=bedhost_version,
docs_url="/docs",
openapi_tags=tags_metadata,
)
Expand All @@ -72,7 +70,7 @@
"http://localhost:8000",
"http://localhost:5173",
"https://bedbase.org",
"*", # allow cross origin resource sharing, since this is a public API
"*", # allow cross-origin resource sharing, since this is a public API
]

app.add_middleware(
Expand Down
32 changes: 23 additions & 9 deletions bedhost/routers/base_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
from fastapi import APIRouter

from bbconf.models.base_models import StatsReturn

from platform import python_version
from bbconf import __version__ as bbconf_version
from geniml import __version__ as geniml_version

from ..main import bbagent, app
from ..const import ALL_VERSIONS
from ..helpers import get_openapi_version
from ..data_models import ServiceInfoResponse
from .._version import __version__ as bedhost_version

router = APIRouter(prefix="/v1", tags=["base"])


packages_versions = {}


@router.get(
"/stats",
summary="Get summary statistics for the DRS object store",
Expand All @@ -36,24 +41,33 @@ async def service_info():
"""
Returns information about this service, such as versions, name, etc.
"""
all_versions = ALL_VERSIONS
service_version = all_versions["bedhost_version"]
all_versions.update({"openapi_version": get_openapi_version(app)})
all_versions = {
"bedhost_version": bedhost_version,
"bbconf_version": bbconf_version,
"geniml_version": geniml_version,
"python_version": python_version(),
"openapi_version": get_openapi_version(app),
}

return ServiceInfoResponse(
id="org.bedbase.api",
name="BEDbase API",
type={
"group": "org.databio",
"artifact": "bedbase",
"version": service_version,
"version": bedhost_version,
},
description="An API providing genomic interval data and metadata",
organization={"name": "Databio Lab", "url": "https://databio.org"},
contactUrl="https://github.com/databio/bedbase/issues",
documentationUrl="https://bedbase.org",
documentationUrl="https://docs.bedbase.org",
updatedAt="2023-10-25T00:00:00Z",
environment="dev",
version=service_version,
environment="main",
version=bedhost_version,
component_versions=all_versions,
embedding_models={
"vec2vec": bbagent.config.config.path.vec2vec,
"region2vec": bbagent.config.config.path.region2vec,
"text2vec": bbagent.config.config.path.text2vec,
},
)
4 changes: 2 additions & 2 deletions bedhost/routers/bed_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ async def text_to_bed_search(query, limit: int = 10, offset: int = 0):
tags=["search"],
response_model=BedListSearchResult,
)
async def text_to_bed_search(
async def bed_to_bed_search(
file: UploadFile = File(None), limit: int = 10, offset: int = 0
):
_LOGGER.info(f"Searching for bedfiles...")
_LOGGER.info("Searching for bedfiles...")

if file is not None:
with tempfile.TemporaryDirectory() as dirpath:
Expand Down
7 changes: 1 addition & 6 deletions bedhost/routers/bedset_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,8 @@ async def get_bedset_metadata(
)
async def get_bedfiles_in_bedset(
bedset_id: str,
limit: int = 100,
offset: int = 0,
full: bool = False,
):
return bbagent.bedset.get_bedset_bedfiles(
bedset_id, limit=limit, offset=offset, full=full
)
return bbagent.bedset.get_bedset_bedfiles(bedset_id)


# TODO: how are we using it?
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# bbconf @ git+https://github.com/databio/bbconf.git@dev#egg=bbconf
bbconf>=0.5.0
bbconf>=0.5.1
fastapi>=0.103.0
logmuse>=0.2.7
markdown
requests
setuptools
uvicorn
yacman>=0.9.2
pephubclient>=0.4.0
pephubclient>=0.4.1
psycopg[binary,pool]
python-multipart>=0.0.9
2 changes: 1 addition & 1 deletion ui/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# VITE_API_BASE=http://localhost:8000/v1
VITE_API_BASE=https://api.bedbase.org/v1
# VITE_API_BASE=https://api-dev.bedbase.org/v1
4 changes: 2 additions & 2 deletions ui/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>BEDbase.org</title>
</head>
<body>
<div id="root"></div>
Expand Down
Loading

0 comments on commit 5509eb1

Please sign in to comment.