techs-targe

AWSのRAPIDを使って書類審査を自動化するトライ(セットアップ編・追記)

■RAPIDとは

RAPID = Review & Assessment Powered by Intelligent Documentation
AIを活用して、書類審査の効率化をサポートするソリューション。

行政機関向けの申請書などのチェックに使えるかな?

参考URL
https://pages.awscloud.com/rs/112-TZM-766/images/AWS_Summit_2025_I-23A_Review-and-assessment-powered-by-intelligent-documentation_RAPID.pdf

公式PDFのアーキテクチャはこんなイメージ。業務で使えるかもしれない。早速検証。

RAPIDアーキテクチャ

■やってみる

(1)要求仕様書のサンプル
今回はこの要求仕様書の書類チェックをやってみる。
https://www.sessame.jp/workinggroup/WorkingGroup2/POT_Specification_v7.PDF

(2)サービスセットアップ

# IPを自分の環境に合わせて設定
# IP4="$(curl -4 -s ifconfig.me)/32"
IP4="<YOUR_PUBLIC_IP/32>"  # 例: 203.0.113.10/32 など

wget -O - https://raw.githubusercontent.com/aws-samples/review-and-assessment-powered-by-intelligent-documentation/main/bin.sh \
| bash -s -- \
  --ipv4-ranges "[\"$IP4\"]" \
  --cognito-self-signup false \
  --auto-migrate false \
  --bedrock-region us-west-2 \
  --document-model "us.anthropic.claude-haiku-4-5-20251001-v1:0" \
  --image-model "us.anthropic.claude-haiku-4-5-20251001-v1:0"
~ $ IP4="<YOUR_PUBLIC_IP/32>"
~ $
~ $ wget -O - https://raw.githubusercontent.com/aws-samples/review-and-assessment-powered-by-intelligent-documentation/main/bin.sh \
> | bash -s -- \
>   --ipv4-ranges "[\"$IP4\"]" \
>   --cognito-self-signup false \
>   --auto-migrate false \
>   --bedrock-region us-west-2 \
>   --document-model "us.anthropic.claude-haiku-4-5-20251001-v1:0" \
>   --image-model "us.anthropic.claude-haiku-4-5-20251001-v1:0"
--2025-11-01 18:04:46--  https://raw.githubusercontent.com/aws-samples/review-and-assessment-powered-by-intelligent-documentation/main/bin.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... <omitted>
Connecting to raw.githubusercontent.com ... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7687 (7.5K) [text/plain]
Saving to: 'STDOUT'
...
---------------------------------------------------------------------------
  🎉 Deployment completed successfully!
---------------------------------------------------------------------------
  Frontend URL: <https://xxxxxxxxxxxxxxxx.cloudfront.net>
---------------------------------------------------------------------------

(3)環境変数の設定

EMAIL="your_mail@your_domain"

# User Pool ID(OutputKeyに "UserPoolId" を含むもの)
POOL_ID=$(aws cloudformation describe-stacks \
  --region us-west-2 --stack-name RapidStack \
  --query "Stacks[0].Outputs[?contains(OutputKey, 'UserPoolId')].OutputValue" \
  --output text)
echo "POOL_ID=$POOL_ID"

# User Pool Client ID("ClientId" を含むもの)
CLIENT_ID=$(aws cloudformation describe-stacks \
  --region us-west-2 --stack-name RapidStack \
  --query "Stacks[0].Outputs[?contains(OutputKey, 'ClientId')].OutputValue" \
  --output text)
echo "CLIENT_ID=$CLIENT_ID"

# (このセッションだけ us-west-2 を既定にしたいなら)
export AWS_DEFAULT_REGION=us-west-2

(4)ユーザー作成

# 1) 管理者ユーザー作成
aws cognito-idp admin-create-user \
  --user-pool-id "$POOL_ID" \
  --username "$EMAIL" \
  --temporary-password '<TEMP_PASSWORD>' \
  --message-action SUPPRESS \
  --user-attributes Name=email,Value="$EMAIL" Name=email_verified,Value=true

# 2) 一時PWを恒久パスワードに変更
aws cognito-idp admin-set-user-password \
  --user-pool-id "$POOL_ID" \
  --username "$EMAIL" \
  --password '<PERMANENT_PASSWORD>' \
  --permanent

(5)ログイン
デプロイ成功時に出力される Frontend URL に接続し、ログイン画面からログイン成功。

ログイン成功

