From 5d30c3d1ffbb9580cac7f0fa13130a65e6fee399 Mon Sep 17 00:00:00 2001 From: Mekhla Kapoor <54870020+mekhlakapoor@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:31:21 -0800 Subject: [PATCH 1/2] docs: adds docs for register/deregister methods (#202) * docs: adds docs for register/deregister methods * docs: specify record id for generate data summary method * adds note about elevated permissions in readthedocs --- docs/source/ExamplesDocDBRestApi.rst | 3 +- src/aind_data_access_api/document_db.py | 58 ++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/docs/source/ExamplesDocDBRestApi.rst b/docs/source/ExamplesDocDBRestApi.rst index 5f32c47..0fcdab6 100644 --- a/docs/source/ExamplesDocDBRestApi.rst +++ b/docs/source/ExamplesDocDBRestApi.rst @@ -193,7 +193,8 @@ It's possible to attach a custom Session to retry certain requests errors: Updating Metadata ~~~~~~~~~~~~~~~~~~~~~~ -1. **Permissions**: Request permissions for AWS Credentials to write to DocDB through the API Gateway. +1. **Permissions**: Request permissions for AWS Credentials to write to DocDB through the API Gateway. +Note that the asset de/registration endpoints are intended for administrative use and require elevated AWS credentials/permissions. 2. **Query DocDB**: Filter for the records you want to update. 3. **Update DocDB**: Use ``upsert_one_docdb_record`` or ``upsert_list_of_docdb_records`` to update the records. diff --git a/src/aind_data_access_api/document_db.py b/src/aind_data_access_api/document_db.py index a2416ed..26a7b0a 100644 --- a/src/aind_data_access_api/document_db.py +++ b/src/aind_data_access_api/document_db.py @@ -631,7 +631,9 @@ def _add_qc_evaluation_url(self) -> str: return f"https://{self.host}/{self.version}/add_qc_evaluation" def generate_data_summary(self, record_id: str) -> Dict[str, Any]: - """Get an LLM-generated summary for a data asset.""" + """ + Get an LLM-generated summary for a data asset with the given record id. + """ url = f"{self._data_summary_url}/{record_id}" signed_header = self._signed_request(method="GET", url=url) response = self.session.get( @@ -641,8 +643,21 @@ def generate_data_summary(self, record_id: str) -> Dict[str, Any]: return response.json() def register_asset(self, s3_location: str) -> Dict[str, Any]: - """Register a data asset to Code Ocean and the DocDB metadata index.""" + """ + Register a data asset to Code Ocean and add its metadata to DocDB + given the metadata exists at the top level of the provided S3 location. + + Parameters + ---------- + s3_location : str + The S3 location containing the asset and its metadata. + Returns + ------- + Dict[str, Any] + The response from the registration API, including registration + status and details. + """ data = json.dumps({"s3_location": s3_location}) signed_header = self._signed_request( method="POST", url=self._register_asset_url, data=data @@ -662,8 +677,28 @@ def register_co_result( co_asset_id: str, co_computation_id: str, ) -> Dict[str, Any]: - """Register a Code Ocean result asset to the DocDB metadata index.""" + """ + Register a Code Ocean result asset and add its metadata to DocDB + given the metadata exists at the top level of the Code Ocean + computation result. + Parameters + ---------- + s3_location : str + The S3 location containing the result asset and its metadata. + name : str + The name of the result asset. + co_asset_id : str + The Code Ocean asset ID for the result. + co_computation_id : str + The Code Ocean computation ID associated with the result. + + Returns + ------- + Dict[str, Any] + The response from the registration API, including registration + status and details. + """ data = json.dumps( { "s3_location": s3_location, @@ -684,9 +719,22 @@ def register_co_result( return response.json() def deregister_asset(self, s3_location: str) -> Dict[str, Any]: - """De-register (delete) a data asset in Code Ocean and the - DocDB metadata index.""" + """ + De-register (delete) a data asset from Code Ocean and remove its + metadata from DocDB given that the asset and its metadata are located + at the provided S3 location. + Parameters + ---------- + s3_location : str + The S3 location containing the asset and metadata to be removed. + + Returns + ------- + Dict[str, Any] + The response from the deregistration API, including deregistration + status and details. + """ data = json.dumps({"s3_location": s3_location}) signed_header = self._signed_request( method="DELETE", url=self._deregister_asset_url, data=data From 604720636d825f709fff1fec8b458dc04e77ef0e Mon Sep 17 00:00:00 2001 From: Helen Lin <46795546+helen-m-lin@users.noreply.github.com> Date: Mon, 23 Feb 2026 15:35:50 -0800 Subject: [PATCH 2/2] ci: bump version to 1.9.3 --- src/aind_data_access_api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aind_data_access_api/__init__.py b/src/aind_data_access_api/__init__.py index d9a15f0..4c71ba2 100644 --- a/src/aind_data_access_api/__init__.py +++ b/src/aind_data_access_api/__init__.py @@ -1,3 +1,3 @@ """Init package""" -__version__ = "1.9.2" +__version__ = "1.9.3"