Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize frontend #64

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
54239d7
start generalization of front-end Home page
janash Dec 13, 2023
01692be
continue generalization of front-end Home page
janash Jan 15, 2024
ddddc36
generalize index.html
janash Jan 15, 2024
3d78135
rename 'stats' folder to 'content'
janash Jan 15, 2024
18e2dac
move library details to markdown page
janash Jan 15, 2024
c082838
add kraken workflow image
janash Jan 15, 2024
2aa00d4
update package.json
janash Jan 15, 2024
33adbf7
remove unused files and components
janash Jan 15, 2024
2c6eaf4
more work on frontend generalization
janash Feb 29, 2024
0696d1b
generalize molecule data API endpoint and remove unnecessary data return
janash Feb 29, 2024
ffe1aa6
fix docs/image links
janash Mar 1, 2024
83d57f1
adjust API calls and URLs for prefix
janash Mar 1, 2024
ea822a0
set up different frontends/backends
janash Mar 2, 2024
ea5e998
refactor home page graph
janash Mar 5, 2024
827f84f
add graph labels manually for now
janash Mar 5, 2024
5936629
fix page open with click
janash Mar 5, 2024
4956cab
dynamically set site title and other branding
janash Mar 5, 2024
6e6f23a
use window location for API calls
janash Mar 6, 2024
70c167a
workaround for production variable filenames
janash Mar 6, 2024
31186e7
more adjustments for variable prefixes
janash Mar 6, 2024
77f9f3c
return compound name for molecule info
janash Mar 6, 2024
72ed37d
dynamic rendering of molecule info
janash Mar 6, 2024
b837390
data types API endpoint; fix frontend molecule data table
janash Mar 7, 2024
6eccfed
download buttons populate on available data
janash Mar 7, 2024
12991fb
minor adjustment
janash Mar 7, 2024
42d1ed5
another minor adjustment
janash Mar 7, 2024
788fa13
make Ketcher full screen
janash Mar 7, 2024
9884a70
add display of conformer cluster
janash Mar 8, 2024
eb9c0ad
flexible molecule ID - str or int
janash Mar 11, 2024
21ff13d
generalize data download for string IDs
janash Mar 13, 2024
50e1f01
increase search limit
janash Mar 13, 2024
003c417
change pca search
janash Mar 13, 2024
74aed6b
allow string id for conformer
janash Mar 13, 2024
f5e7618
fix query for conformers in except
janash Mar 13, 2024
b59d773
fix query for conformers in except - try2
janash Mar 13, 2024
3054d99
fix table name in query
janash Mar 13, 2024
dd1db33
reduce pca components
janash Mar 13, 2024
c0735ba
reduce pca components
janash Mar 13, 2024
354b612
reduce pca search number for neighbors
janash Mar 13, 2024
bdf3177
change elements and coords query
janash Mar 13, 2024
b701557
default molecule ID
janash Mar 14, 2024
c88a383
remove documentation from navbar
janash Mar 14, 2024
52aef23
add download button
janash Mar 14, 2024
4816bce
conditionally show download button
janash Mar 15, 2024
6786fb0
configure server for 404 for missing file
janash Mar 15, 2024
4835c1b
fix URL for file download
janash Mar 15, 2024
e7d4fc8
remove unnecessary files
janash Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions DB_restructuring_queries.sql

This file was deleted.

68 changes: 0 additions & 68 deletions add_data_tables.sql

This file was deleted.

44 changes: 35 additions & 9 deletions backend/app/app/api/v2/endpoints/conformer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, Depends
from fastapi.responses import PlainTextResponse
from typing import List
from typing import List, Any

from sqlalchemy import text
from sqlalchemy.orm import Session
Expand All @@ -18,11 +18,19 @@ def get_conformer_and_format(conformer_id, format, db):
return "Not implemented yet"

try:
coords, elements = (
db.query(models.conformer.coords, models.conformer.elements)
.filter(models.conformer.conformer_id == conformer_id)
.one()
)
query = text("""
SELECT coords, elements
FROM conformer
WHERE conformer_id = :conformer_id
""")

stmt = query.bindparams(conformer_id=conformer_id)

result = db.execute(stmt).fetchone()

coords = result.coords
elements = result.elements

except:
return None

Expand All @@ -38,7 +46,7 @@ def get_conformer_and_format(conformer_id, format, db):

@router.get("/export/{format}/{conformer_id}", response_class=PlainTextResponse)
def export_conformer(
conformer_id: int = 0,
conformer_id: int | str,
format: str = "xyz",
db: Session = Depends(deps.get_db),
):
Expand All @@ -51,11 +59,29 @@ def format_for_ngl(
db: Session = Depends(deps.get_db),
):
conformer_id, format = filename.split(".")
return get_conformer_and_format(int(conformer_id), format, db)
return get_conformer_and_format(conformer_id, format, db)

@router.get("/data/{conformer_id}", response_model=Any)
def get_conformer_data(conformer_id: int | str, db: Session = Depends(deps.get_db)):

query = text(f"""
SELECT *
FROM conformer
WHERE conformer_id = :conformer_id
""")

stmt = query.bindparams(conformer_id=conformer_id)

result = db.execute(stmt).fetchone()

# Hacky way to get each row as a dictionary.
# do this to generalize for different data sets - column names may vary.
data = { k:v for k, v in result._asdict().items() if k != "coords" and k != "elements" }

return data

@router.get("/others_id/{conformer_id}")
def get_other_conformers_id(conformer_id: int = 0, db: Session = Depends(deps.get_db)):
def get_other_conformers_id(conformer_id: int | str, db: Session = Depends(deps.get_db)):
sql = text(
(
"select conformer_id from conformer "
Expand Down
Loading
Loading