We will set up Mock Data to independently test the data management API cluster, then use AWS CloudShell to run a statistical reporting script for the documents.
To facilitate independent testing (not depending on the AI module), mock data has been created directly on AWS:
docuflow-dev-documents-table storing basic metadata.

result.json file (containing lineItems, workflow, extraction data) stored at the directory processed/user-001/doc-20260628-001/ in the S3 bucket.

The testing process is performed using the Test Event feature directly on the AWS Lambda Console interface, simulating requests sent from API Gateway.
GET /documents/{documentId})docuflow-dev-data-get-document-lambdadocumentId, queries DynamoDB to get the processedS3Key path, then connects to S3 to download and return the entire detailed JSON file. Ensure security keys (PK, SK, GSI) are filtered out.


GET /documents?status=...)docuflow-dev-data-list-documents-lambdastatus: "EXTRACTED". The function executes a Query command on the Global Secondary Index (GSI) of DynamoDB to filter the list.


PATCH /documents/{documentId}/review)docuflow-dev-data-review-update-lambdareviewStatus to CORRECTED and log the corrections array.


To support data monitoring and aggregation, a lightweight Node.js script has been deployed via AWS CloudShell to quickly export a report from DynamoDB without loading the main system. Execution steps:

report.mjs using AWS SDK v3 to Query all user records via the Partition Key (PK = USER#{userId}).

ctrl + o to save, then press enter to confirm the filename.ctrl + x to exit.
6. Execute the command node report.mjs to proceed with counting and grouping data.
Actual report results:

To optimize costs and retrieval speeds on AWS according to the Serverless standard, the data model (Data Persistence) is designed based on the “Offloading” (separation) principle between DynamoDB and S3:
USER#{userId}. Helps cluster all of a user’s documents into the same physical node, allowing the List Documents API to run extremely fast and saving RCU (Read Capacity Units).DOC#{documentId}. Combined with PK to accurately retrieve (O(1)) a single document for the Get/Update API.GSI1PK = STATUS#{status} and GSI1SK = createdAt. This allows the system to easily query dashboard tables like: “Get the 10 most recent documents that failed (FAILED) or need review (REVIEW_REQUIRED)”.processedS3Key). When the Client needs to view details, Lambda will pull the file from S3 to return it. This approach avoids hitting DynamoDB’s 400KB/item limit and reduces expensive database storage/retrieval costs.