チェックリストを新規作成

チェックリストを新規作成

(6)問題発生、そして次回へ
チェックリストのチェックが終わらない。

問題発生

これは、待っていれば終わるのか?それとも内部的に解析が失敗している?

LLMに任せるチェックだけではなく、数値計算など厳密なチェックは
Lambdaで行えばいいのかな?AIとそれ以外の連携を行って審査するところまで検証したい。

■11/2 13:11 追記

半日立ってもチェックリストのチェックが終わらないため、Step Functionsで状況確認。
どうやら、デプロイ時のモデル指定に問題があったようだ。

--document-model "us.anthropic.claude-haiku-4-5-20251001-v1:0" \
--image-model "us.anthropic.claude-haiku-4-5-20251001-v1:0"

モデル指定をなくした場合、Claude Sonnet 4 (2025-05-14)が使われるようだ。
デフォルトのモデル指定でリトライしてみる。

■再実行結果

~ $ IP4="<YOUR_PUBLIC_IP/32>" #実際のIPに合わせて変更する
~ $
~ $ wget -O - https://raw.githubusercontent.com/aws-samples/review-and-assessment-powered-by-intelligent-documentation/main/bin.sh \
> | bash -s -- \
>   --ipv4-ranges "[\"$IP4\"]" \
>   --cognito-self-signup false \
>   --auto-migrate false \
>   --bedrock-region us-west-2
--2025-11-02 03:17:00--  https://raw.githubusercontent.com/aws-samples/review-and-assessment-powered-by-intelligent-documentation/main/bin.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7687 (7.5K) [text/plain]
Saving to: 'STDOUT'

-                                                 100%[==========================================================================================================>]   7.51K  --.-KB/s    in 0s

2025-11-02 03:17:00 (64.9 MB/s) - written to stdout [7687/7687]


===========================================================================
    ____  ___    ____  ________
   / __ \/   |  / __ \/  _/ __ \
  / /_/ / /| | / /_/ // // / / /
 / _, _/ ___ |/ ____// // /_/ /
/_/ |_/_/  |_/_/   /___/_____/

Review & Assessment Powered by Intelligent Documentation
---------------------------------------------------------------------------
  This script deploys the RAPID application using AWS CodeBuild.
  No local environment dependencies - deployment runs entirely in AWS.

  ⚠️  WARNING: Auto-migration is enabled by default.
     For production environments, consider using --auto-migrate=false
===========================================================================

Cloning repository...
Cloning into 'rapid-deploy-1762053420'...
remote: Enumerating objects: 6547, done.
remote: Counting objects: 100% (168/168), done.
remote: Compressing objects: 100% (131/131), done.
remote: Total 6547 (delta 49), reused 61 (delta 30), pack-reused 6379 (from 2)
Receiving objects: 100% (6547/6547), 15.42 MiB | 28.25 MiB/s, done.
Resolving deltas: 100% (3535/3535), done.
Moved to working directory: /home/cloudshell-user/rapid-deploy-1762053420

Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - RapidCodeBuildDeploy
Waiting for stack creation to complete...
Note: This stack includes a CodeBuild project used for CDK deployment.

Completed.

Starting CodeBuild project: <PROJECT_ID>...
Waiting for CodeBuild project to complete...
CodeBuild project completed. Status: SUCCEEDED
Retrieving CDK deployment logs...
Cleaning up working directory: rapid-deploy-1762053420

===========================================================================
  🎉 Deployment completed successfully!
---------------------------------------------------------------------------
  Frontend URL: https://xxxxxxxxxxxxxxxx.cloudfront.net

  You can check detailed logs with the following command:
  aws logs get-log-events --log-group-name /aws/codebuild/<PROJECT_ID> --log-stream-name <LOG_STREAM_NAME>
===========================================================================
~ $

このファイル(POT_v7_checklist_from_csv.pdf)を読ませて、再度チェックリスト作成...成功!

チェックリスト作成成功

完成したチェックリストを見ると、一部項目について要修正のマークが付いている。
提案の内容に合わせて修正してゆく。

チェックリストの修正

審査データを作成。結果を待つ。

審査データ作成

10分ほどで完了。

審査結果

一部項目が不合格になったが、大体の項目は合格になった。
1ドキュメントで3.67$は結構高いと思うが、人件費に比べれば安いのか?

よし、あとは独自の検証ロジックのワークフローを継ぎ足して行こうと思う。

share
views