From 98717e7460e498822c404ad0a7e733d1bac71e33 Mon Sep 17 00:00:00 2001 From: Mekhla Kapoor <54870020+mekhlakapoor@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:47:43 -0800 Subject: [PATCH 1/3] docs: adds docs for register/deregister methods --- src/aind_data_access_api/document_db.py | 68 +++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/src/aind_data_access_api/document_db.py b/src/aind_data_access_api/document_db.py index a2416ed..c8e3953 100644 --- a/src/aind_data_access_api/document_db.py +++ b/src/aind_data_access_api/document_db.py @@ -631,7 +631,19 @@ 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. + + Parameters + ---------- + record_id : str + The ID of the record to generate a summary for. + + Returns + ------- + Dict[str, Any] + The LLM-generated summary for the data asset. + """ url = f"{self._data_summary_url}/{record_id}" signed_header = self._signed_request(method="GET", url=url) response = self.session.get( @@ -641,8 +653,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 +687,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 +729,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 1ed3661b34c9d6cf454024d85a2159360b2ae003 Mon Sep 17 00:00:00 2001 From: Mekhla Kapoor <54870020+mekhlakapoor@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:51:37 -0800 Subject: [PATCH 2/3] docs: specify record id for generate data summary method --- src/aind_data_access_api/document_db.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/aind_data_access_api/document_db.py b/src/aind_data_access_api/document_db.py index c8e3953..26a7b0a 100644 --- a/src/aind_data_access_api/document_db.py +++ b/src/aind_data_access_api/document_db.py @@ -632,17 +632,7 @@ def _add_qc_evaluation_url(self) -> str: def generate_data_summary(self, record_id: str) -> Dict[str, Any]: """ - Get an LLM-generated summary for a data asset. - - Parameters - ---------- - record_id : str - The ID of the record to generate a summary for. - - Returns - ------- - Dict[str, Any] - The LLM-generated summary for the 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) From 2d7f884ee2e1a6ae9258d7d8f2e8cc4bd85bdf32 Mon Sep 17 00:00:00 2001 From: Mekhla Kapoor <54870020+mekhlakapoor@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:06:31 -0800 Subject: [PATCH 3/3] adds note about elevated permissions in readthedocs --- docs/source/ExamplesDocDBRestApi.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.