diff --git a/03-Azure/01-04-AI/05_Claims_Processing/challenges/challenge-01.md b/03-Azure/01-04-AI/05_Claims_Processing/challenges/challenge-01.md index b27053f18..5efca3146 100644 --- a/03-Azure/01-04-AI/05_Claims_Processing/challenges/challenge-01.md +++ b/03-Azure/01-04-AI/05_Claims_Processing/challenges/challenge-01.md @@ -92,6 +92,46 @@ Mistral Document AI key and endpoint, Azure AI Search key and endpoint, and Stor connection string required by Challenges 2 through 6. The file is excluded from Git, written with permissions `600`, and its secret values are not displayed. +### 4. Verify the Blob Storage assets + +Before continuing, confirm that the lab deployment uploaded the claim and policy files. +Find the Storage account name in the output from `get-keys.sh`, then run these commands +from the repository root: + +```bash +STORAGE_ACCOUNT="" +STORAGE_CONNECTION_STRING="$(sed -n 's/^AZURE_STORAGE_CONNECTION_STRING=//p' .env)" + +az storage blob list \ + --connection-string "$STORAGE_CONNECTION_STRING" \ + --container-name claims-data \ + --query "length(@)" \ + --output tsv + +az storage blob list \ + --connection-string "$STORAGE_CONNECTION_STRING" \ + --container-name policies \ + --query "length(@)" \ + --output tsv +``` + +The expected results are `17` claim files and `5` policy documents. You can also open +the Storage account in the Azure portal, select **Data storage > Containers**, and +inspect the `claims-data` and `policies` containers directly. + +If either count is lower than expected, upload and verify only the missing lab assets +without redeploying the infrastructure: + +```bash +bash labautomation/upload-assets.sh \ + --subscription "" \ + --resource-group "" \ + --storage-account "$STORAGE_ACCOUNT" +``` + +The command finishes with `Asset upload complete and verified: 17 claims, 5 policies.` +It does not deploy or modify the lab infrastructure. + Confirm that the participant CLI is available: ```bash @@ -111,6 +151,8 @@ Review the [solution architecture](../README.md#architecture) and identify where - **The Azure resource group is missing:** Confirm that you signed in with the assigned lab account and selected the assigned subscription in the Azure portal. - **The setup script reports an authorization error:** Confirm that the Codespace is signed in with the assigned lab account. That account must be able to read deployment outputs and list keys for the Foundry, Azure AI Search, and Storage resources. +- **The Blob Storage verification reports an authorization error:** Run `get-keys.sh` again and confirm that `.env` contains a non-empty `AZURE_STORAGE_CONNECTION_STRING` value. Do not print or share the value. +- **A Blob Storage container is empty or incomplete:** Run `labautomation/upload-assets.sh` with your subscription, resource group, and Storage account values, then repeat the verification commands. - **The GitHub organization or repository is missing:** Sign out of GitHub, then sign in again through **Sign in with your identity provider** using the Hackbox credentials. - **The dev container configuration is unavailable:** Confirm that you opened the assigned `microhack` repository before creating the Codespace. - **The Codespace does not finish starting:** Review the creation log for the failing step, then rebuild the container or recreate the Codespace. diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/azuredeploy.json b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/azuredeploy.json index 30c37516d..f144a0c2d 100644 --- a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/azuredeploy.json +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/azuredeploy.json @@ -65,6 +65,7 @@ "cognitiveServicesUserRoleId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a97b65f3-24c7-4388-baec-2e87135dc908')]", "searchServiceContributorRoleId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7ca78c08-252a-4471-8644-bb5ff32d4ba0')]", "searchIndexDataReaderRoleId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '1407120a-92aa-4202-b7e9-c0e197c71c8f')]", + "foundryUserRoleId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '53ca6127-db72-4b80-b1b0-d745d6d5456d')]", "tags": { "SecurityControl": "Ignore", "CostControl": "Ignore" @@ -154,6 +155,24 @@ "publicNetworkAccess": "Enabled" } }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2022-04-01", + "name": "[guid(resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName')), parameters('allowedEntraUserIds')[copyIndex()], variables('foundryUserRoleId'))]", + "scope": "[format('Microsoft.CognitiveServices/accounts/{0}', variables('aiFoundryName'))]", + "copy": { + "name": "foundryUserAssignments", + "count": "[length(parameters('allowedEntraUserIds'))]" + }, + "properties": { + "roleDefinitionId": "[variables('foundryUserRoleId')]", + "principalId": "[parameters('allowedEntraUserIds')[copyIndex()]]", + "principalType": "User" + }, + "dependsOn": [ + "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]" + ] + }, { "type": "Microsoft.CognitiveServices/accounts/projects", "apiVersion": "2025-04-01-preview", @@ -165,7 +184,8 @@ }, "properties": {}, "dependsOn": [ - "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]" + "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts/deployments', variables('aiFoundryName'), 'mistral-document-ai-2512')]" ] }, { @@ -253,7 +273,8 @@ }, "dependsOn": [ "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]", - "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]" + "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts/projects', variables('aiFoundryName'), variables('aiProjectName'))]" ] }, { @@ -311,7 +332,8 @@ "dependsOn": [ "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]", "[resourceId('Microsoft.CognitiveServices/accounts/projects', variables('aiFoundryName'), variables('aiProjectName'))]", - "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]" + "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts/connections', variables('aiFoundryName'), format('{0}-aisearch', variables('aiFoundryName')))]" ] }, { @@ -331,7 +353,8 @@ "dependsOn": [ "[resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName'))]", "[resourceId('Microsoft.CognitiveServices/accounts/projects', variables('aiFoundryName'), variables('aiProjectName'))]", - "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]" + "[resourceId('Microsoft.Search/searchServices', variables('searchServiceName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts/projects/connections', variables('aiFoundryName'), variables('aiProjectName'), format('{0}-policies-kb', variables('aiFoundryName')))]" ] } ], @@ -362,7 +385,7 @@ }, "aiFoundryProjectName": { "type": "string", - "value": "[variables('aiProjectName')]" + "value": "[variables('aiProjectName')]" }, "searchServiceEndpoint": { "type": "string", diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/derived/statements/crash1_front.intake.json b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/derived/statements/crash1_front.intake.json new file mode 100644 index 000000000..caa270cec --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/derived/statements/crash1_front.intake.json @@ -0,0 +1,62 @@ +{ + "status": "success", + "image_path": "C:\\Users\\martasantos\\OneDrive - Microsoft\\FY27\\claims-microhack\\data\\claims\\crash1\\raw\\statements\\crash1_front.jpeg", + "processed_at_utc": "2026-07-26T17:26:48.642677+00:00", + "ocr": { + "model": "mistral-document-ai-2512", + "text": "# ACCIDENT STATEMENT FORM\n\n## Policyholder Information\n\nName: John Peterson\nAddress: 1142 Pinecrest Avenue, Springfield, OH 45503\nPhone: (937) 555-2319\nEmail: john.peterson@email.com\nPolicy Number: LIAB-AUTO-001\nClaimant ID:\n\n## Vehicle Information\n\nYear/Make/Model: 2004 Honda Accord\nColor: Silver\nVIN: 1HGCH56404A123456\nLicense Plate: OH-GHR1984\n\n## Accident Information\n\nDate of Incident: July 17, 2025\nTime: 8:30 AM\nLocation: Parking Lot, 2325 Main Street, Springfield, OH 45503\n\n## Description of Incident\n\nOn the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "character_count": 1032, + "pages_processed": 1, + "document_annotation": { + "claimant_name": "John Peterson", + "claim_date": "07/17/2023", + "policy_number": "LIAB-AUTO-001", + "incident_description": "On the morning of July 17, 2023, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a grey pickup truck attempting to park beside my car struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "vehicle_info": { + "make": "Honda", + "model": "Accord", + "year": "2004", + "license_plate": "OH-GHR1984", + "vin": "1HGCM56404A123456" + }, + "damage_description": "Significant damage to the front end and driver's side of the vehicle.", + "estimated_damage_amount": null, + "witnesses": [], + "signature_present": null, + "date_signed": null + } + }, + "extracted_data": { + "claimant_name": "John Peterson", + "claim_date": "07/17/2023", + "policy_number": "LIAB-AUTO-001", + "incident_description": "On the morning of July 17, 2023, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a grey pickup truck attempting to park beside my car struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "vehicle_info": { + "make": "Honda", + "model": "Accord", + "year": "2004", + "license_plate": "OH-GHR1984", + "vin": "1HGCM56404A123456" + }, + "damage_description": "Significant damage to the front end and driver's side of the vehicle.", + "estimated_damage_amount": null, + "witnesses": [], + "signature_present": null, + "date_signed": null + }, + "foundry_iq": { + "index_name": "crash-statements", + "match_count": 1, + "matches": [ + { + "id": "crash1_front", + "content": "Claimant: John Peterson. Policy: C1A8-AU1D-001. Claim date: July 17, 2025. Vehicle: 2004 Honda Accord, VIN 1HGCM56404A123456, plate OH-GHR1984. Incident: On the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Rain Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and drive/side of my vehicle. The other car's driver failed to properly judge the distance and colluded with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.\nJohn Peterson\n", + "score": 3.2812333 + } + ] + }, + "foundry_agent": { + "name": "claims-intake-agent" + }, + "agent_summary": "The new OCR statement identifies claimant John Peterson and describes a silver 2004 Honda Accord that was parked at 2325 Main Street in Springfield, Ohio when a gray pickup truck struck its front end and driver\u2019s side around 8:30 AM on July 17, 2025. The retrieved crash statement is largely consistent with this OCR text, matching the claimant, date, vehicle, plate, and incident narrative, though it shows minor discrepancies such as \u201c2325 Rain Street\u201d instead of Main Street and a slightly different VIN/policy formatting\u30104:0\u2020source\u3011." +} \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_back.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_back.jpeg new file mode 100644 index 000000000..db176d501 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_back.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.intake.json b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.intake.json new file mode 100644 index 000000000..d98e241cb --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.intake.json @@ -0,0 +1,68 @@ +{ + "status": "success", + "image_path": "/workspaces/microhack/03-Azure/01-04-AI/05_Claims_Processing/data/claims/crash1/raw/statements/crash1_front.jpeg", + "processed_at_utc": "2026-09-03T09:08:22.998005+00:00", + "ocr": { + "model": "mistral-document-ai-2512", + "text": "# ACCIDENT STATEMENT FORM\n\n## Policyholder Information\n\nName: John Peterson\nAddress: 1142 Pinecrest Avenue, Springfield, OH 45503\nPhone: (937) 555-2319\nEmail: john.peterson@email.com\nPolicy Number: LIAB-AUTO-001\nClaimant ID:\n\n## Vehicle Information\n\nYear/Make/Model: 2004 Honda Accord\nColor: Silver\nVIN: 1HGCH56404A123456\nLicense Plate: OH-GHR1984\n\n## Accident Information\n\nDate of Incident: July 17, 2025\nTime: 8:30 AM\nLocation: Parking Lot, 2325 Main Street, Springfield, OH 45503\n\n## Description of Incident\n\nOn the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "character_count": 1032, + "pages_processed": 1, + "document_annotation": { + "claimant_name": "John Peterson", + "claim_date": "07/17/2025", + "policy_number": "LIAB-AUTO-001", + "incident_description": "On the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "vehicle_info": { + "make": "Honda", + "model": "Accord", + "year": "2004", + "license_plate": "OH-GHR1984", + "vin": "1HGCH56404A123456" + }, + "witnesses": [], + "signature_present": null, + "date_signed": null + } + }, + "extracted_data": { + "claimant_name": "John Peterson", + "claim_date": "07/17/2025", + "policy_number": "LIAB-AUTO-001", + "incident_description": "On the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.", + "vehicle_info": { + "make": "Honda", + "model": "Accord", + "year": "2004", + "license_plate": "OH-GHR1984", + "vin": "1HGCH56404A123456" + }, + "witnesses": [], + "signature_present": null, + "date_signed": null + }, + "foundry_iq": { + "index_name": "crash-statements", + "match_count": 3, + "matches": [ + { + "id": "crash1_front", + "content": "# ACCIDENT STATEMENT FORM\n\n## Policyholder Information\n\nName: John Peterson\nAddress: 1142 Pinecrest Avenue, Springfield, OH 45503\nPhone: (937) 555-2319\nEmail: john.peterson@email.com\nPolicy Number: LIAB-AUTO-001\nClaimant ID:\n\n## Vehicle Information\n\nYear/Make/Model: 2004 Honda Accord\nColor: Silver\nVIN: 1HGCH56404A123456\nLicense Plate: OH-GHR1984\n\n## Accident Information\n\nDate of Incident: July 17, 2025\nTime: 8:30 AM\nLocation: Parking Lot, 2325 Main Street, Springfield, OH 45503\n\n## Description of Incident\n\nOn the morning of July 17, 2025, my vehicle was legally parked in a market parking space at 2325 Main Street, Springfield. At approximately 8:30 AM, while I was inside a nearby store, I was notified by a witness that a gray pickup truck attempting to park beside my car, struck the front end and driver's side of my vehicle. The other car's driver failed to properly judge the distance and collided with my vehicle, causing significant damage. The other driver left their information and waited for the police to arrive.\ncrash1_front.jpeg\nJohn Peterson\nLIAB-AUTO-001\n", + "score": 11.60972 + }, + { + "id": "crash4_front", + "content": "# ACCIDENT STATEMENT FORM\n\n## Policyholder Information\n\nName: John Peterson\nAddress: 1142 Pinecrest Ave, Springfield, OH 45503\nPhone: (937) 555 2319\nEmail: andreatennett@email.com\nPolicy Number: COMM-AUTO-001\nClaimant ID:\n\n## Vehicle Information\n\nYear/Make/Model: 2011 Show Outback\nColor: Red\nVIN: 4S4BRBCC2B3378210\nLicense Plate: OH-CRV4413\n\n## Accident Information\n\nDate of Incident: July 19, 2025\nTime: 11:15 AM\nLocation: 6400 Westbrook Road, Dayton, OH 45415\nWeather Conditions: Clear, dry roads\n\n## Description of Incident\n\nOn July 19, 2025, at approximately 11:15 AM, I was driving my 2011 Show Outback westbound on Westbrook Road in Dayton, Ohio. While waiting in line with traffic for a stop sign, my vehicle was rear-ended by a blue sedan at moderate speed. The impact pushed my vehicle into the adjacent lane and forced my front end into the left lane's shoulder. The other driver remained at the scene and promptly called local authorities. A police report was filed.\ncrash4_front.jpeg\nJohn Peterson\nCOMM-AUTO-001\n", + "score": 5.774044 + }, + { + "id": "crash1_back", + "content": "Description of Damages\nFront bumper dislodged and partially detached; severe denting and scraping on the driver's side front quarter panel; wheel and tire on driver's side front damaged; paint tensifer and deformity on the driver's door; head lamp assembly and grille potentially damaged; possible niden damage to mechanical components behind the bumper\n\nWitness Information\nName: Melissa Grant\nPhone: (937) 555-8741\n\nPolice Report\nReport Number: 25-52814\nPolice Department: Springfield Police Department\n\nSignature\nSignature: John Peterson\nPrinted Name: John Peterson\nDate: July 20, 2025\ncrash1_back.jpeg\nJohn Peterson\n\n", + "score": 2.8624763 + } + ] + }, + "foundry_agent": { + "name": "claims-intake-agent" + }, + "agent_summary": "The OCR describes claimant John Peterson, policy LIAB-AUTO-001, with a silver 2004 Honda Accord that was legally parked at 2325 Main Street in Springfield, Ohio, when it was struck around 8:30 AM on July 17, 2025 by a gray pickup truck attempting to park beside it. The retrieved record is consistent with this statement and matches the claimant, vehicle, date, location, and collision description exactly\u30104:0\u2020source\u3011." +} \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.jpeg new file mode 100644 index 000000000..bdeb8e0e5 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/statements/crash1_front.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/vehicle-damage/crash1.jpg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/vehicle-damage/crash1.jpg new file mode 100644 index 000000000..ffb2539ba Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash1/raw/vehicle-damage/crash1.jpg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_back.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_back.jpeg new file mode 100644 index 000000000..d5545e12f Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_back.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_front.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_front.jpeg new file mode 100644 index 000000000..f20601313 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/statements/crash2_front.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/vehicle-damage/crash2.jpg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/vehicle-damage/crash2.jpg new file mode 100644 index 000000000..c5579c7f0 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash2/raw/vehicle-damage/crash2.jpg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_back.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_back.jpeg new file mode 100644 index 000000000..42e221bca Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_back.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_front.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_front.jpeg new file mode 100644 index 000000000..a18c39a28 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/statements/crash3_front.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/vehicle-damage/crash3.jpg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/vehicle-damage/crash3.jpg new file mode 100644 index 000000000..f6d78a942 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash3/raw/vehicle-damage/crash3.jpg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_back.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_back.jpeg new file mode 100644 index 000000000..4df59b613 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_back.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_front.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_front.jpeg new file mode 100644 index 000000000..db1495681 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/statements/crash4_front.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/vehicle-damage/crash4.jpg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/vehicle-damage/crash4.jpg new file mode 100644 index 000000000..a94e38e25 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash4/raw/vehicle-damage/crash4.jpg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_back.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_back.jpeg new file mode 100644 index 000000000..dea15d4a1 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_back.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_front.jpeg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_front.jpeg new file mode 100644 index 000000000..49acacd62 Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/statements/crash5_front.jpeg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/vehicle-damage/crash5.jpg b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/vehicle-damage/crash5.jpg new file mode 100644 index 000000000..4bb5de69e Binary files /dev/null and b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/claims/crash5/raw/vehicle-damage/crash5.jpg differ diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/commercial_auto_policy.md b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/commercial_auto_policy.md new file mode 100644 index 000000000..980dffbbd --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/commercial_auto_policy.md @@ -0,0 +1,265 @@ +# Commercial Auto Insurance Policy + +**Policy Type:** Commercial Auto Insurance +**Coverage Category:** Business Vehicle Coverage +**Policy Code:** COMM-AUTO-001 + +## Coverage Overview + +This commercial auto insurance policy provides comprehensive coverage for vehicles used in business operations. It includes liability, physical damage, medical payments, and specialized commercial coverages designed for business risks and exposures. + +## Covered Vehicles + +### Eligible Vehicle Types +- Company-owned cars, trucks, and vans +- Leased or financed business vehicles +- Employee-owned vehicles used for business (with proper endorsement) +- Rental vehicles used for business purposes +- Trailers and semi-trailers +- Specialized commercial vehicles (delivery trucks, service vehicles) + +### Business Use Classifications +- Service and repair operations +- Sales and delivery services +- Construction and contracting +- Transportation and logistics +- Professional services (real estate, consulting) +- Retail and wholesale operations + +## Coverage Components + +### Liability Coverage +- Bodily injury to third parties during business operations +- Property damage caused during business activities +- Legal defense costs for covered claims +- Higher limits available for commercial exposures +- Products and completed operations liability (when applicable) + +### Physical Damage Coverage + +#### Collision Coverage +- Damage from vehicle collisions during business use +- Single-vehicle accidents while on business +- Damage from loading and unloading operations +- Parking lot incidents at business locations + +#### Comprehensive Coverage +- Theft of vehicles or business equipment +- Vandalism to business vehicles +- Weather-related damage during business operations +- Fire damage to vehicles and cargo +- Glass breakage and windshield replacement + +### Medical Payments Coverage +- Medical expenses for employees injured in business vehicles +- Coverage for business guests and passengers +- Emergency medical treatment costs +- Ambulance and hospital expenses + +### Uninsured Motorist Coverage +- Protection against uninsured drivers during business operations +- Hit-and-run coverage for business vehicles +- Underinsured motorist protection +- Medical expenses and lost business income + +## Commercial-Specific Coverages + +### Hired and Non-Owned Auto Coverage +- Coverage for rental vehicles used for business +- Employee personal vehicles used for business purposes +- Temporary substitute vehicles +- Protection against gaps in coverage + +### Motor Carrier Coverage (if applicable) +- Interstate and intrastate transportation coverage +- Cargo insurance for transported goods +- Trailer interchange coverage +- Environmental restoration coverage + +### Garage Liability (for auto-related businesses) +- Coverage for auto dealerships and repair shops +- Customer vehicle protection while in care, custody, and control +- Garage keepers legal liability +- False pretense coverage + +## Coverage Limits + +### Standard Commercial Limits +- Bodily Injury Liability: $500,000 per person, $1,000,000 per accident +- Property Damage Liability: $500,000 per accident +- Medical Payments: $25,000 per person +- Uninsured Motorist: $500,000 per person, $1,000,000 per accident + +### Enhanced Limits Available +- Bodily Injury Liability: Up to $2,000,000 per person, $5,000,000 per accident +- Property Damage Liability: Up to $2,000,000 per accident +- Medical Payments: Up to $100,000 per person +- Physical Damage: Actual cash value or agreed value + +### Umbrella Coverage +- Additional liability protection up to $10,000,000 +- Excess coverage over primary commercial auto limits +- Broader coverage for commercial exposures + +## Deductibles + +### Standard Deductibles +- Collision: $1,000 per incident +- Comprehensive: $500 per incident +- Glass Coverage: $250 (zero deductible option available) + +### Available Options +- $500, $1,000, $2,500, $5,000 for physical damage +- Higher deductibles for fleet discounts +- Separate deductibles for different coverage types + +## Business Classifications and Rates + +### Low-Risk Classifications +- Professional services (office-based) +- Real estate and insurance sales +- Consulting and advisory services +- Light delivery services + +### Medium-Risk Classifications +- Retail and wholesale operations +- Service and repair businesses +- Construction and contracting (light) +- Food service and catering + +### High-Risk Classifications +- Heavy construction and excavation +- Hazardous material transportation +- Long-haul trucking operations +- Emergency services and towing + +## Fleet Management Features + +### Fleet Safety Programs +- Driver training and certification programs +- Vehicle maintenance tracking +- Safety incentive programs +- Accident prevention initiatives + +### Telematics and Monitoring +- GPS tracking and route optimization +- Driver behavior monitoring +- Fuel efficiency tracking +- Maintenance scheduling alerts + +### Risk Management Services +- Safety consultations and assessments +- Driver record monitoring +- Claims management assistance +- Loss control recommendations + +## Claims Process + +### Immediate Response +1. Ensure safety and call emergency services +2. Secure the business vehicle and any cargo +3. Document the incident thoroughly +4. Report to police if required +5. Contact the insurance company within 24 hours + +### Business-Specific Requirements +- Notify business management immediately +- Preserve evidence of business operations +- Document any business interruption +- Coordinate with business legal counsel if needed + +### Claims Investigation +- Specialized commercial claims adjusters +- Business interruption evaluation +- Equipment and cargo assessment +- Coordination with business operations + +## Exclusions + +### Standard Exclusions +- Personal use of business vehicles (unless covered) +- Racing or competitive events +- Intentional acts by employees +- Nuclear hazards and war risks +- Wear and tear or mechanical breakdown + +### Commercial-Specific Exclusions +- Pollution liability (requires separate coverage) +- Professional liability (requires separate coverage) +- Workers' compensation (covered under separate policy) +- Cyber liability for connected vehicles + +## Premium Factors + +### Business-Related Factors +- Type of business operations +- Geographic territory and routes +- Annual mileage and usage patterns +- Number of vehicles and drivers +- Claims history and loss experience +- Safety programs and risk management + +### Vehicle and Driver Factors +- Vehicle types, ages, and values +- Driver qualifications and training +- Motor vehicle records of all drivers +- Experience with commercial operations + +## Additional Benefits + +### Business Interruption Coverage +- Lost income due to covered vehicle damage +- Extra expenses to maintain operations +- Temporary transportation costs +- Customer notification expenses + +### Equipment Coverage +- Business equipment installed in vehicles +- Tools and supplies coverage +- Custom equipment and modifications +- Electronic equipment protection + +### Key Employee Coverage +- Additional protection for key business drivers +- Higher medical payment limits for executives +- Business travel coverage extensions + +## Policy Management + +### Certificate Requirements +- Certificates of insurance for contracts +- Additional insured endorsements +- Waiver of subrogation provisions +- Primary and non-contributory language + +### Policy Administration +- Online policy management portal +- Fleet addition and deletion procedures +- Driver addition and removal process +- Coverage change procedures + +### Compliance Management +- State registration requirements +- DOT compliance (for applicable vehicles) +- International travel provisions +- Regulatory reporting assistance + +## Risk Management Recommendations + +### Driver Management +- Comprehensive driver screening +- Regular motor vehicle record checks +- Ongoing driver training programs +- Clear company vehicle use policies + +### Vehicle Maintenance +- Regular preventive maintenance schedules +- Safety equipment inspections +- Tire and brake monitoring +- Emergency equipment requirements + +### Business Continuity +- Alternative transportation arrangements +- Backup vehicle availability +- Emergency response procedures +- Communication protocols for incidents \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/comprehensive_auto_policy.md b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/comprehensive_auto_policy.md new file mode 100644 index 000000000..c6a1914c5 --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/comprehensive_auto_policy.md @@ -0,0 +1,180 @@ +# Comprehensive Auto Insurance Policy + +**Policy Type:** Comprehensive Auto Insurance +**Coverage Category:** Full Coverage +**Policy Code:** COMP-AUTO-001 + +## Section 1: Coverage Overview + +This comprehensive auto insurance policy provides extensive protection for your vehicle and liability coverage for damages to others. The policy includes collision, comprehensive, liability, medical payments, and uninsured motorist coverage. + +## Section 2: Covered Perils + +### Section 2.1: Collision Coverage +- Damage from collisions with other vehicles +- Single-vehicle accidents (hitting trees, poles, guardrails) +- Rollover accidents +- Damage from hitting potholes or road debris + +### Section 2.2: Comprehensive Coverage +- Theft of the entire vehicle or parts +- Vandalism and malicious mischief +- Fire and explosion damage +- Weather-related damage (hail, flood, wind, lightning) +- Falling objects (trees, rocks, debris) +- Glass breakage (windshield, windows) +- Animal collisions (deer, birds, etc.) + +### Section 2.3: Liability Coverage +- Bodily injury to third parties +- Property damage to other vehicles or structures +- Legal defense costs +- Court-ordered judgments and settlements + +### Section 2.4: Medical Payments Coverage +- Medical expenses for driver and passengers +- Hospital and emergency room costs +- Rehabilitation and physical therapy +- Funeral expenses in case of fatalities + +### Section 2.5: Uninsured/Underinsured Motorist Coverage +- Protection when hit by uninsured drivers +- Coverage for hit-and-run accidents +- Protection against underinsured drivers +- Medical expenses and lost wages + +## Section 3: Coverage Limits + +### Section 3.1: Standard Limits +- Collision: $50,000 per incident +- Comprehensive: $50,000 per incident +- Bodily Injury Liability: $100,000 per person, $300,000 per accident +- Property Damage Liability: $100,000 per accident +- Medical Payments: $10,000 per person +- Uninsured Motorist: $100,000 per person, $300,000 per accident + +### Section 3.2: Premium Limits (Available) +- Collision: Up to $100,000 per incident +- Comprehensive: Up to $100,000 per incident +- Bodily Injury Liability: Up to $500,000 per person, $1,000,000 per accident +- Property Damage Liability: Up to $500,000 per accident +- Medical Payments: Up to $50,000 per person + +## Section 4: Deductibles + +### Section 4.1: Standard Deductibles +- Collision: $500 +- Comprehensive: $250 +- Glass Coverage: $100 (optional zero deductible available) + +### Section 4.2: Available Deductible Options +- $250, $500, $1,000, $2,500 for collision and comprehensive +- Higher deductibles result in lower premiums + +## Section 5: Exclusions + +### Section 5.1: General Exclusions +- Racing or competitive driving events +- Commercial use of personal vehicles +- Intentional damage by the policyholder +- Damage from nuclear hazards or war +- Wear and tear or mechanical breakdown +- Damage to custom equipment not declared + +### Section 5.2: Specific Exclusions +- Damage while driving under the influence +- Damage while vehicle is being used for illegal activities +- Damage to rental vehicles (unless specifically covered) +- Damage from earthquakes (requires separate coverage) + +## Section 6: Additional Benefits + +### Section 6.1: Rental Car Coverage +- Up to $30 per day for 30 days maximum +- Available while covered vehicle is being repaired +- Covers similar class of vehicle + +### Section 6.2: Roadside Assistance +- 24/7 towing service (up to 15 miles) +- Battery jump-start service +- Flat tire assistance +- Lockout service +- Emergency fuel delivery + +### Section 6.3: Gap Coverage (Optional) +- Covers difference between actual cash value and loan balance +- Available for financed or leased vehicles +- Protects against depreciation losses + +## Section 7: Claims Process + +### Section 7.1: Immediate Steps +1. Ensure safety and call emergency services if needed +2. Document the scene with photos and witness information +3. Contact police if required by law or if injuries occurred +4. Report the claim within 24 hours + +### Section 7.2: Required Documentation +- Police report (if applicable) +- Photos of damage and accident scene +- Contact information of all parties involved +- Insurance information of other drivers +- Medical records (for injury claims) + +### Section 7.3: Claim Settlement +- Actual cash value basis for comprehensive claims +- Repair cost basis for collision claims +- Right to choose repair facility +- Guaranteed repair quality for approved shops + +## Section 8: Premium Factors + +### Section 8.1: Rating Factors +- Driver age and experience +- Driving record and claims history +- Vehicle make, model, and year +- Geographic location and garaging address +- Annual mileage and usage patterns +- Credit score (where legally permitted) + +### Section 8.2: Discounts Available +- Multi-vehicle discount (up to 25%) +- Safe driver discount (up to 20%) +- Anti-theft device discount (up to 10%) +- Defensive driving course discount (up to 10%) +- Good student discount (up to 15%) +- Low mileage discount (up to 10%) + +## Section 9: Policy Terms + +### Section 9.1: Policy Period +- Standard 6-month or 12-month terms +- Automatic renewal unless cancelled +- 30-day notice required for cancellation + +### Section 9.2: Payment Options +- Monthly, quarterly, semi-annual, or annual payments +- Automatic payment discounts available +- Grace period of 10 days for late payments + +### Section 9.3: Coverage Territory +- United States and its territories +- Canada (for temporary visits up to 30 days) +- Mexico (requires additional coverage) + +## Section 10: Special Provisions + +### Section 10.1: New Vehicle Replacement +- Available for vehicles less than 2 years old +- Replaces with new vehicle of same make and model +- Requires comprehensive and collision coverage + +### Section 10.2: Original Equipment Manufacturer (OEM) Parts +- Available as optional coverage +- Ensures repairs use manufacturer parts +- May increase premium by 5-10% + +### Section 10.3: Diminished Value Coverage +- Available in select states +- Covers loss in vehicle value after major repairs +- Requires comprehensive evaluation \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/high_value_vehicle_policy.md b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/high_value_vehicle_policy.md new file mode 100644 index 000000000..1ed5ad447 --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/high_value_vehicle_policy.md @@ -0,0 +1,316 @@ +# High-Value Vehicle Insurance Policy + +**Policy Type:** High-Value Vehicle Insurance +**Coverage Category:** Luxury and Exotic Vehicle Coverage +**Policy Code:** HV-AUTO-001 + +## Coverage Overview + +This specialized high-value vehicle insurance policy provides comprehensive protection for luxury, exotic, classic, and high-performance vehicles. It includes agreed value coverage, specialized repair options, and enhanced services tailored to the unique needs of high-value vehicle owners. + +## Eligible Vehicles + +### Luxury Vehicles +- Premium sedans and SUVs (Mercedes S-Class, BMW 7 Series, Audi A8) +- Luxury sports cars (Porsche 911, Jaguar F-Type, Aston Martin) +- High-end electric vehicles (Tesla Model S Plaid, Lucid Air, BMW iX) +- Luxury trucks and SUVs over $75,000 value + +### Exotic and Supercar Vehicles +- Ferrari, Lamborghini, McLaren models +- Bugatti, Koenigsegg, Pagani supercars +- Limited production vehicles +- Custom-built and modified high-performance vehicles + +### Classic and Collector Vehicles +- Vintage automobiles (25+ years old) +- Restored classic cars +- Muscle cars and sports cars from the 1960s-1980s +- Rare and limited production vehicles + +### Custom and Modified Vehicles +- Professionally modified vehicles +- Show cars and concours vehicles +- Vehicles with significant aftermarket modifications +- One-off custom builds + +## Coverage Features + +### Agreed Value Coverage +- Pre-agreed vehicle value with no depreciation +- Professional appraisal-based valuations +- Annual value updates and adjustments +- Guaranteed replacement at agreed value +- No actual cash value disputes + +### Specialized Repair Coverage +- Authorized dealer repair facilities +- Certified technician requirements +- Original Equipment Manufacturer (OEM) parts guarantee +- Custom fabrication for unavailable parts +- Paint matching and finish quality guarantees + +### Enhanced Comprehensive Coverage +- Theft protection with GPS tracking requirements +- Vandalism and malicious mischief coverage +- Weather damage protection (hail, flood, wind) +- Fire and explosion coverage +- Falling object protection +- Animal collision coverage with full repair guarantee + +### Collision Coverage Enhancements +- Track day coverage (with proper endorsement) +- Driving event and rally coverage +- Valet parking protection +- Transportation and shipping coverage +- Loading and unloading protection + +## Specialized Services + +### Concierge Claims Service +- Dedicated high-value claims specialists +- 24/7 claims reporting and support +- Expedited claims processing +- Direct payment to repair facilities +- Personal claims advocate assignment + +### Transportation and Storage +- Enclosed trailer transportation +- Climate-controlled storage facilities +- Secure storage during repairs +- Loaner vehicle programs (comparable class) +- International shipping coverage + +### Appraisal and Valuation Services +- Annual professional appraisals +- Market value tracking and updates +- Documentation and photography services +- Condition reports and maintenance records +- Authenticity verification for classics + +### Risk Management Services +- Security system recommendations +- Storage facility assessments +- Driving event safety requirements +- Maintenance program guidance +- Loss prevention consultations + +## Coverage Limits and Options + +### Standard High-Value Limits +- Agreed Value: Up to $500,000 per vehicle +- Liability: $1,000,000 per person, $2,000,000 per accident +- Property Damage: $1,000,000 per accident +- Medical Payments: $50,000 per person +- Uninsured Motorist: $1,000,000 per person, $2,000,000 per accident + +### Ultra-High-Value Options +- Agreed Value: Up to $5,000,000 per vehicle +- Liability: Up to $5,000,000 per person, $10,000,000 per accident +- Umbrella coverage available up to $25,000,000 +- Worldwide coverage territory +- Racing and track event coverage + +### Deductible Options +- Comprehensive: $0, $1,000, $2,500, $5,000 +- Collision: $0, $1,000, $2,500, $5,000, $10,000 +- Disappearing deductible programs available +- Separate deductibles for different coverage types + +## Specialized Endorsements + +### Track Day and Racing Coverage +- Organized track events and driving schools +- Time trials and autocross events +- Rally and touring events +- Professional racing (with restrictions) +- Driver training and certification programs + +### Show and Exhibition Coverage +- Car shows and concours events +- Museum displays and exhibitions +- Photography and filming coverage +- Transportation to and from events +- Setup and display protection + +### International Coverage +- Worldwide territory coverage +- Temporary importation coverage +- International rally and touring events +- Shipping and customs protection +- Foreign repair facility network + +### Spare Parts and Accessories Coverage +- Rare and hard-to-find parts inventory +- Custom fabrication coverage +- Aftermarket performance parts +- Tools and equipment coverage +- Memorabilia and documentation + +## Underwriting Requirements + +### Vehicle Documentation +- Professional appraisal (required for vehicles over $100,000) +- Detailed photographs and condition reports +- Maintenance records and service history +- Modification documentation and receipts +- Authenticity certificates for classics + +### Security Requirements +- Approved alarm and tracking systems +- Secure garage storage requirements +- Key management protocols +- Immobilizer and anti-theft devices +- GPS tracking for vehicles over $250,000 + +### Driver Qualifications +- Clean driving record requirements +- Age and experience minimums +- Defensive driving course completion +- Track day safety training (if applicable) +- Regular motor vehicle record monitoring + +### Usage Restrictions +- Annual mileage limitations (typically 2,500-7,500 miles) +- Pleasure use only (no business use) +- Show and exhibition use permitted +- Track day use with proper endorsement +- Storage requirements during winter months + +## Claims Process + +### Immediate Response +1. Ensure safety and secure the vehicle +2. Contact law enforcement if required +3. Document the scene thoroughly with photos +4. Contact the dedicated claims hotline immediately +5. Do not authorize any repairs without approval + +### Specialized Investigation +- Expert adjusters with high-value vehicle experience +- Professional appraisers for damage assessment +- Forensic investigation for theft claims +- Coordination with law enforcement +- International investigation capabilities + +### Repair Process +- Pre-approved repair facility network +- Certified technician requirements +- OEM parts sourcing and verification +- Quality control inspections +- Completion guarantees and warranties + +### Total Loss Procedures +- Agreed value payment guarantee +- Salvage retention options +- Title transfer assistance +- Tax and registration guidance +- Replacement vehicle assistance + +## Premium Factors + +### Vehicle-Related Factors +- Agreed value and replacement cost +- Vehicle make, model, and year +- Rarity and collectibility +- Modification level and cost +- Security and anti-theft features + +### Usage and Storage Factors +- Annual mileage limitations +- Storage facility security +- Geographic location and territory +- Driving events and track usage +- Show and exhibition participation + +### Owner-Related Factors +- Driving record and experience +- Age and claims history +- Other high-value vehicles owned +- Collector car club memberships +- Professional affiliations + +## Additional Benefits + +### Roadside Assistance Premium +- 24/7 concierge roadside service +- Flatbed towing to approved facilities +- Battery service and tire changes +- Lockout service with key replacement +- Emergency fuel delivery + +### Diminished Value Coverage +- Automatic coverage for vehicles under 5 years old +- Professional diminished value appraisals +- Market value impact assessments +- Resale value protection +- Collector market considerations + +### Key and Lock Replacement +- Sophisticated key and fob replacement +- Reprogramming and coding services +- Lock cylinder replacement +- Security system reprogramming +- Valet key management + +## Policy Management + +### Annual Reviews +- Value updates and adjustments +- Coverage limit evaluations +- Usage pattern assessments +- Security requirement updates +- Market condition considerations + +### Collection Management +- Multi-vehicle portfolio discounts +- Blanket coverage options +- Scheduled item additions +- Coverage coordination +- Risk management consulting + +### Documentation Services +- Digital policy management +- Photo and document storage +- Appraisal tracking and updates +- Maintenance record keeping +- Claims history documentation + +## Exclusions and Limitations + +### Standard Exclusions +- Commercial use or business activities +- Racing (unless specifically covered) +- Intentional damage or criminal acts +- War, nuclear hazards, and terrorism +- Wear and tear or mechanical breakdown + +### High-Value Specific Exclusions +- Modifications without prior approval +- Unapproved repair facilities +- Exceeding agreed mileage limits +- Improper storage or security +- Undisclosed usage patterns + +## Risk Management Recommendations + +### Security Best Practices +- Multi-layered security systems +- Secure storage facility selection +- Key management protocols +- Regular security assessments +- Insurance company partnerships + +### Maintenance and Care +- Professional maintenance programs +- Climate-controlled storage +- Regular exercise and operation +- Proper preparation for storage +- Documentation of all services + +### Value Protection +- Regular appraisal updates +- Market monitoring and analysis +- Proper documentation maintenance +- Professional restoration guidance +- Investment protection strategies \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/liability_only_policy.md b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/liability_only_policy.md new file mode 100644 index 000000000..9aff348af --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/liability_only_policy.md @@ -0,0 +1,181 @@ +# Liability Only Auto Insurance Policy + +**Policy Type:** Liability Only Auto Insurance +**Coverage Category:** Minimum Coverage +**Policy Code:** LIAB-AUTO-001 + +## Section 1: Coverage Overview + +This liability-only auto insurance policy provides the minimum required coverage to legally drive in most states. It covers damages and injuries you cause to others but does not cover damage to your own vehicle or injuries to yourself. + +## Section 2: Covered Perils + +### Section 2.1: Bodily Injury Liability +- Medical expenses for injured third parties +- Lost wages of injured parties +- Pain and suffering compensation +- Rehabilitation costs for injured parties +- Legal defense costs for covered claims +- Court-ordered judgments and settlements + +### Section 2.2: Property Damage Liability +- Damage to other vehicles in accidents you cause +- Damage to buildings, fences, or other structures +- Damage to personal property of others +- Temporary transportation costs for damaged parties +- Legal defense for property damage claims + +## Section 3: Coverage Limits + +### Section 3.1: State Minimum Limits +- Bodily Injury Liability: $25,000 per person, $50,000 per accident +- Property Damage Liability: $25,000 per accident + +### Section 3.2: Recommended Enhanced Limits +- Bodily Injury Liability: $50,000 per person, $100,000 per accident +- Property Damage Liability: $50,000 per accident + +### Section 3.3: Maximum Available Limits +- Bodily Injury Liability: $500,000 per person, $1,000,000 per accident +- Property Damage Liability: $500,000 per accident + +## Section 4: What's NOT Covered + +### Section 4.1: Your Vehicle +- Collision damage to your vehicle +- Comprehensive damage (theft, vandalism, weather) +- Mechanical breakdown or wear and tear +- Custom equipment or modifications + +### Section 4.2: Your Injuries +- Medical expenses for you or your passengers +- Lost wages due to your injuries +- Pain and suffering compensation for you +- Rehabilitation costs for your injuries + +### Section 4.3: Additional Exclusions +- Damage while racing or in competitions +- Intentional damage caused by you +- Damage while using vehicle for business purposes +- Damage while driving under the influence +- Damage from nuclear hazards or war + +## Section 5: Claims Process + +### Section 5.1: At the Scene +1. Ensure everyone's safety and call emergency services +2. Do not admit fault or discuss details extensively +3. Exchange insurance and contact information +4. Document the scene with photos if safe to do so +5. Get witness contact information if available + +### Section 5.2: Reporting Requirements +- Report claims within 24 hours of the incident +- Provide accurate and complete information +- Cooperate with the investigation process +- Attend depositions or court proceedings if required + +### Section 5.3: Investigation Process +- Insurance company will investigate the claim +- Determination of fault and liability +- Negotiation with injured parties or their representatives +- Settlement or court proceedings if necessary + +## Section 6: Premium Factors + +### Section 6.1: Primary Rating Factors +- Driving record and violation history +- Claims history and at-fault accidents +- Age and driving experience +- Geographic location and crime rates +- Vehicle make, model, and year +- Annual mileage and usage + +### Section 6.2: Available Discounts +- Safe driver discount (no violations for 3+ years) +- Defensive driving course completion +- Multi-policy discount (bundling with other insurance) +- Automatic payment discount +- Good student discount (for young drivers) + +## Section 7: Policy Limitations + +### Section 7.1: Coverage Territory +- United States and its territories +- Canada (for visits up to 30 days) +- Does not cover international travel + +### Section 7.2: Time Limitations +- Claims must be reported promptly +- Statute of limitations varies by state +- Cooperation required throughout claim process + +### Section 7.3: Financial Responsibility +- You are responsible for damages exceeding policy limits +- No coverage for your own vehicle repairs +- No medical coverage for your injuries +- Consider umbrella policy for additional protection + +## Section 8: Legal Requirements + +### Section 8.1: State Compliance +- Meets minimum state requirements for liability coverage +- Proof of insurance required at all times +- Penalties for driving without insurance include fines and license suspension + +### Section 8.2: Financial Responsibility Laws +- You remain liable for damages exceeding policy limits +- Consider higher limits to protect personal assets +- Umbrella policies available for additional protection + +## Section 9: Policy Terms and Conditions + +### Section 9.1: Policy Period +- Standard 6-month terms with automatic renewal +- 30-day notice required for cancellation by company +- 10-day notice for non-payment cancellation + +### Section 9.2: Premium Payment +- Monthly, quarterly, or semi-annual payment options +- Grace period of 10 days for late payments +- Automatic payment discounts available + +### Section 9.3: Policy Changes +- Coverage can be increased at any time +- Decreases may require waiting period +- Vehicle changes must be reported within 30 days + +## Section 10: Recommendations + +### Section 10.1: Consider Additional Coverage +- Collision coverage for vehicle damage protection +- Comprehensive coverage for theft and weather damage +- Medical payments coverage for injury protection +- Uninsured motorist coverage for protection against uninsured drivers + +### Section 10.2: Higher Liability Limits +- Consider increasing limits to protect personal assets +- Legal costs can exceed minimum coverage quickly +- Medical expenses continue to rise annually + +### Section 10.3: Emergency Fund +- Maintain emergency fund for vehicle repairs +- Consider the cost of replacing your vehicle +- Budget for potential out-of-pocket medical expenses + +## Section 11: Important Notes + +### Section 11.1: Risk Awareness +- You bear full financial risk for your own vehicle and injuries +- Consider your ability to pay for major repairs or replacement +- Evaluate your personal asset protection needs + +### Section 11.2: Regular Review +- Review coverage annually or when circumstances change +- Consider upgrading as financial situation improves +- Evaluate after major life events (marriage, home purchase, etc.) + +### Section 11.3: State Variations +- Requirements vary by state +- Some states require additional coverage types +- Consult with agent about specific state requirements \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/motorcycle_policy.md b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/motorcycle_policy.md new file mode 100644 index 000000000..5007c312e --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/data/policies/motorcycle_policy.md @@ -0,0 +1,328 @@ +# Motorcycle Insurance Policy + +**Policy Type:** Motorcycle Insurance +**Coverage Category:** Two-Wheel Vehicle Coverage +**Policy Code:** MOTO-001 + +## Section 1: Coverage Overview + +This motorcycle insurance policy provides comprehensive protection specifically designed for motorcycles, scooters, and other two-wheel vehicles. It includes specialized coverages that address the unique risks and needs of motorcycle riders. + +## Section 2: Covered Vehicles + +### Section 2.1: Eligible Motorcycle Types +- Street motorcycles (cruisers, sport bikes, touring bikes) +- Scooters and mopeds (50cc and above) +- Dirt bikes and off-road motorcycles +- Three-wheel motorcycles (trikes) +- Electric motorcycles and e-bikes +- Vintage and classic motorcycles + +### Section 2.2: Engine Size Classifications +- Small displacement (50cc-250cc) +- Medium displacement (251cc-600cc) +- Large displacement (601cc-1000cc) +- High-performance (1000cc+) +- Electric motorcycles (by power rating) + +## Section 3: Coverage Components + +### Section 3.1: Liability Coverage +- Bodily injury to other parties +- Property damage to other vehicles and property +- Legal defense costs for covered claims +- Medical expenses for injured parties +- Lost wages and pain and suffering compensation + +### Section 3.2: Physical Damage Coverage + +#### Section 3.2.1: Collision Coverage +- Damage from collisions with vehicles or objects +- Single-vehicle accidents and tip-overs +- Damage from road hazards and debris +- Parking lot incidents and falls + +#### Section 3.2.2: Comprehensive Coverage +- Theft of motorcycle or parts/accessories +- Vandalism and malicious damage +- Fire and explosion damage +- Weather damage (hail, flood, wind, lightning) +- Falling objects and debris +- Animal collisions + +### Section 3.3: Medical Payments Coverage +- Medical expenses for rider and passenger +- Emergency room and hospital costs +- Ambulance transportation +- Rehabilitation and physical therapy +- Dental and vision care related to accidents + +### Section 3.4: Uninsured/Underinsured Motorist Coverage +- Protection against uninsured drivers +- Hit-and-run accident coverage +- Underinsured motorist protection +- Medical expenses and lost income +- Property damage coverage + +## Section 4: Motorcycle-Specific Coverages + +### Section 4.1: Custom Parts and Equipment Coverage +- Aftermarket parts and accessories +- Custom paint and graphics +- Performance modifications +- Chrome and decorative accessories +- Sound systems and electronics +- Saddlebags, windshields, and touring equipment + +### Section 4.2: Roadside Assistance for Motorcycles +- Specialized motorcycle towing services +- Battery jump-start and charging +- Flat tire repair and replacement +- Fuel delivery service +- Lockout assistance +- Trip interruption coverage + +### Section 4.3: Riding Gear Coverage +- Helmets and protective headgear +- Leather jackets and protective clothing +- Gloves, boots, and protective gear +- Rain gear and weather protection +- Safety equipment replacement + +### Section 4.4: Trailer Coverage +- Motorcycle trailers and haulers +- Loading and unloading protection +- Trailer theft and damage coverage +- Tie-down and securing equipment + +## Section 5: Coverage Limits + +### Section 5.1: Standard Limits +- Bodily Injury Liability: $50,000 per person, $100,000 per accident +- Property Damage Liability: $50,000 per accident +- Medical Payments: $5,000 per person +- Uninsured Motorist: $50,000 per person, $100,000 per accident +- Custom Parts and Equipment: $3,000 + +### Section 5.2: Enhanced Limits Available +- Bodily Injury Liability: Up to $500,000 per person, $1,000,000 per accident +- Property Damage Liability: Up to $500,000 per accident +- Medical Payments: Up to $25,000 per person +- Custom Parts and Equipment: Up to $30,000 + +### Section 5.3: Deductibles +- Collision: $250, $500, $1,000 +- Comprehensive: $100, $250, $500 +- Custom Equipment: $250, $500 + +## Specialized Endorsements + +### Track Day Coverage +- Organized track events and racing schools +- Drag racing and time trials +- Motorcycle safety courses +- Professional instruction coverage +- Equipment protection during events + +### Off-Road Coverage +- Dirt bike and trail riding +- Motocross and enduro events +- Desert and mountain riding +- Private property riding +- Competition and racing events + +### Touring and Travel Coverage +- Extended trip protection +- Out-of-state coverage enhancement +- International travel (Canada/Mexico) +- Camping and touring equipment +- Emergency transportation home + +### Antique and Classic Motorcycle Coverage +- Agreed value coverage for classics +- Show and exhibition coverage +- Restoration coverage during repairs +- Spare parts and memorabilia +- Limited mileage discounts + +## Risk Factors and Pricing + +### Rider-Related Factors +- Age and riding experience +- Motorcycle safety course completion +- Driving/riding record +- Claims history +- Type of motorcycle license + +### Motorcycle-Related Factors +- Engine size and power +- Motorcycle type and style +- Age and value of motorcycle +- Safety features and anti-theft devices +- Custom modifications and accessories + +### Usage Factors +- Annual mileage +- Primary use (pleasure, commuting, business) +- Storage location and security +- Seasonal vs. year-round riding +- Group riding and club membership + +## Safety Requirements and Discounts + +### Safety Course Discounts +- Motorcycle Safety Foundation (MSF) courses +- Experienced Rider Course (ERC) completion +- Advanced riding technique courses +- Defensive riding course completion +- Annual safety training updates + +### Safety Equipment Discounts +- DOT-approved helmet usage +- Reflective or high-visibility gear +- Anti-lock braking systems (ABS) +- Anti-theft devices and alarms +- GPS tracking systems + +### Multi-Policy Discounts +- Bundling with auto insurance +- Homeowners insurance combination +- Multiple motorcycle discounts +- Loyalty and renewal discounts + +## Claims Process + +### Accident Response +1. Ensure safety and seek medical attention +2. Move to safety if possible +3. Call police if required or if injuries occurred +4. Document the scene with photos +5. Exchange information with other parties +6. Contact insurance company within 24 hours + +### Motorcycle-Specific Considerations +- Specialized motorcycle adjusters +- Understanding of motorcycle mechanics +- Custom parts valuation expertise +- Riding gear assessment and replacement +- Motorcycle-specific repair facilities + +### Theft Claims +- Police report required immediately +- Provide all keys and documentation +- Anti-theft device verification +- Custom parts and accessories inventory +- Recovery and salvage procedures + +## Exclusions + +### Standard Exclusions +- Racing and competitive events (unless covered) +- Commercial use or delivery services +- Intentional damage or criminal acts +- War, nuclear hazards, and terrorism +- Normal wear and tear + +### Motorcycle-Specific Exclusions +- Riding without proper license +- Riding under the influence of alcohol/drugs +- Stunting and reckless riding +- Modifications that increase risk +- Off-road riding (unless specifically covered) + +## Additional Benefits + +### Replacement Cost Coverage +- New motorcycle replacement (first two years) +- Custom parts replacement cost +- Riding gear replacement cost +- No depreciation on covered items + +### Trip Interruption Coverage +- Lodging expenses during breakdowns +- Transportation costs to continue trip +- Meal and incidental expenses +- Return transportation costs + +### Accessory Coverage Enhancements +- Blanket coverage for all accessories +- Newly acquired accessory coverage +- Professional installation coverage +- Warranty protection for modifications + +## Seasonal Considerations + +### Winter Storage Discounts +- Comprehensive-only coverage during storage +- Reduced premiums for seasonal riders +- Storage facility requirements +- Proper winterization procedures + +### Year-Round Riding +- All-weather riding considerations +- Increased medical coverage recommendations +- Enhanced safety equipment requirements +- Weather-related claim considerations + +## Special Programs + +### New Rider Programs +- Graduated coverage options +- Safety course requirements +- Mentorship program partnerships +- Reduced rates for course completion + +### Experienced Rider Benefits +- Loyalty discounts for long-term riders +- Advanced rider course credits +- Club and organization partnerships +- Vintage and classic motorcycle expertise + +### Group and Club Coverage +- Motorcycle club group rates +- Event and rally coverage +- Group riding protection +- Club-sponsored safety programs + +## Policy Management + +### Coverage Reviews +- Annual coverage assessments +- Motorcycle value updates +- Accessory and modification reporting +- Usage pattern evaluations + +### Digital Services +- Mobile app for policy management +- Digital insurance cards +- Claims reporting and tracking +- Roadside assistance requests + +### Customer Support +- Motorcycle-knowledgeable representatives +- Specialized claims adjusters +- Riding safety resources +- Maintenance and care guidance + +## Risk Management Recommendations + +### Rider Safety +- Continuous education and training +- Proper protective equipment usage +- Defensive riding techniques +- Weather and road condition awareness +- Regular skill assessment and improvement + +### Motorcycle Maintenance +- Regular inspection and maintenance +- Tire condition and pressure monitoring +- Brake system maintenance +- Lighting and visibility equipment +- Security and anti-theft measures + +### Storage and Security +- Secure storage recommendations +- Anti-theft device installation +- Insurance-approved storage facilities +- Proper seasonal storage procedures +- Documentation and inventory maintenance \ No newline at end of file diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/deploy-lab.ps1 b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/deploy-lab.ps1 index f86b7d8aa..8e6419611 100644 --- a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/deploy-lab.ps1 +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/deploy-lab.ps1 @@ -140,8 +140,10 @@ if (-not (Test-Path $templateFile)) { # Deploy resources. Write-Host "Deploying infrastructure resources..." -ForegroundColor Yellow +$deploymentName = [System.IO.Path]::GetFileNameWithoutExtension($templateFile) try { $deploymentParameters = @{ + Name = $deploymentName ResourceGroupName = $effectiveResourceGroup TemplateFile = $templateFile location = $effectiveLocation @@ -156,7 +158,28 @@ try { Write-Host "Deployment succeeded." -ForegroundColor Green } catch { - Write-Host "[ERROR] Deployment failed: $_" -ForegroundColor Red + $deploymentError = $_ + Write-Host "[ERROR] Deployment failed: $deploymentError" -ForegroundColor Red + + try { + $failedOperations = @( + Get-AzResourceGroupDeploymentOperation ` + -ResourceGroupName $effectiveResourceGroup ` + -DeploymentName $deploymentName ` + -ErrorAction Stop | + Where-Object { $_.ProvisioningState -eq 'Failed' } + ) + + foreach ($failedOperation in $failedOperations) { + $target = $failedOperation.TargetResource + Write-Host "[ERROR] Failed resource: $($target.ResourceType)/$($target.ResourceName)" -ForegroundColor Red + Write-Host ($failedOperation.StatusMessage | ConvertTo-Json -Depth 20) -ForegroundColor Red + } + } + catch { + Write-Host "[WARN] Could not retrieve failed deployment operations: $_" -ForegroundColor Yellow + } + exit 1 } diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.ps1 b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.ps1 new file mode 100644 index 000000000..bc9b14092 --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.ps1 @@ -0,0 +1,104 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: MIT + +param( + [Parameter(Mandatory = $true)] + [string]$SubscriptionId, + + [Parameter(Mandatory = $true)] + [string]$ResourceGroupName, + + [string]$StorageAccountName = "", + + [string]$ClaimsContainerName = "claims-data", + + [string]$PoliciesContainerName = "policies" +) + +$ErrorActionPreference = 'Stop' +$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$claimsDataRoot = Join-Path $scriptPath "data/claims" +$policiesDataRoot = Join-Path $scriptPath "data/policies" + +if (-not (Test-Path -Path $claimsDataRoot -PathType Container)) { + throw "Claim data folder not found at $claimsDataRoot" +} +if (-not (Test-Path -Path $policiesDataRoot -PathType Container)) { + throw "Policy data folder not found at $policiesDataRoot" +} + +$claimFiles = @(Get-ChildItem -Path $claimsDataRoot -Recurse -File) +$policyFiles = @(Get-ChildItem -Path $policiesDataRoot -File -Filter '*.md') +if ($claimFiles.Count -eq 0) { + throw "No claim data files found at $claimsDataRoot" +} +if ($policyFiles.Count -eq 0) { + throw "No policy documents found at $policiesDataRoot" +} + +$currentContext = Get-AzContext +if (-not $currentContext -or -not $currentContext.Subscription -or $currentContext.Subscription.Id -ne $SubscriptionId) { + Set-AzContext -SubscriptionId $SubscriptionId | Out-Null +} + +if ([string]::IsNullOrWhiteSpace($StorageAccountName)) { + $storageAccounts = @(Get-AzStorageAccount -ResourceGroupName $ResourceGroupName) + if ($storageAccounts.Count -ne 1) { + throw "Expected one storage account in resource group '$ResourceGroupName', found $($storageAccounts.Count). Pass -StorageAccountName explicitly." + } + $StorageAccountName = $storageAccounts[0].StorageAccountName +} + +$storageAccountKey = (Get-AzStorageAccountKey ` + -ResourceGroupName $ResourceGroupName ` + -Name $StorageAccountName)[0].Value +$storageContext = New-AzStorageContext ` + -StorageAccountName $StorageAccountName ` + -StorageAccountKey $storageAccountKey + +Write-Host "Uploading $($claimFiles.Count) claim data file(s) to '$ClaimsContainerName'..." -ForegroundColor Yellow +$expectedClaimBlobs = @() +foreach ($file in $claimFiles) { + $blobName = $file.FullName.Substring($claimsDataRoot.Length + 1) -replace '\\', '/' + Set-AzStorageBlobContent ` + -Context $storageContext ` + -Container $ClaimsContainerName ` + -Blob $blobName ` + -File $file.FullName ` + -Force | Out-Null + $expectedClaimBlobs += $blobName + Write-Host " - Uploaded $blobName" -ForegroundColor Green +} + +Write-Host "Uploading $($policyFiles.Count) policy document(s) to '$PoliciesContainerName'..." -ForegroundColor Yellow +$expectedPolicyBlobs = @() +foreach ($file in $policyFiles) { + Set-AzStorageBlobContent ` + -Context $storageContext ` + -Container $PoliciesContainerName ` + -Blob $file.Name ` + -File $file.FullName ` + -Force | Out-Null + $expectedPolicyBlobs += $file.Name + Write-Host " - Uploaded $($file.Name)" -ForegroundColor Green +} + +$actualClaimBlobs = @( + Get-AzStorageBlob -Context $storageContext -Container $ClaimsContainerName | + ForEach-Object { $_.Name } +) +$actualPolicyBlobs = @( + Get-AzStorageBlob -Context $storageContext -Container $PoliciesContainerName | + ForEach-Object { $_.Name } +) +$missingClaimBlobs = @($expectedClaimBlobs | Where-Object { $_ -notin $actualClaimBlobs }) +$missingPolicyBlobs = @($expectedPolicyBlobs | Where-Object { $_ -notin $actualPolicyBlobs }) + +if ($missingClaimBlobs.Count -gt 0 -or $missingPolicyBlobs.Count -gt 0) { + throw "Upload verification failed. Missing claim blobs: $($missingClaimBlobs.Count); missing policy blobs: $($missingPolicyBlobs.Count)." +} + +Write-Host "Asset upload complete and verified." -ForegroundColor Green +Write-Host " Storage account: $StorageAccountName" +Write-Host " Claim assets verified: $($expectedClaimBlobs.Count)" +Write-Host " Policy assets verified: $($expectedPolicyBlobs.Count)" diff --git a/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.sh b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.sh new file mode 100755 index 000000000..5a09828bc --- /dev/null +++ b/03-Azure/01-04-AI/05_Claims_Processing/labautomation/upload-assets.sh @@ -0,0 +1,182 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'EOF' +Usage: upload-assets.sh --subscription ID --resource-group NAME [options] + +Options: + --storage-account NAME Storage account to use (auto-detected by default) + --claims-container NAME Claims container (default: claims-data) + --policies-container NAME Policies container (default: policies) + -h, --help Show this help +EOF +} + +subscription_id="" +resource_group="" +storage_account="" +claims_container="claims-data" +policies_container="policies" + +while [[ $# -gt 0 ]]; do + case "$1" in + --subscription) + subscription_id="${2:-}" + shift 2 + ;; + --resource-group) + resource_group="${2:-}" + shift 2 + ;; + --storage-account) + storage_account="${2:-}" + shift 2 + ;; + --claims-container) + claims_container="${2:-}" + shift 2 + ;; + --policies-container) + policies_container="${2:-}" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unknown argument: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +trim_whitespace() { + local value="$1" + value="${value#"${value%%[![:space:]]*}"}" + value="${value%"${value##*[![:space:]]}"}" + printf '%s' "$value" +} + +subscription_id="$(trim_whitespace "$subscription_id")" +resource_group="$(trim_whitespace "$resource_group")" +storage_account="$(trim_whitespace "$storage_account")" +claims_container="$(trim_whitespace "$claims_container")" +policies_container="$(trim_whitespace "$policies_container")" + +if [[ -z "$subscription_id" || -z "$resource_group" ]]; then + usage >&2 + exit 2 +fi + +script_path=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +claims_root="$script_path/data/claims" +policies_root="$script_path/data/policies" + +if [[ ! -d "$claims_root" ]]; then + echo "Claim data folder not found: $claims_root" >&2 + exit 1 +fi +if [[ ! -d "$policies_root" ]]; then + echo "Policy data folder not found: $policies_root" >&2 + exit 1 +fi + +mapfile -d '' claim_files < <(find "$claims_root" -type f -print0) +mapfile -d '' policy_files < <(find "$policies_root" -maxdepth 1 -type f -name '*.md' -print0) +if [[ ${#claim_files[@]} -eq 0 || ${#policy_files[@]} -eq 0 ]]; then + echo "No upload assets found." >&2 + exit 1 +fi + +az account set --subscription "$subscription_id" +az group show --name "$resource_group" --output none + +if [[ -z "$storage_account" ]]; then + mapfile -t storage_accounts < <( + az storage account list \ + --resource-group "$resource_group" \ + --query '[].name' \ + --output tsv + ) + if [[ ${#storage_accounts[@]} -ne 1 ]]; then + echo "Expected one storage account in '$resource_group', found ${#storage_accounts[@]}. Pass --storage-account." >&2 + exit 1 + fi + storage_account="${storage_accounts[0]}" +fi + +storage_key=$(az storage account keys list \ + --resource-group "$resource_group" \ + --account-name "$storage_account" \ + --query '[0].value' \ + --output tsv) + +if [[ -z "$storage_key" ]]; then + echo "Could not retrieve a key for storage account '$storage_account'." >&2 + exit 1 +fi + +printf "Uploading %d claim assets to %s/%s...\n" \ + "${#claim_files[@]}" "$storage_account" "$claims_container" +az storage blob upload-batch \ + --account-name "$storage_account" \ + --account-key "$storage_key" \ + --destination "$claims_container" \ + --source "$claims_root" \ + --overwrite \ + --output none + +printf "Uploading %d policy assets to %s/%s...\n" \ + "${#policy_files[@]}" "$storage_account" "$policies_container" +az storage blob upload-batch \ + --account-name "$storage_account" \ + --account-key "$storage_key" \ + --destination "$policies_container" \ + --source "$policies_root" \ + --pattern '*.md' \ + --overwrite \ + --output none + +mapfile -t actual_claim_blobs < <( + az storage blob list \ + --account-name "$storage_account" \ + --account-key "$storage_key" \ + --container-name "$claims_container" \ + --query '[].name' \ + --output tsv +) +mapfile -t actual_policy_blobs < <( + az storage blob list \ + --account-name "$storage_account" \ + --account-key "$storage_key" \ + --container-name "$policies_container" \ + --query '[].name' \ + --output tsv +) + +missing=0 +for file in "${claim_files[@]}"; do + blob_name="${file#"$claims_root"/}" + if [[ ! " ${actual_claim_blobs[*]} " =~ " ${blob_name} " ]]; then + echo "Missing claim blob after upload: $blob_name" >&2 + missing=1 + fi +done +for file in "${policy_files[@]}"; do + blob_name="$(basename -- "$file")" + if [[ ! " ${actual_policy_blobs[*]} " =~ " ${blob_name} " ]]; then + echo "Missing policy blob after upload: $blob_name" >&2 + missing=1 + fi +done + +if [[ $missing -ne 0 ]]; then + echo "Upload verification failed." >&2 + exit 1 +fi + +printf "Asset upload complete and verified: %d claims, %d policies.\n" \ + "${#claim_files[@]}" "${#policy_files[@]}"