Skip to content

Commit

Permalink
feat: get project data from docdb
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Nov 6, 2024
1 parent 257e89a commit 87bd2aa
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/aind_qc_portal/docdb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@ def get_all():
return response


@pn.cache(ttl=TIMEOUT_1H)
def get_project(project: str):
filter = {
"name": {"$regex": project}
}
limit = 10
paginate_batch_size = 100
response = client.retrieve_docdb_records(
filter_query=filter,
limit=limit,
paginate_batch_size=paginate_batch_size,
)

return response


@pn.cache
def get_subjects():
filter = {
Expand Down
34 changes: 34 additions & 0 deletions src/aind_qc_portal/project_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Project-specific views, uses configurations from projects/"""
import panel as pn
import param

from aind_qc_portal.docdb.database import get_project


class ProjectView(param.Parameterized):
project = param.String(default="smartspim")

def __init__(self, **params):
super().__init__(**params)

def update(self):
self.data = get_project(self.project)

def panel(self):
return pn.widgets.StaticText(value="meow")

project_view = ProjectView()

# Sync state with the URL
pn.state.location.sync(
project_view,
{
"project": "project",
},
)

project_view.update()

print(project_view.data[0])

project_view.panel().servable()
6 changes: 4 additions & 2 deletions src/aind_qc_portal/projects/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class Mapping(BaseModel):
),
}


# asset ID, mouse ID, genotype, session type, acquisition date, processing date, pipeline version
behavior = {

}
}

# {'_id': '901c7e0e-2a7d-4600-aaa2-b4d40330d132', 'acquisition': None, 'created': '2024-05-07T16:39:45Z', 'data_description': None, 'describedBy': 'https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/metadata.py', 'external_links': [{'Code Ocean': '28552d8f-fc1b-4f3f-9a9e-7f89b6a78ae4'}], 'instrument': None, 'last_modified': '2024-06-13T22:28:57.365951', 'location': 's3://codeocean-s3datasetsbucket-eg0euwi4ez6z/28552d8f-fc1b-4f3f-9a9e-7f89b6a78ae4', 'metadata_status': 'Unknown', 'name': 'behavior_655019_2020-10-10_01-00-24_processed_2024-05-07_16-39-45', 'procedures': None, 'processing': None, 'rig': None, 'schema_version': '0.2.7', 'session': None, 'subject': None}

0 comments on commit 87bd2aa

Please sign in to comment.