diff --git a/src/aind_qc_portal/docdb/database.py b/src/aind_qc_portal/docdb/database.py index 4de5dfd..6ae3209 100644 --- a/src/aind_qc_portal/docdb/database.py +++ b/src/aind_qc_portal/docdb/database.py @@ -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 = { diff --git a/src/aind_qc_portal/project_app.py b/src/aind_qc_portal/project_app.py index e69de29..414ae5f 100644 --- a/src/aind_qc_portal/project_app.py +++ b/src/aind_qc_portal/project_app.py @@ -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() \ No newline at end of file diff --git a/src/aind_qc_portal/projects/mappings.py b/src/aind_qc_portal/projects/mappings.py index 6496b84..38cfd06 100644 --- a/src/aind_qc_portal/projects/mappings.py +++ b/src/aind_qc_portal/projects/mappings.py @@ -65,7 +65,9 @@ class Mapping(BaseModel): ), } - +# asset ID, mouse ID, genotype, session type, acquisition date, processing date, pipeline version behavior = { -} \ No newline at end of file +} + +# {'_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} \ No newline at end of file