├── .github └── workflows │ ├── codeql-analysis.yml │ ├── create-resources.yml │ ├── destroy.yml │ ├── infra.yml │ ├── migrate-model.yml │ └── train-model.yml ├── .gitignore ├── LICENSE ├── README.md ├── bicep ├── main.bicep ├── modules │ ├── cognitives │ │ └── form.bicep │ ├── function │ │ └── function.bicep │ ├── insights │ │ └── insights.bicep │ ├── storage │ │ ├── storage-function.bicep │ │ └── storage.bicep │ ├── vault │ │ └── keyvault.bicep │ └── web │ │ └── blazor.bicep ├── utility.bicep ├── utility.parameters.json └── web.bicep ├── diagram └── architecture..drawio.svg ├── images ├── accept.png ├── actions.png ├── all.png ├── appent.png ├── appkeys.png ├── blazor.png ├── configuration.png ├── container.png ├── containers.png ├── copymodel.png ├── createazureresource.png ├── ent.png ├── env.png ├── environments.png ├── folder.png ├── fork.png ├── func.png ├── functions2.png ├── functionurl.png ├── infra.png ├── lfunc.png ├── migrate.png ├── migratemodel.png ├── model.png ├── modelcontainer.png ├── modelenv.png ├── newenvironment.png ├── newreposecret.png ├── newsetting.png ├── overview.png ├── reposecrets.png ├── resultmodel.png ├── run.png ├── secrets.png ├── set1.png ├── set2.png ├── settings.png ├── spdetails.png ├── test.png ├── test1.png ├── trained.png ├── trained_model.png ├── trainmodelaction.png ├── twokeys.png └── url.png ├── model ├── Test │ ├── empty.pdf │ └── test1.pdf ├── ceo.pdf ├── ceo.pdf.labels.json ├── ceo.pdf.ocr.json ├── cloudarchitect.pdf ├── cloudarchitect.pdf.labels.json ├── cloudarchitect.pdf.ocr.json ├── csharpprogrammer.pdf ├── csharpprogrammer.pdf.labels.json ├── csharpprogrammer.pdf.ocr.json ├── fields.json ├── fullstack.pdf ├── fullstack.pdf.labels.json ├── fullstack.pdf.ocr.json ├── securityguard.pdf ├── securityguard.pdf.labels.json └── securityguard.pdf.ocr.json ├── scripts ├── copyModel.ps1 ├── deleteForm.ps1 ├── trainModel.ps1 └── validateModel.ps1 └── src ├── .editorconfig ├── FormBlazorClient ├── App.razor ├── Components │ ├── DocumentLayout.razor │ ├── Environments.razor │ ├── FileUpload.razor │ └── Loading.razor ├── FormBlazorClient.csproj ├── Model │ └── SelectEnvironment.cs ├── Pages │ ├── Analyze.razor │ ├── Error.cshtml │ ├── Error.cshtml.cs │ ├── Index.razor │ ├── _Host.cshtml │ └── _Layout.cshtml ├── Program.cs ├── Properties │ └── launchSettings.json ├── Service │ ├── FileServiceStorage.cs │ ├── IFileServiceStorage.cs │ ├── IModelService.cs │ ├── IStateService.cs │ ├── ModelService.cs │ └── StateService.cs ├── Shared │ ├── MainLayout.razor │ ├── MainLayout.razor.css │ ├── NavMenu.razor │ ├── NavMenu.razor.css │ └── SurveyPrompt.razor ├── _Imports.razor ├── appsettings.Development.json ├── appsettings.json ├── global.cs ├── libman.json └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── font-awesome │ │ ├── css │ │ │ ├── font-awesome.css │ │ │ ├── font-awesome.css.map │ │ │ └── font-awesome.min.css │ │ └── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ ├── favicon.ico │ └── image │ └── ms.png ├── Shared ├── CopyModelParameter.cs ├── DeleteModelParameter.cs ├── Demo.Shared.csproj ├── DocumentInfo.cs ├── DocumentResult.cs ├── Enum.cs ├── Model.cs └── ModelInfo.cs ├── demo.sln └── function ├── .editorconfig ├── .gitignore ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── AnalyzeDocument.cs ├── CopyModel.cs ├── DeleteModel.cs ├── Extension └── Extension.cs ├── Factory ├── FormClientFactory.cs └── IFormClientFactory.cs ├── GetModel.cs ├── Startup.cs ├── TrainModel.cs ├── ValidateModelExists.cs ├── Validator ├── CopyModelParameterValidator.cs ├── DeleteModelParameterValidator.cs └── DocumentInfoParameterValidator.cs ├── function.csproj ├── global.cs └── host.json /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '27 7 * * 5' 22 | workflow_dispatch: 23 | 24 | jobs: 25 | analyze: 26 | name: Analyze 27 | runs-on: ubuntu-latest 28 | permissions: 29 | actions: read 30 | contents: read 31 | security-events: write 32 | 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | language: [ 'csharp' ] 37 | 38 | steps: 39 | - name: Checkout repository 40 | uses: actions/checkout@v2 41 | 42 | # Initializes the CodeQL tools for scanning. 43 | - name: Initialize CodeQL 44 | uses: github/codeql-action/init@v1 45 | with: 46 | languages: ${{ matrix.language }} 47 | # If you wish to specify custom queries, you can do so here or in a config file. 48 | # By default, queries listed here will override any specified in a config file. 49 | # Prefix the list here with "+" to use these queries and those in the config file. 50 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 51 | 52 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 53 | # If this step fails, then you should remove it and run the build manually (see below) 54 | - name: Autobuild 55 | uses: github/codeql-action/autobuild@v1 56 | 57 | # ℹ️ Command-line programs to run using the OS shell. 58 | # 📚 https://git.io/JvXDl 59 | 60 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 61 | # and modify them (or add more) to build your code if your project 62 | # uses a compiled language 63 | 64 | #- run: | 65 | # make bootstrap 66 | # make release 67 | 68 | - name: Perform CodeQL Analysis 69 | uses: github/codeql-action/analyze@v1 70 | -------------------------------------------------------------------------------- /.github/workflows/create-resources.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | # 5 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | # 9 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | # provided that You agree: 11 | # 12 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | # 17 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | # 19 | # DEMO POC - "AS IS" 20 | 21 | on: 22 | workflow_call: 23 | inputs: 24 | resourceGroupName: 25 | required: true 26 | type: string 27 | location: 28 | required: true 29 | type: string 30 | environmentName: 31 | required: true 32 | type: string 33 | secrets: 34 | azure_credentials: 35 | required: true 36 | subscriptionId: 37 | required: true 38 | outputs: 39 | formRecognizerName: 40 | description: 'The name of the form recognizer' 41 | value: ${{ jobs.create-azure-resources.outputs.formRecognizerName }} 42 | storageName: 43 | description: 'The name of the storage' 44 | value: ${{ jobs.create-azure-resources.outputs.storageName }} 45 | 46 | jobs: 47 | create-azure-resources: 48 | 49 | runs-on: ubuntu-latest 50 | 51 | outputs: 52 | formRecognizerName: ${{ steps.armDeployment.outputs.formRecognizerName }} 53 | storageName: ${{ steps.armDeployment.outputs.storageName }} 54 | 55 | steps: 56 | 57 | - uses: actions/checkout@v2 58 | 59 | - name: Azure Login 60 | uses: Azure/login@v1 61 | with: 62 | creds: ${{ secrets.azure_credentials }} 63 | 64 | - name: Create Resource Group 65 | run: | 66 | az group create -n ${{ inputs.resourceGroupName }} -l ${{ inputs.location }} 67 | 68 | # Temporary step the bicep linter return an error today for the 69 | # method PATCH for CORS on storage 70 | - name: Convert to ARM template 71 | run: | 72 | bicep build ./bicep/main.bicep 73 | 74 | 75 | - name: Deploy Azure Resources 76 | id: armDeployment 77 | uses: azure/arm-deploy@v1 78 | with: 79 | subscriptionId: ${{ secrets.subscriptionId }} 80 | resourceGroupName: ${{ inputs.resourceGroupName }} 81 | template: ./bicep/main.json 82 | parameters: environmentName=${{ inputs.environmentName }} 83 | 84 | - name: logout 85 | run: | 86 | az logout -------------------------------------------------------------------------------- /.github/workflows/destroy.yml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | # 5 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | # 9 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | # provided that You agree: 11 | # 12 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | # 17 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | # 19 | # DEMO POC - "AS IS" 20 | 21 | name: Destroy Resources 22 | 23 | on: 24 | workflow_dispatch: 25 | 26 | env: 27 | RG-DEV: 'rg-form-recognizer-devops-dev' 28 | RG-QA: 'rg-form-recognizer-devops-qa' 29 | RG-PROD: 'rg-form-recognizer-devops-prod' 30 | FORM_TAG: 'frm-devops-demo-tag-${{ secrets.SUBSCRIPTION_ID}}' 31 | 32 | jobs: 33 | 34 | destroy-resource-group: 35 | 36 | runs-on: ubuntu-latest 37 | 38 | steps: 39 | - uses: actions/checkout@v2 40 | 41 | - name: Azure Login 42 | uses: Azure/login@v1.1 43 | with: 44 | creds: ${{ secrets.AZURE_CREDENTIALS }} 45 | enable-AzPSSession: false 46 | 47 | - name: Destroy resource group 48 | run: | 49 | if [ $(az group exists --name ${{ env.RG-DEV }}) = true ]; then 50 | az group delete -n ${{ env.RG-DEV }} --yes 51 | fi 52 | if [ $(az group exists --name ${{ env.RG-QA }}) = true ]; then 53 | az group delete -n ${{ env.RG-QA }} --yes 54 | fi 55 | if [ $(az group exists --name ${{ env.RG-PROD }}) = true ]; then 56 | az group delete -n ${{ env.RG-PROD }} --yes 57 | fi 58 | 59 | - name: Remove soft delete form Recognizer 60 | shell: pwsh 61 | run: | 62 | ./scripts/deleteForm.ps1 -subscriptionId ${{ secrets.SUBSCRIPTION_ID }} 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /.github/workflows/migrate-model.yml: -------------------------------------------------------------------------------- 1 | name: Migrate Model 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | modelId: 7 | required: true 8 | description: 'The modelId to copy from DEV to other environment' 9 | type: string 10 | 11 | jobs: 12 | validateDEV: 13 | name: Validate Model Exists 14 | environment: 15 | name: DEV 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | 21 | - name: Run Azure PowerShell script validate 22 | run: | 23 | $secureString = ConvertTo-SecureString ${{ secrets.FUNCTION_VALIDATE_ENDPOINT }} -asplaintext -force 24 | ./scripts/validateModel.ps1 -modelId ${{ github.event.inputs.modelId }} -endpoint $secureString 25 | shell: pwsh 26 | 27 | deploymentQA: 28 | name: Deployment in QA 29 | environment: 30 | name: QA 31 | needs: validateDEV 32 | runs-on: ubuntu-latest 33 | 34 | steps: 35 | - uses: actions/checkout@v2 36 | 37 | - name: Run Azure PowerShell script validate 38 | shell: pwsh 39 | run: | 40 | $secureString = ConvertTo-SecureString ${{ secrets.FUNCTION_COPY_MODEL_ENDPOINT}} -asplaintext -force 41 | ./scripts/copyModel.ps1 -modelId ${{ github.event.inputs.modelId }} -sourceEnvironment 0 -destinationEnvironment 1 -functionEndpoint $secureString 42 | 43 | deploymentPROD: 44 | name: Deployment in PROD 45 | environment: 46 | name: PROD 47 | needs: deploymentQA 48 | runs-on: ubuntu-latest 49 | 50 | steps: 51 | - uses: actions/checkout@v2 52 | 53 | - name: Run Azure PowerShell script validate 54 | shell: pwsh 55 | run: | 56 | $secureString = ConvertTo-SecureString ${{ secrets.FUNCTION_COPY_MODEL_ENDPOINT}} -asplaintext -force 57 | ./scripts/copyModel.ps1 -modelId ${{ github.event.inputs.modelId }} -sourceEnvironment 1 -destinationEnvironment 2 -functionEndpoint $secureString 58 | 59 | -------------------------------------------------------------------------------- /.github/workflows/train-model.yml: -------------------------------------------------------------------------------- 1 | name: Train Model 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | train: 8 | name: Train the new model 9 | environment: 10 | name: DEV 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Run Azure PowerShell script validate 17 | run: | 18 | $secureString = ConvertTo-SecureString ${{ secrets.FUNCTION_TRAIN_MODEL_ENDPOINT }} -asplaintext -force 19 | ./scripts/trainModel.ps1 -functionEndpoint $secureString 20 | shell: pwsh 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Hugo Girard 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bicep/main.bicep: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | param environmentName string 22 | 23 | var location = resourceGroup().location 24 | var suffix = uniqueString(resourceGroup().id) 25 | var strName = '${toLower(environmentName)}${suffix}' 26 | 27 | module cognitives 'modules/cognitives/form.bicep' = { 28 | name: 'cognitives-${environmentName}' 29 | params: { 30 | location: location 31 | suffix: suffix 32 | environment: environmentName 33 | } 34 | } 35 | 36 | module storage 'modules/storage/storage.bicep' = if (toLower(environmentName) == 'dev') { 37 | name: 'storage-${environmentName}' 38 | params: { 39 | name: strName 40 | location: location 41 | environment: environmentName 42 | } 43 | } 44 | 45 | output storageName string = strName 46 | output formRecognizerName string = cognitives.outputs.formRecognizerName 47 | -------------------------------------------------------------------------------- /bicep/modules/cognitives/form.bicep: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | * 5 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | * 9 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | * provided that You agree: 11 | * 12 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | * 17 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | * 19 | * DEMO POC - "AS IS" 20 | */ 21 | 22 | param location string 23 | param suffix string 24 | param environment string 25 | 26 | var frmName = 'frm-${toLower(environment)}-${suffix}' 27 | 28 | resource frmRecognizer 'Microsoft.CognitiveServices/accounts@2021-04-30' = { 29 | name: frmName 30 | location: location 31 | sku: { 32 | name: 'S0' 33 | } 34 | tags: { 35 | 'environment': environment 36 | 'description': 'frm-devops-demo-tag-${subscription().subscriptionId}' 37 | } 38 | kind: 'FormRecognizer' 39 | properties: { 40 | customSubDomainName: frmName 41 | publicNetworkAccess: 'Enabled' 42 | networkAcls: { 43 | defaultAction: 'Allow' 44 | virtualNetworkRules: [ 45 | 46 | ] 47 | } 48 | } 49 | } 50 | 51 | output formRecognizerName string = frmRecognizer.name 52 | -------------------------------------------------------------------------------- /bicep/modules/insights/insights.bicep: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | param location string 22 | param suffix string 23 | 24 | var appInsightsName = 'appi-${suffix}' 25 | 26 | resource workspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' = { 27 | name: 'log-${suffix}' 28 | location: location 29 | properties: { 30 | sku: { 31 | name: 'PerGB2018' 32 | } 33 | } 34 | } 35 | 36 | resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = { 37 | name: appInsightsName 38 | location: location 39 | kind: 'web' 40 | properties: { 41 | Application_Type: 'web' 42 | WorkspaceResourceId: workspace.id 43 | publicNetworkAccessForIngestion: 'Enabled' 44 | publicNetworkAccessForQuery: 'Enabled' 45 | } 46 | } 47 | 48 | output appInsightKey string = appInsights.properties.InstrumentationKey 49 | output appInsightCnxString string = appInsights.properties.ConnectionString 50 | output appInsightName string = appInsights.name 51 | -------------------------------------------------------------------------------- /bicep/modules/storage/storage-function.bicep: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | * 5 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | * 9 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | * provided that You agree: 11 | * 12 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | * 17 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | * 19 | * DEMO POC - "AS IS" 20 | */ 21 | 22 | param suffix string 23 | param location string 24 | 25 | // var strAcccountNameFunc = 'strf${suffix}' 26 | var strFunction = 'strf${suffix}' 27 | 28 | resource storageAccountDocument 'Microsoft.Storage/storageAccounts@2021-04-01' = { 29 | name: strFunction 30 | location: location 31 | sku: { 32 | name: 'Standard_LRS' 33 | } 34 | kind: 'StorageV2' 35 | properties: { 36 | supportsHttpsTrafficOnly: true 37 | encryption: { 38 | services: { 39 | file: { 40 | keyType: 'Account' 41 | enabled: true 42 | } 43 | blob: { 44 | keyType: 'Account' 45 | enabled: true 46 | } 47 | } 48 | keySource: 'Microsoft.Storage' 49 | } 50 | accessTier: 'Hot' 51 | } 52 | } 53 | 54 | resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2021-04-01' = { 55 | parent: storageAccountDocument 56 | name: 'default' 57 | properties: { 58 | cors: { 59 | corsRules: [ 60 | { 61 | allowedOrigins: [ 62 | '*' 63 | ] 64 | allowedMethods: [ 65 | 'DELETE' 66 | 'GET' 67 | 'HEAD' 68 | 'MERGE' 69 | 'POST' 70 | 'OPTIONS' 71 | 'PUT' 72 | 'PATCH' 73 | ] 74 | exposedHeaders: [ 75 | '*' 76 | ] 77 | allowedHeaders: [ 78 | '*' 79 | ] 80 | maxAgeInSeconds: 200 81 | } 82 | ] 83 | } 84 | } 85 | } 86 | 87 | resource containerDocuments 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-04-01' = { 88 | parent: blobService 89 | name: 'upload' 90 | properties: { 91 | publicAccess: 'None' 92 | } 93 | } 94 | 95 | output strAccountName string = storageAccountDocument.name 96 | output strAccountId string = storageAccountDocument.id 97 | output strAccountApiVersion string = storageAccountDocument.apiVersion 98 | -------------------------------------------------------------------------------- /bicep/modules/storage/storage.bicep: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | * 5 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | * 9 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | * provided that You agree: 11 | * 12 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | * 17 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | * 19 | * DEMO POC - "AS IS" 20 | */ 21 | 22 | 23 | param location string 24 | param environment string 25 | param name string 26 | 27 | resource storageAccountDocument 'Microsoft.Storage/storageAccounts@2021-04-01' = { 28 | name: name 29 | location: location 30 | sku: { 31 | name: 'Standard_LRS' 32 | } 33 | tags: { 34 | 'environment': environment 35 | } 36 | kind: 'StorageV2' 37 | properties: { 38 | supportsHttpsTrafficOnly: true 39 | encryption: { 40 | services: { 41 | file: { 42 | keyType: 'Account' 43 | enabled: true 44 | } 45 | blob: { 46 | keyType: 'Account' 47 | enabled: true 48 | } 49 | } 50 | keySource: 'Microsoft.Storage' 51 | } 52 | accessTier: 'Hot' 53 | } 54 | } 55 | 56 | resource containerDocuments 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-04-01' = { 57 | name: '${storageAccountDocument.name}/default/model' 58 | properties: { 59 | publicAccess: 'None' 60 | } 61 | } 62 | 63 | resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2021-04-01' = { 64 | name: '${storageAccountDocument.name}/default' 65 | properties: { 66 | cors: { 67 | corsRules: [ 68 | { 69 | allowedOrigins: [ 70 | '*' 71 | ] 72 | allowedMethods: [ 73 | 'DELETE' 74 | 'GET' 75 | 'HEAD' 76 | 'MERGE' 77 | 'POST' 78 | 'OPTIONS' 79 | 'PUT' 80 | 'PATCH' 81 | ] 82 | exposedHeaders: [ 83 | '*' 84 | ] 85 | allowedHeaders: [ 86 | '*' 87 | ] 88 | maxAgeInSeconds: 200 89 | } 90 | ] 91 | } 92 | } 93 | } 94 | 95 | output strDocumentName string = storageAccountDocument.name 96 | output strDocumentId string = storageAccountDocument.id 97 | output strDocumentApiVersion string = storageAccountDocument.apiVersion 98 | -------------------------------------------------------------------------------- /bicep/modules/vault/keyvault.bicep: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | param location string 22 | param suffix string 23 | param environmentName string 24 | param spIdentity string 25 | 26 | param frmRecognizerEndpoint string 27 | 28 | param frmRecognizerId string 29 | param frmRecognizerVersion string 30 | 31 | //param frmKey string 32 | 33 | param strDocumentName string 34 | param strDocumentId string 35 | param strDocumentApiVersion string 36 | 37 | var strCnxString = 'DefaultEndpointsProtocol=https;AccountName=${strDocumentName};EndpointSuffix=${environment().suffixes.storage};AccountKey=${listKeys(strDocumentId, strDocumentApiVersion).keys[0].value}' 38 | var frmKey = listKeys(frmRecognizerId,frmRecognizerVersion).key1 39 | 40 | resource keyvault 'Microsoft.KeyVault/vaults@2021-06-01-preview' = { 41 | name: 'vault-${environmentName}-${suffix}' 42 | location: location 43 | properties: { 44 | accessPolicies: [ 45 | { 46 | tenantId: subscription().tenantId 47 | objectId: spIdentity 48 | permissions: { 49 | secrets: [ 50 | 'get' 51 | 'list' 52 | ] 53 | } 54 | } 55 | ] 56 | sku: { 57 | family: 'A' 58 | name: 'standard' 59 | } 60 | tenantId: subscription().tenantId 61 | enableSoftDelete: false 62 | } 63 | } 64 | 65 | resource secretEndpoint 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = { 66 | name: 'frmEndpoint' 67 | parent: keyvault 68 | properties: { 69 | value: frmRecognizerEndpoint 70 | } 71 | } 72 | 73 | resource secretKey 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = { 74 | name: 'frmKey' 75 | parent: keyvault 76 | properties: { 77 | value: frmKey 78 | } 79 | } 80 | 81 | resource secretStorageCnxString 'Microsoft.KeyVault/vaults/secrets@2019-09-01' = { 82 | name: 'storageCnxString' 83 | parent: keyvault 84 | properties: { 85 | value: strCnxString 86 | } 87 | } 88 | 89 | output keyvaultName string = keyvault.name 90 | -------------------------------------------------------------------------------- /bicep/modules/web/blazor.bicep: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | param location string 21 | param suffix string 22 | param storageName string 23 | param appInsightName string 24 | param functionHostname string 25 | 26 | var appPlanName = 'plan-blazor-${suffix}' 27 | var webAppName = 'blazor-admin-${suffix}' 28 | 29 | resource appServicePlan 'Microsoft.Web/serverfarms@2021-01-15' = { 30 | name: appPlanName 31 | location: location 32 | sku: { 33 | name: 'B1' 34 | tier: 'Basic' 35 | } 36 | } 37 | 38 | resource appInsights 'Microsoft.Insights/components@2020-02-02' existing = { 39 | name: appInsightName 40 | scope: resourceGroup(resourceGroup().name) 41 | } 42 | 43 | resource str 'Microsoft.Storage/storageAccounts@2021-04-01' existing = { 44 | name: storageName 45 | scope: resourceGroup(resourceGroup().name) 46 | } 47 | 48 | resource appService 'Microsoft.Web/sites@2021-02-01' = { 49 | name: webAppName 50 | location: location 51 | properties: { 52 | serverFarmId: appServicePlan.id 53 | clientAffinityEnabled: false 54 | siteConfig: { 55 | appSettings: [ 56 | { 57 | name: 'APPINSIGHTS_INSTRUMENTATIONKEY' 58 | value: appInsights.properties.InstrumentationKey 59 | } 60 | { 61 | name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' 62 | value: appInsights.properties.ConnectionString 63 | } 64 | { 65 | name: 'ApplicationInsightsAgent_EXTENSION_VERSION' 66 | value: '~2' 67 | } 68 | { 69 | name: 'UploadStorage' 70 | value: 'DefaultEndpointsProtocol=https;AccountName=${str.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${listKeys(str.id, str.apiVersion).keys[0].value}' 71 | } 72 | { 73 | name: 'Container' 74 | value: 'upload' 75 | } 76 | { 77 | name: 'FunctionBaseUrl' 78 | value: functionHostname 79 | } 80 | ] 81 | metadata: [ 82 | { 83 | name: 'CURRENT_STACK' 84 | value: 'dotnetcore' 85 | } 86 | ] 87 | alwaysOn: true 88 | } 89 | } 90 | } 91 | 92 | output webName string = appService.name 93 | -------------------------------------------------------------------------------- /bicep/utility.bicep: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 4 | * 5 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 6 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 7 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 8 | * 9 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 10 | * provided that You agree: 11 | * 12 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 13 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 14 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 15 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 16 | * 17 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 18 | * 19 | * DEMO POC - "AS IS" 20 | */ 21 | param devStorageName string 22 | param devFormRecognizerName string 23 | param qaFormRecognizerName string 24 | param prodFormRecognizerName string 25 | 26 | param devResourceGroupName string 27 | param qaResourceGroupName string 28 | param prodResourceGroupName string 29 | param location string = resourceGroup().location 30 | 31 | var suffix = uniqueString(resourceGroup().id) 32 | 33 | module insight 'modules/insights/insights.bicep' = { 34 | name: 'insight' 35 | params: { 36 | location: location 37 | suffix: suffix 38 | } 39 | } 40 | 41 | module storage 'modules/storage/storage-function.bicep' = { 42 | name: 'storage' 43 | params: { 44 | location: location 45 | suffix: suffix 46 | } 47 | } 48 | 49 | module function 'modules/function/function.bicep' = { 50 | name: 'function' 51 | params: { 52 | appInsightCnxString: insight.outputs.appInsightCnxString 53 | appInsightKey: insight.outputs.appInsightKey 54 | location: location 55 | devStorageName: devStorageName 56 | devFormRecognizerName: devFormRecognizerName 57 | qaFormRecognizerName: qaFormRecognizerName 58 | prodFormRecognizerName: prodFormRecognizerName 59 | devResourceGroupName: devResourceGroupName 60 | qaResourceGroupName: qaResourceGroupName 61 | prodResourceGroupName: prodResourceGroupName 62 | strAccountName: storage.outputs.strAccountName 63 | suffix: suffix 64 | } 65 | } 66 | 67 | output functionName string = function.outputs.functionName 68 | output functionHostname string = function.outputs.functionHostname 69 | output storageName string = storage.outputs.strAccountName 70 | output appInsightName string = insight.outputs.appInsightName 71 | -------------------------------------------------------------------------------- /bicep/utility.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "devStorageName": { 6 | "value": "__devStorageName__" 7 | }, 8 | "devFormRecognizerName": { 9 | "value": "__devFormRecognizerName__" 10 | }, 11 | "qaFormRecognizerName": { 12 | "value": "__qaFormRecognizerName__" 13 | }, 14 | "prodFormRecognizerName": { 15 | "value": "__prodFormRecognizerName__" 16 | }, 17 | "devResourceGroupName": { 18 | "value": "__devResourceGroupName__" 19 | }, 20 | "qaResourceGroupName": { 21 | "value": "__qaResourceGroupName__" 22 | }, 23 | "prodResourceGroupName": { 24 | "value": "__prodResourceGroupName__" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /bicep/web.bicep: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | param location string 21 | param strName string 22 | param appInsightName string 23 | param functionHostname string 24 | 25 | var suffix = uniqueString(resourceGroup().id) 26 | 27 | module blazor 'modules/web/blazor.bicep' = { 28 | name: 'blazor' 29 | params: { 30 | appInsightName: appInsightName 31 | location: location 32 | storageName: strName 33 | suffix: suffix 34 | functionHostname: functionHostname 35 | } 36 | } 37 | 38 | output webAppName string = blazor.outputs.webName 39 | -------------------------------------------------------------------------------- /images/accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/accept.png -------------------------------------------------------------------------------- /images/actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/actions.png -------------------------------------------------------------------------------- /images/all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/all.png -------------------------------------------------------------------------------- /images/appent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/appent.png -------------------------------------------------------------------------------- /images/appkeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/appkeys.png -------------------------------------------------------------------------------- /images/blazor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/blazor.png -------------------------------------------------------------------------------- /images/configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/configuration.png -------------------------------------------------------------------------------- /images/container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/container.png -------------------------------------------------------------------------------- /images/containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/containers.png -------------------------------------------------------------------------------- /images/copymodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/copymodel.png -------------------------------------------------------------------------------- /images/createazureresource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/createazureresource.png -------------------------------------------------------------------------------- /images/ent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/ent.png -------------------------------------------------------------------------------- /images/env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/env.png -------------------------------------------------------------------------------- /images/environments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/environments.png -------------------------------------------------------------------------------- /images/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/folder.png -------------------------------------------------------------------------------- /images/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/fork.png -------------------------------------------------------------------------------- /images/func.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/func.png -------------------------------------------------------------------------------- /images/functions2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/functions2.png -------------------------------------------------------------------------------- /images/functionurl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/functionurl.png -------------------------------------------------------------------------------- /images/infra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/infra.png -------------------------------------------------------------------------------- /images/lfunc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/lfunc.png -------------------------------------------------------------------------------- /images/migrate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/migrate.png -------------------------------------------------------------------------------- /images/migratemodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/migratemodel.png -------------------------------------------------------------------------------- /images/model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/model.png -------------------------------------------------------------------------------- /images/modelcontainer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/modelcontainer.png -------------------------------------------------------------------------------- /images/modelenv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/modelenv.png -------------------------------------------------------------------------------- /images/newenvironment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/newenvironment.png -------------------------------------------------------------------------------- /images/newreposecret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/newreposecret.png -------------------------------------------------------------------------------- /images/newsetting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/newsetting.png -------------------------------------------------------------------------------- /images/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/overview.png -------------------------------------------------------------------------------- /images/reposecrets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/reposecrets.png -------------------------------------------------------------------------------- /images/resultmodel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/resultmodel.png -------------------------------------------------------------------------------- /images/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/run.png -------------------------------------------------------------------------------- /images/secrets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/secrets.png -------------------------------------------------------------------------------- /images/set1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/set1.png -------------------------------------------------------------------------------- /images/set2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/set2.png -------------------------------------------------------------------------------- /images/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/settings.png -------------------------------------------------------------------------------- /images/spdetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/spdetails.png -------------------------------------------------------------------------------- /images/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/test.png -------------------------------------------------------------------------------- /images/test1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/test1.png -------------------------------------------------------------------------------- /images/trained.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/trained.png -------------------------------------------------------------------------------- /images/trained_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/trained_model.png -------------------------------------------------------------------------------- /images/trainmodelaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/trainmodelaction.png -------------------------------------------------------------------------------- /images/twokeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/twokeys.png -------------------------------------------------------------------------------- /images/url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/images/url.png -------------------------------------------------------------------------------- /model/Test/empty.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/Test/empty.pdf -------------------------------------------------------------------------------- /model/Test/test1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/Test/test1.pdf -------------------------------------------------------------------------------- /model/ceo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/ceo.pdf -------------------------------------------------------------------------------- /model/cloudarchitect.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/cloudarchitect.pdf -------------------------------------------------------------------------------- /model/csharpprogrammer.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/csharpprogrammer.pdf -------------------------------------------------------------------------------- /model/fields.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.cognitiveservices.azure.com/formrecognizer/2021-03-01/fields.json", 3 | "fields": [ 4 | { 5 | "fieldKey": "Job Application Type", 6 | "fieldType": "string", 7 | "fieldFormat": "not-specified" 8 | }, 9 | { 10 | "fieldKey": "Name of Candidate", 11 | "fieldType": "string", 12 | "fieldFormat": "not-specified" 13 | }, 14 | { 15 | "fieldKey": "Job Application Id", 16 | "fieldType": "string", 17 | "fieldFormat": "not-specified" 18 | }, 19 | { 20 | "fieldKey": "Date of Submission", 21 | "fieldType": "string", 22 | "fieldFormat": "not-specified" 23 | }, 24 | { 25 | "fieldKey": "Position Applied For", 26 | "fieldType": "string", 27 | "fieldFormat": "not-specified" 28 | }, 29 | { 30 | "fieldKey": "Contact-Number", 31 | "fieldType": "string", 32 | "fieldFormat": "not-specified" 33 | }, 34 | { 35 | "fieldKey": "Objective and Goals", 36 | "fieldType": "string", 37 | "fieldFormat": "not-specified" 38 | }, 39 | { 40 | "fieldKey": "Other Information", 41 | "fieldType": "string", 42 | "fieldFormat": "not-specified" 43 | } 44 | ], 45 | "definitions": {} 46 | } -------------------------------------------------------------------------------- /model/fullstack.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/fullstack.pdf -------------------------------------------------------------------------------- /model/securityguard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/model/securityguard.pdf -------------------------------------------------------------------------------- /scripts/copyModel.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | # 4 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | # 8 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | # provided that You agree: 10 | # 11 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | # 16 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | # 18 | # DEMO POC - "AS IS" 19 | # 20 | 21 | param( 22 | [Parameter(Mandatory = $true)] 23 | [string]$modelId, 24 | [Parameter(Mandatory = $true)] 25 | [int]$sourceEnvironment, 26 | [Parameter(Mandatory = $true)] 27 | [int]$destinationEnvironment, 28 | [Parameter(Mandatory = $true)] 29 | [Security.SecureString]$functionEndpoint 30 | ) 31 | 32 | try { 33 | 34 | $decryptedEndpoint = ConvertFrom-SecureString $functionEndpoint -AsPlainText 35 | $header = @{ 36 | "Content-Type"="application/json" 37 | } 38 | 39 | $body= @{ 40 | "sourceModelId"="$modelId" 41 | "sourceEnvironment"="$sourceEnvironment" 42 | "destinationEnvironment"="$destinationEnvironment" 43 | } | ConvertTo-Json 44 | 45 | $response = Invoke-WebRequest -Uri $decryptedEndpoint -Method 'Post' -Headers $header -Body $body 46 | 47 | if ($response.StatusCode -ne 200) { 48 | throw "Error, statusCode: $response.StatusCode" 49 | } 50 | } 51 | catch { 52 | throw "Something happen" 53 | } 54 | 55 | -------------------------------------------------------------------------------- /scripts/deleteForm.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | # 4 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | # 8 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | # provided that You agree: 10 | # 11 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | # 16 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | # 18 | # DEMO POC - "AS IS" 19 | # 20 | 21 | param( 22 | [Parameter(Mandatory = $true)] 23 | [string]$subscriptionId 24 | ) 25 | 26 | $results=az rest --method get --header 'Accept=application/json' -u "https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.CognitiveServices/deletedAccounts?api-version=2021-04-30" 27 | $resources = $results | ConvertFrom-Json 28 | 29 | $tag="frm-devops-demo-tag-$subscriptionId" 30 | 31 | ForEach($resource in $resources.value) { 32 | if ($resource.tags.description -eq $tag) { 33 | az resource delete --ids $resource.id 34 | } 35 | } -------------------------------------------------------------------------------- /scripts/trainModel.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | # 4 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | # 8 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | # provided that You agree: 10 | # 11 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | # 16 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | # 18 | # DEMO POC - "AS IS" 19 | # 20 | 21 | param( 22 | [Parameter(Mandatory = $true)] 23 | [Security.SecureString]$functionEndpoint 24 | ) 25 | 26 | try { 27 | $header = @{ 28 | "Content-Type"="application/json" 29 | } 30 | 31 | $decryptedEndpoint = ConvertFrom-SecureString $functionEndpoint -AsPlainText 32 | $modelId = New-Guid 33 | $description = "Job Model for $modelId" 34 | 35 | $body= @{ 36 | "modelId"="$modelId" 37 | "description"="$description" 38 | } | ConvertTo-Json 39 | 40 | $response = Invoke-WebRequest -Uri $decryptedEndpoint -Method 'Post' -Headers $header -Body $body 41 | 42 | if ($response.StatusCode -ne 200) { 43 | throw "Error, statusCode: $response.StatusCode" 44 | } 45 | 46 | return $modelId 47 | } 48 | catch { 49 | throw "Something bad happen" 50 | } 51 | 52 | -------------------------------------------------------------------------------- /scripts/validateModel.ps1: -------------------------------------------------------------------------------- 1 | # 2 | # Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | # 4 | # This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | # THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | # INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | # 8 | # We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | # provided that You agree: 10 | # 11 | # (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | # (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | # (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | # including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | # 16 | # Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | # 18 | # DEMO POC - "AS IS" 19 | # 20 | param( 21 | [Parameter(Mandatory = $true)] 22 | [string]$modelId, 23 | [Parameter(Mandatory = $true)] 24 | [Security.SecureString]$endpoint 25 | ) 26 | 27 | try { 28 | 29 | $decryptedEndpoint = ConvertFrom-SecureString $endpoint -AsPlainText 30 | $values = $decryptedEndpoint.Split("?") 31 | $decryptedEndpoint = $values[0] 32 | $code = $values[1].Replace("code=","") 33 | 34 | $header = @{ 35 | "Content-Type"="application/json" 36 | "x-functions-key"="$code" 37 | } 38 | 39 | $url = $decryptedEndpoint + "?modelId=$modelId&environment=0" 40 | $response = Invoke-WebRequest -Uri $url -Method 'Get' -Headers $header 41 | 42 | if ($response.StatusCode -ne 200) { 43 | throw "Error, statusCode: $response.StatusCode" 44 | } 45 | } 46 | catch { 47 | throw "Something happen" 48 | } 49 | -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS8603: Possible null reference return. 4 | dotnet_diagnostic.CS8603.severity = none 5 | -------------------------------------------------------------------------------- /src/FormBlazorClient/App.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | 21 | 22 | 23 | 24 | 25 | 26 | Not found 27 | 28 |

Sorry, there's nothing at this address.

29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Components/DocumentLayout.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | 21 | @if (DocumentResult != null) 22 | { 23 | @foreach (var documentResult in DocumentResult) 24 | { 25 |
26 |
27 | DocType: @documentResult.DocType 28 |
29 |
30 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | @foreach(var field in documentResult.Fields) 43 | { 44 | 45 | 46 | 47 | 48 | 49 | } 50 | 51 |
FieldNameContentConfidence
@field.FieldName@field.Content@field.Confidence
52 |
53 |
54 | 55 | } 56 | } 57 | 58 | 59 | @code { 60 | 61 | [Parameter] 62 | public IEnumerable DocumentResult { get; set; } 63 | } 64 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Components/Environments.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @code { 33 | private SelectEnvironment SelectEnvironment = new(); 34 | 35 | [Parameter] 36 | public EventCallback OnEnvironmentChanged { get; set; } 37 | 38 | async Task OnSelectionChanged(string value) 39 | { 40 | MODEL_ENVIRONMENT onSelectedModelEnvironment; 41 | if (Enum.TryParse(value, out onSelectedModelEnvironment)) 42 | { 43 | SelectEnvironment.SelectedEnvironment = value; 44 | await OnEnvironmentChanged.InvokeAsync(onSelectedModelEnvironment); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Components/FileUpload.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @inject IFileServiceStorage _fileServiceStorage 21 | 22 | 23 | 24 | @if (ShowError) 25 | { 26 | 29 | } 30 | 31 | @if (ShowPreview) 32 | { 33 |
34 | 35 |
36 | } 37 | 38 | 39 | 40 | @code { 41 | 42 | private bool ShowPreview = false; 43 | private bool ShowError = false; 44 | private string ErrorMsg = string.Empty; 45 | private string ImagePreview = string.Empty; 46 | 47 | private bool Loading = false; 48 | 49 | [Parameter] 50 | public EventCallback OnFileUpload { get; set; } 51 | 52 | const string DefaultStatus = "Maximum size allowed for the image is 4 MB"; 53 | protected string status = DefaultStatus; 54 | const int MaxFileSize = 4 * 1024 * 1024; // 4MB 55 | 56 | protected async Task ViewImage(InputFileChangeEventArgs e) 57 | { 58 | ShowError = false; 59 | ErrorMsg = string.Empty; 60 | 61 | if (e.File.Size > MaxFileSize) 62 | { 63 | ErrorMsg = $"The file size is {e.File.Size} bytes, this is more than the allowed limit of {MaxFileSize} bytes."; 64 | ShowError = true; 65 | return; 66 | } 67 | else if (!e.File.ContentType.ToLower().Contains("pdf")) 68 | { 69 | ShowError = true; 70 | ErrorMsg = "Unsupported file, only pdf are supported"; 71 | return; 72 | } 73 | 74 | try 75 | { 76 | Loading = true; 77 | string imageUrl; 78 | 79 | using (var fileStream = e.File.OpenReadStream(MaxFileSize)) 80 | using (var memoryStream = new MemoryStream()) 81 | { 82 | await fileStream.CopyToAsync(memoryStream); 83 | memoryStream.Position = 0; 84 | Uri filePath = await _fileServiceStorage.UploadAsync(memoryStream); 85 | memoryStream.Position = 0; 86 | var imageFileBytes = memoryStream.ToArray(); 87 | ImagePreview = string.Concat("data:application/pdf;base64,", Convert.ToBase64String(memoryStream.ToArray())); 88 | imageUrl = filePath.ToString(); 89 | ShowPreview = true; 90 | ShowError = false; 91 | } 92 | 93 | await OnFileUpload.InvokeAsync(imageUrl); 94 | } 95 | catch (Exception ex) 96 | { 97 | ShowPreview = false; 98 | ShowError = true; 99 | ErrorMsg = "Cannot upload the file to storage"; 100 | } 101 | finally 102 | { 103 | Loading = false; 104 | } 105 | 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Components/Loading.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @if (IsLoading) 21 | { 22 |
23 |
24 |
25 |
Processing please wait...
26 |
27 | 28 |
29 |
30 |
31 |
32 | 33 | } 34 | 35 | @code { 36 | [Parameter] 37 | public bool IsLoading { get; set; } 38 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/FormBlazorClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8045d8ca-4c89-4cb9-a035-ba580a19ea50 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Model/SelectEnvironment.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace FormBlazorClient.Model; 21 | 22 | public class SelectEnvironment 23 | { 24 | public string SelectedEnvironment { get; set; } 25 | } 26 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/Analyze.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @page "/analyze" 21 | 22 | @inject IStateService _stateService 23 | @inject IModelService _modelService 24 | 25 | 26 | 27 |
28 |
29 | ModelId: @ModelId 30 |
31 |
32 | Environment: @Environment 33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 42 | @if (!string.IsNullOrEmpty(_filePath)) 43 | { 44 |
45 |
46 | 49 |
50 |
51 | } 52 | 53 | @if (DocumentResults != null) 54 | { 55 | 56 | } 57 | 58 | 59 | @code { 60 | private string _filePath = string.Empty; 61 | private string ModelId = string.Empty; 62 | private string Environment = string.Empty; 63 | private IEnumerable DocumentResults; 64 | 65 | private bool Loading = false; 66 | 67 | protected override Task OnInitializedAsync() 68 | { 69 | ModelId = _stateService.SelectedModel.ModelId; 70 | 71 | switch (_stateService.SelectedEnvironment) 72 | { 73 | case MODEL_ENVIRONMENT.DEV: 74 | Environment = "DEV"; 75 | break; 76 | case MODEL_ENVIRONMENT.QA: 77 | Environment = "QA"; 78 | break; 79 | case MODEL_ENVIRONMENT.PROD: 80 | Environment = "PROD"; 81 | break; 82 | } 83 | 84 | return base.OnInitializedAsync(); 85 | } 86 | 87 | private void OnFileUploaded(string filePath) 88 | { 89 | _filePath = filePath; 90 | } 91 | 92 | private async Task OnAnalyzeDocumentAsync() 93 | { 94 | Loading = true; 95 | try 96 | { 97 | DocumentResults = await _modelService.AnalyzeDocumentAsync(_filePath, 98 | _stateService.SelectedModel.ModelId, 99 | _stateService.SelectedEnvironment); 100 | } 101 | catch 102 | { 103 | 104 | } 105 | finally 106 | { 107 | Loading = false; 108 | } 109 | 110 | 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/Error.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @page 21 | @model FormBlazorClient.Pages.ErrorModel 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Error 30 | 31 | 32 | 33 | 34 | 35 |
36 |
37 |

Error.

38 |

An error occurred while processing your request.

39 | 40 | @if (Model.ShowRequestId) 41 | { 42 |

43 | Request ID: @Model.RequestId 44 |

45 | } 46 | 47 |

Development Mode

48 |

49 | Swapping to the Development environment displays detailed information about the error that occurred. 50 |

51 |

52 | The Development environment shouldn't be enabled for deployed applications. 53 | It can result in displaying sensitive information from exceptions to end users. 54 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 55 | and restarting the app. 56 |

57 |
58 |
59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using Microsoft.AspNetCore.Mvc; 21 | using Microsoft.AspNetCore.Mvc.RazorPages; 22 | using System.Diagnostics; 23 | 24 | namespace FormBlazorClient.Pages 25 | { 26 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 27 | [IgnoreAntiforgeryToken] 28 | public class ErrorModel : PageModel 29 | { 30 | public string? RequestId { get; set; } 31 | 32 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 33 | 34 | private readonly ILogger _logger; 35 | 36 | public ErrorModel(ILogger logger) 37 | { 38 | _logger = logger; 39 | } 40 | 41 | public void OnGet() 42 | { 43 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @page "/" 21 | 22 | @inject IModelService _modelService 23 | @inject IStateService _stateService 24 | @inject IJSRuntime _jsRuntime 25 | @inject NavigationManager _navigationManager 26 | 27 |

List of trained model in an environment

28 | 29 | 30 | 31 |
32 |
33 | 34 |
35 |
36 | 37 | @if (Models != null) 38 | { 39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | @foreach(var model in Models) 53 | { 54 | 55 | 56 | 57 | 58 | 63 | 68 | 69 | } 70 | 71 |
ModelIdDescriptionCreatedOn
@model.ModelId@model.Description@model.CreatedOn 59 | 62 | 64 | 67 |
72 |
73 |
74 | } 75 | 76 | 77 | @code { 78 | private bool IsLoading = false; 79 | 80 | private IList Models; 81 | private MODEL_ENVIRONMENT SelectedEnvironment; 82 | 83 | private async Task OnEnvironmentChanged(MODEL_ENVIRONMENT environment) 84 | { 85 | IsLoading = true; 86 | SelectedEnvironment = environment; 87 | Models = await _modelService.GetModelsAsync(environment); 88 | IsLoading = false; 89 | } 90 | 91 | private async Task OnDeleteModel(ModelInfo model) 92 | { 93 | bool confirmed = await _jsRuntime.InvokeAsync("confirm", $"Are you sure you want to delete the model {model.ModelId}"); 94 | if (confirmed) 95 | { 96 | IsLoading = true; 97 | bool success = await _modelService.DeleteModelAsync(model.ModelId, SelectedEnvironment); 98 | 99 | if (success) 100 | { 101 | Models.Remove(model); 102 | } 103 | 104 | IsLoading = false; 105 | } 106 | } 107 | 108 | private void OnTestModel(ModelInfo model) 109 | { 110 | _stateService.SelectedModel = model; 111 | _stateService.SelectedEnvironment = SelectedEnvironment; 112 | _navigationManager.NavigateTo("/analyze"); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @page "/" 21 | @namespace FormBlazorClient.Pages 22 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 23 | @{ 24 | Layout = "_Layout"; 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Pages/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @using Microsoft.AspNetCore.Components.Web 21 | @namespace FormBlazorClient.Pages 22 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | @RenderBody() 38 | 39 |
40 | 41 | An error has occurred. This application may no longer respond until reloaded. 42 | 43 | 44 | An unhandled exception has occurred. See browser dev tools for details. 45 | 46 | Reload 47 | 🗙 48 |
49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using Microsoft.AspNetCore.Components; 21 | using Microsoft.AspNetCore.Components.Web; 22 | 23 | var builder = WebApplication.CreateBuilder(args); 24 | 25 | // Add services to the container. 26 | builder.Services.AddRazorPages(); 27 | builder.Services.AddServerSideBlazor(); 28 | builder.Services.AddHttpClient(); 29 | builder.Services.AddSingleton(); 30 | builder.Services.AddSingleton(); 31 | builder.Services.AddSingleton(); 32 | 33 | var app = builder.Build(); 34 | 35 | // Configure the HTTP request pipeline. 36 | if (!app.Environment.IsDevelopment()) 37 | { 38 | app.UseExceptionHandler("/Error"); 39 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. 40 | app.UseHsts(); 41 | } 42 | 43 | app.UseHttpsRedirection(); 44 | 45 | app.UseStaticFiles(); 46 | 47 | app.UseRouting(); 48 | 49 | app.MapBlazorHub(); 50 | app.MapFallbackToPage("/_Host"); 51 | 52 | app.Run(); 53 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:44761", 7 | "sslPort": 44367 8 | } 9 | }, 10 | "profiles": { 11 | "FormBlazorClient": { 12 | "commandName": "Project", 13 | "dotnetRunMessages": true, 14 | "launchBrowser": true, 15 | "applicationUrl": "https://localhost:7203;http://localhost:5203", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "IIS Express": { 21 | "commandName": "IISExpress", 22 | "launchBrowser": true, 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/FileServiceStorage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using Azure.Storage.Blobs; 21 | using Azure.Storage; 22 | using Azure.Storage.Blobs.Models; 23 | using Azure.Storage.Blobs.Specialized; 24 | using Azure.Storage.Sas; 25 | 26 | namespace FormBlazorClient.Service; 27 | 28 | public class FileServiceStorage : IFileServiceStorage 29 | { 30 | private readonly BlobContainerClient _container; 31 | 32 | public FileServiceStorage(IConfiguration configuration) 33 | { 34 | _container = new BlobContainerClient(configuration["UploadStorage"], 35 | configuration["Container"]); 36 | } 37 | 38 | public async Task UploadAsync(Stream content) 39 | { 40 | string filename = $"{Guid.NewGuid().ToString()}.pdf"; 41 | 42 | BlobClient blob = _container.GetBlobClient(filename); 43 | 44 | await blob.UploadAsync(content); 45 | 46 | // Generate a SAS token valid for 1 hour 47 | var sasBuilder = new BlobSasBuilder() 48 | { 49 | BlobContainerName = blob.GetParentBlobContainerClient().Name, 50 | BlobName = blob.Name, 51 | Resource = "b", 52 | StartsOn = DateTimeOffset.UtcNow, 53 | ExpiresOn = DateTimeOffset.UtcNow.AddHours(1) 54 | }; 55 | 56 | // Specify read and write permissions for the SAS. 57 | sasBuilder.SetPermissions(BlobSasPermissions.Read); 58 | 59 | return blob.GenerateSasUri(sasBuilder); 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/IFileServiceStorage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace FormBlazorClient.Service 21 | { 22 | public interface IFileServiceStorage 23 | { 24 | Task UploadAsync(Stream content); 25 | } 26 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/IModelService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace FormBlazorClient.Service 21 | { 22 | public interface IModelService 23 | { 24 | Task DeleteModelAsync(string modelId, MODEL_ENVIRONMENT environment); 25 | Task> GetModelsAsync(MODEL_ENVIRONMENT environment); 26 | 27 | Task> AnalyzeDocumentAsync(string documentUrl, string modelId, MODEL_ENVIRONMENT environment); 28 | } 29 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/IStateService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace FormBlazorClient.Service 21 | { 22 | public interface IStateService 23 | { 24 | MODEL_ENVIRONMENT SelectedEnvironment { get; set; } 25 | ModelInfo SelectedModel { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/ModelService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System.Dynamic; 21 | using System.Text.Json; 22 | 23 | namespace FormBlazorClient.Service; 24 | 25 | public class ModelService : IModelService 26 | { 27 | private readonly IHttpClientFactory _httpClientfactory; 28 | private readonly string BASE_URL; 29 | private readonly string FUNCTION_CODE; 30 | 31 | public ModelService(IHttpClientFactory httpClientfactory, IConfiguration configuration) 32 | { 33 | _httpClientfactory = httpClientfactory; 34 | BASE_URL = configuration["FunctionBaseUrl"]; 35 | FUNCTION_CODE = configuration["FunctionKeyCode"]; 36 | } 37 | 38 | public async Task> GetModelsAsync(MODEL_ENVIRONMENT environment) 39 | { 40 | string url = $"{BASE_URL}/GetModel?environment={environment}"; 41 | 42 | HttpResponseMessage response = await SendRequestAsync(url, HttpMethod.Get); 43 | 44 | if (response.IsSuccessStatusCode) 45 | { 46 | string json = await response.Content.ReadAsStringAsync(); 47 | 48 | return JsonSerializer.Deserialize>(json,new JsonSerializerOptions 49 | { 50 | PropertyNamingPolicy = JsonNamingPolicy.CamelCase 51 | }); 52 | 53 | } 54 | 55 | return new List(); 56 | } 57 | public async Task DeleteModelAsync(string modelId, MODEL_ENVIRONMENT environment) 58 | { 59 | string url = $"{BASE_URL}/DeleteModel"; 60 | 61 | dynamic payload = new ExpandoObject(); 62 | payload.modelId = modelId; 63 | payload.environment = environment; 64 | 65 | HttpResponseMessage response = await SendRequestAsync(url, HttpMethod.Delete, payload); 66 | 67 | if (response.IsSuccessStatusCode) 68 | return true; 69 | 70 | return false; 71 | } 72 | 73 | public async Task> AnalyzeDocumentAsync(string documentUrl,string modelId, MODEL_ENVIRONMENT environment) 74 | { 75 | 76 | string url = $"{BASE_URL}/AnalyzeDocument"; 77 | 78 | dynamic payload = new ExpandoObject(); 79 | payload.ModelId = modelId; 80 | payload.Environment = environment; 81 | payload.DocumentUrl = documentUrl; 82 | 83 | HttpResponseMessage response = await SendRequestAsync(url,HttpMethod.Post,payload); 84 | 85 | if (!response.IsSuccessStatusCode) 86 | return null; 87 | 88 | string json = await response.Content.ReadAsStringAsync(); 89 | 90 | return JsonSerializer.Deserialize>(json, new JsonSerializerOptions 91 | { 92 | PropertyNamingPolicy = JsonNamingPolicy.CamelCase 93 | }); 94 | 95 | } 96 | 97 | private async Task SendRequestAsync(string url, HttpMethod method) 98 | { 99 | return await SendRequestAsync(url, method, null); 100 | } 101 | 102 | private async Task SendRequestAsync(string url, HttpMethod method, dynamic? payload) 103 | { 104 | var request = new HttpRequestMessage(method, url); 105 | request.Headers.Add("x-functions-key", FUNCTION_CODE); 106 | if (payload != null) 107 | { 108 | request.Content = new StringContent(JsonSerializer.Serialize(payload, new JsonSerializerOptions 109 | { 110 | PropertyNamingPolicy = JsonNamingPolicy.CamelCase 111 | })); 112 | } 113 | 114 | var client = _httpClientfactory.CreateClient(); 115 | return await client.SendAsync(request); 116 | } 117 | 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Service/StateService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace FormBlazorClient.Service; 21 | 22 | public class StateService : IStateService 23 | { 24 | public ModelInfo SelectedModel { get; set; } 25 | 26 | public MODEL_ENVIRONMENT SelectedEnvironment { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Shared/MainLayout.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | @inherits LayoutComponentBase 21 | 22 | FormBlazorClient 23 | 24 |
25 | 28 | 29 |
30 |
31 | 32 |
33 |
34 | @Body 35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Shared/MainLayout.razor.css: -------------------------------------------------------------------------------- 1 | .page { 2 | position: relative; 3 | display: flex; 4 | flex-direction: column; 5 | } 6 | 7 | main { 8 | flex: 1; 9 | } 10 | 11 | .sidebar { 12 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 13 | } 14 | 15 | .top-row { 16 | background-color: #f7f7f7; 17 | border-bottom: 1px solid #d6d5d5; 18 | justify-content: flex-end; 19 | height: 3.5rem; 20 | display: flex; 21 | align-items: center; 22 | } 23 | 24 | .top-row ::deep a, .top-row .btn-link { 25 | white-space: nowrap; 26 | margin-left: 1.5rem; 27 | } 28 | 29 | .top-row a:first-child { 30 | overflow: hidden; 31 | text-overflow: ellipsis; 32 | } 33 | 34 | @media (max-width: 640.98px) { 35 | .top-row:not(.auth) { 36 | display: none; 37 | } 38 | 39 | .top-row.auth { 40 | justify-content: space-between; 41 | } 42 | 43 | .top-row a, .top-row .btn-link { 44 | margin-left: 0; 45 | } 46 | } 47 | 48 | @media (min-width: 641px) { 49 | .page { 50 | flex-direction: row; 51 | } 52 | 53 | .sidebar { 54 | width: 250px; 55 | height: 100vh; 56 | position: sticky; 57 | top: 0; 58 | } 59 | 60 | .top-row { 61 | position: sticky; 62 | top: 0; 63 | z-index: 1; 64 | } 65 | 66 | .top-row, article { 67 | padding-left: 2rem !important; 68 | padding-right: 1.5rem !important; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Shared/NavMenu.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 | 28 | 29 |
30 | 37 |
38 | 39 | @code { 40 | private bool collapseNavMenu = true; 41 | 42 | private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; 43 | 44 | private void ToggleNavMenu() 45 | { 46 | collapseNavMenu = !collapseNavMenu; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Shared/NavMenu.razor.css: -------------------------------------------------------------------------------- 1 | .navbar-toggler { 2 | background-color: rgba(255, 255, 255, 0.1); 3 | } 4 | 5 | .top-row { 6 | height: 3.5rem; 7 | background-color: rgba(0,0,0,0.4); 8 | } 9 | 10 | .navbar-brand { 11 | font-size: 1.1rem; 12 | } 13 | 14 | .oi { 15 | width: 2rem; 16 | font-size: 1.1rem; 17 | vertical-align: text-top; 18 | top: -2px; 19 | } 20 | 21 | .nav-item { 22 | font-size: 0.9rem; 23 | padding-bottom: 0.5rem; 24 | } 25 | 26 | .nav-item:first-of-type { 27 | padding-top: 1rem; 28 | } 29 | 30 | .nav-item:last-of-type { 31 | padding-bottom: 1rem; 32 | } 33 | 34 | .nav-item ::deep a { 35 | color: #d7d7d7; 36 | border-radius: 4px; 37 | height: 3rem; 38 | display: flex; 39 | align-items: center; 40 | line-height: 3rem; 41 | } 42 | 43 | .nav-item ::deep a.active { 44 | background-color: rgba(255,255,255,0.25); 45 | color: white; 46 | } 47 | 48 | .nav-item ::deep a:hover { 49 | background-color: rgba(255,255,255,0.1); 50 | color: white; 51 | } 52 | 53 | @media (min-width: 641px) { 54 | .navbar-toggler { 55 | display: none; 56 | } 57 | 58 | .collapse { 59 | /* Never collapse the sidebar for wide screens */ 60 | display: block; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/FormBlazorClient/Shared/SurveyPrompt.razor: -------------------------------------------------------------------------------- 1 | @* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | *@ 20 |
21 | 22 | @Title 23 | 24 | 25 | Please take our 26 | brief survey 27 | 28 | and tell us what you think. 29 |
30 | 31 | @code { 32 | // Demonstrates how a parent component can supply parameters 33 | [Parameter] 34 | public string? Title { get; set; } 35 | } 36 | -------------------------------------------------------------------------------- /src/FormBlazorClient/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using FormBlazorClient 10 | @using FormBlazorClient.Shared 11 | @using FormBlazorClient.Components -------------------------------------------------------------------------------- /src/FormBlazorClient/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft.AspNetCore": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/FormBlazorClient/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /src/FormBlazorClient/global.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | global using FormBlazorClient.Model; 21 | global using FormBlazorClient.Service; 22 | global using Demo.Shared.Models; -------------------------------------------------------------------------------- /src/FormBlazorClient/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [ 5 | { 6 | "library": "font-awesome@4.7.0", 7 | "destination": "wwwroot/css/font-awesome/" 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | icon name 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | h1:focus { 8 | outline: none; 9 | } 10 | 11 | a, .btn-link { 12 | color: #0071c1; 13 | } 14 | 15 | .btn-primary { 16 | color: #fff; 17 | background-color: #1b6ec2; 18 | border-color: #1861ac; 19 | } 20 | 21 | .content { 22 | padding-top: 1.1rem; 23 | } 24 | 25 | .valid.modified:not([type=checkbox]) { 26 | outline: 1px solid #26b050; 27 | } 28 | 29 | .invalid { 30 | outline: 1px solid red; 31 | } 32 | 33 | .validation-message { 34 | color: red; 35 | } 36 | 37 | #blazor-error-ui { 38 | background: lightyellow; 39 | bottom: 0; 40 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); 41 | display: none; 42 | left: 0; 43 | padding: 0.6rem 1.25rem 0.7rem 1.25rem; 44 | position: fixed; 45 | width: 100%; 46 | z-index: 1000; 47 | } 48 | 49 | #blazor-error-ui .dismiss { 50 | cursor: pointer; 51 | position: absolute; 52 | right: 0.75rem; 53 | top: 0.5rem; 54 | } 55 | 56 | .blazor-error-boundary { 57 | background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; 58 | padding: 1rem 1rem 1rem 3.7rem; 59 | color: white; 60 | } 61 | 62 | .blazor-error-boundary::after { 63 | content: "An error has occurred." 64 | } 65 | 66 | /* Loading screen */ 67 | 68 | #splash-page { 69 | z-index: 99999 !important; 70 | } 71 | 72 | #splash-page .bar { 73 | width: 100%; 74 | } 75 | 76 | .page-splash { 77 | z-index: 99999 !important; 78 | position: fixed !important; 79 | display: table !important; 80 | top: 0; 81 | left: 0; 82 | width: 100%; 83 | height: 100%; 84 | background-color: #333; 85 | opacity: .9; 86 | pointer-events: auto; 87 | -webkit-backface-visibility: hidden; 88 | -ms-backface-visibility: hidden; 89 | -o-backface-visibility: hidden; 90 | -moz-backface-visibility: hidden; 91 | backface-visibility: hidden; 92 | /* -webkit-transition: opacity 0.3s linear; 93 | -moz-transition: opacity 0.3s linear; 94 | -o-transition: opacity 0.3s linear; 95 | transition: opacity 0.3s linear; */ 96 | } 97 | 98 | .page-splash-message { 99 | display: table-cell; 100 | vertical-align: middle !important; 101 | margin: 0 auto; 102 | text-align: center; 103 | } 104 | 105 | 106 | .page-splash-message.page-splash-message-subtle { 107 | margin: 30% auto 0 auto; 108 | font-size: 200%; 109 | } 110 | 111 | /* End loading screen */ 112 | 113 | .image-container { 114 | display: flex; 115 | padding: 15px; 116 | align-content: center; 117 | align-items: center; 118 | justify-content: center; 119 | border: 2px dashed skyblue; 120 | } 121 | 122 | .preview-image { 123 | max-height: 800px; 124 | max-width: 800px; 125 | } -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/FormBlazorClient/wwwroot/image/ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugogirard/formRecognizerDevOps/c7214a41a35badc3ce920ed1bb831b9c2bc023b7/src/FormBlazorClient/wwwroot/image/ms.png -------------------------------------------------------------------------------- /src/Shared/CopyModelParameter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace Demo.Shared.Models; 21 | 22 | public class CopyModelParameter 23 | { 24 | public string SourceModelId { get; set; } 25 | 26 | public MODEL_ENVIRONMENT SourceEnvironment { get; set; } 27 | 28 | public MODEL_ENVIRONMENT DestinationEnvironment { get; set; } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Shared/DeleteModelParameter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace Demo.Shared.Models; 21 | 22 | public class DeleteModelParameter 23 | { 24 | public string ModelId { get; set; } 25 | 26 | public MODEL_ENVIRONMENT Environment { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/Shared/Demo.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Shared/DocumentInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | using System.Text; 24 | using System.Threading.Tasks; 25 | 26 | namespace Demo.Shared.Models; 27 | 28 | public class DocumentInfo 29 | { 30 | public string ModelId { get; set; } 31 | 32 | public MODEL_ENVIRONMENT Environment { get; set; } 33 | 34 | public string DocumentUrl { get; set; } 35 | } 36 | -------------------------------------------------------------------------------- /src/Shared/DocumentResult.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System.Collections.Generic; 21 | using System.Diagnostics; 22 | 23 | namespace Demo.Shared.Models; 24 | 25 | public class DocumentResult 26 | { 27 | public string DocType { get; set; } 28 | 29 | public List Fields { get; set; } 30 | 31 | public DocumentResult() 32 | { 33 | Fields = new List(); 34 | } 35 | } 36 | 37 | public class Fields 38 | { 39 | public string FieldName { get; set; } 40 | 41 | public string Content { get; set; } 42 | 43 | public float? Confidence { get; set; } 44 | } -------------------------------------------------------------------------------- /src/Shared/Enum.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace Demo.Shared.Models; 21 | 22 | public enum MODEL_ENVIRONMENT 23 | { 24 | DEV = 0, 25 | QA, 26 | PROD 27 | } 28 | -------------------------------------------------------------------------------- /src/Shared/Model.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace Demo.Shared.Models; 21 | 22 | public class Model 23 | { 24 | public string ModelId { get; set; } 25 | 26 | public string Description { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/Shared/ModelInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using Azure.AI.FormRecognizer.DocumentAnalysis; 21 | 22 | namespace Demo.Shared.Models; 23 | 24 | public class ModelInfo 25 | { 26 | public string ModelId { get; set; } 27 | 28 | public string Description { get; set; } 29 | 30 | public DateTimeOffset CreatedOn { get; set; } 31 | 32 | public ModelInfo() 33 | { 34 | 35 | } 36 | 37 | public ModelInfo(DocumentModelSummary documentModelInfo) 38 | { 39 | ModelId = documentModelInfo.ModelId; 40 | Description = documentModelInfo.Description; 41 | CreatedOn = documentModelInfo.CreatedOn; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.32014.148 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "function", "function\function.csproj", "{7270FD33-A110-4A26-8758-2F3D8885E3A4}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FormBlazorClient", "FormBlazorClient\FormBlazorClient.csproj", "{859DD467-45DA-465C-81A2-91F1DEF14682}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B127E6C0-8F0E-49A0-AB57-73B03134E663}" 11 | ProjectSection(SolutionItems) = preProject 12 | .editorconfig = .editorconfig 13 | EndProjectSection 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Shared", "Shared\Demo.Shared.csproj", "{66E11809-3D51-4A8E-80D6-E0B434EEC055}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {7270FD33-A110-4A26-8758-2F3D8885E3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {7270FD33-A110-4A26-8758-2F3D8885E3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {7270FD33-A110-4A26-8758-2F3D8885E3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {7270FD33-A110-4A26-8758-2F3D8885E3A4}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {859DD467-45DA-465C-81A2-91F1DEF14682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {859DD467-45DA-465C-81A2-91F1DEF14682}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {859DD467-45DA-465C-81A2-91F1DEF14682}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {859DD467-45DA-465C-81A2-91F1DEF14682}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {66E11809-3D51-4A8E-80D6-E0B434EEC055}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {66E11809-3D51-4A8E-80D6-E0B434EEC055}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {66E11809-3D51-4A8E-80D6-E0B434EEC055}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {66E11809-3D51-4A8E-80D6-E0B434EEC055}.Release|Any CPU.Build.0 = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {6551ECFE-1D80-424B-A094-CDED240F5EE9} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /src/function/.editorconfig: -------------------------------------------------------------------------------- 1 | # Rules in this file were initially inferred by Visual Studio IntelliCode from the C:\github\formRecognizerDevOps\src\function\ codebase based on best match to current usage at 2022-01-06 2 | # You can modify the rules from these initially generated values to suit your own policies 3 | # You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference 4 | [*.cs] 5 | 6 | 7 | #Core editorconfig formatting - indentation 8 | 9 | #use soft tabs (spaces) for indentation 10 | indent_style = space 11 | 12 | #Formatting - new line options 13 | 14 | #place catch statements on a new line 15 | csharp_new_line_before_catch = true 16 | #place else statements on a new line 17 | csharp_new_line_before_else = true 18 | #require braces to be on a new line for control_blocks, types, and methods (also known as "Allman" style) 19 | csharp_new_line_before_open_brace = control_blocks, types, methods 20 | 21 | #Formatting - organize using options 22 | 23 | #sort System.* using directives alphabetically, and place them before other usings 24 | dotnet_sort_system_directives_first = true 25 | 26 | #Formatting - spacing options 27 | 28 | #require NO space between a cast and the value 29 | csharp_space_after_cast = false 30 | #require a space after a keyword in a control flow statement such as a for loop 31 | csharp_space_after_keywords_in_control_flow_statements = true 32 | #remove space within empty argument list parentheses 33 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 34 | #remove space between method call name and opening parenthesis 35 | csharp_space_between_method_call_name_and_opening_parenthesis = false 36 | #do not place space characters after the opening parenthesis and before the closing parenthesis of a method call 37 | csharp_space_between_method_call_parameter_list_parentheses = false 38 | #place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. 39 | csharp_space_between_method_declaration_parameter_list_parentheses = false 40 | 41 | #Formatting - wrapping options 42 | 43 | #leave code block on single line 44 | csharp_preserve_single_line_blocks = true 45 | 46 | #Style - Code block preferences 47 | 48 | #prefer curly braces even for one line of code 49 | csharp_prefer_braces = true:suggestion 50 | 51 | #Style - expression bodied member options 52 | 53 | #prefer block bodies for constructors 54 | csharp_style_expression_bodied_constructors = false:suggestion 55 | #prefer block bodies for methods 56 | csharp_style_expression_bodied_methods = false:suggestion 57 | 58 | #Style - expression level options 59 | 60 | #prefer out variables to be declared before the method call 61 | csharp_style_inlined_variable_declaration = false:suggestion 62 | #prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them 63 | dotnet_style_predefined_type_for_member_access = true:suggestion 64 | 65 | #Style - Expression-level preferences 66 | 67 | #prefer objects to be initialized using object initializers when possible 68 | dotnet_style_object_initializer = true:suggestion 69 | 70 | #Style - implicit and explicit types 71 | 72 | #prefer explicit type over var in all cases, unless overridden by another code style rule 73 | csharp_style_var_elsewhere = false:suggestion 74 | #prefer var is used to declare variables with built-in system types such as int 75 | csharp_style_var_for_built_in_types = true:suggestion 76 | #prefer var when the type is already mentioned on the right-hand side of a declaration expression 77 | csharp_style_var_when_type_is_apparent = true:suggestion 78 | 79 | #Style - language keyword and framework type options 80 | 81 | #prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them 82 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 83 | 84 | #Style - modifier options 85 | 86 | #prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. 87 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion 88 | 89 | #Style - Modifier preferences 90 | 91 | #when this rule is set to a list of modifiers, prefer the specified ordering. 92 | csharp_preferred_modifier_order = public,private,readonly,async,static,override:suggestion 93 | 94 | #Style - qualification options 95 | 96 | #prefer fields not to be prefaced with this. or Me. in Visual Basic 97 | dotnet_style_qualification_for_field = false:suggestion 98 | csharp_style_namespace_declarations=file_scoped:silent 99 | csharp_prefer_static_local_function=false:suggestion 100 | -------------------------------------------------------------------------------- /src/function/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # Azure Functions localsettings file 5 | local.settings.json 6 | 7 | # User-specific files 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | bld/ 24 | [Bb]in/ 25 | [Oo]bj/ 26 | [Ll]og/ 27 | 28 | # Visual Studio 2015 cache/options directory 29 | .vs/ 30 | # Uncomment if you have tasks that create the project's static files in wwwroot 31 | #wwwroot/ 32 | 33 | # MSTest test Results 34 | [Tt]est[Rr]esult*/ 35 | [Bb]uild[Ll]og.* 36 | 37 | # NUNIT 38 | *.VisualState.xml 39 | TestResult.xml 40 | 41 | # Build Results of an ATL Project 42 | [Dd]ebugPS/ 43 | [Rr]eleasePS/ 44 | dlldata.c 45 | 46 | # DNX 47 | project.lock.json 48 | project.fragment.lock.json 49 | artifacts/ 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # NCrunch 117 | _NCrunch_* 118 | .*crunch*.local.xml 119 | nCrunchTemp_* 120 | 121 | # MightyMoose 122 | *.mm.* 123 | AutoTest.Net/ 124 | 125 | # Web workbench (sass) 126 | .sass-cache/ 127 | 128 | # Installshield output folder 129 | [Ee]xpress/ 130 | 131 | # DocProject is a documentation generator add-in 132 | DocProject/buildhelp/ 133 | DocProject/Help/*.HxT 134 | DocProject/Help/*.HxC 135 | DocProject/Help/*.hhc 136 | DocProject/Help/*.hhk 137 | DocProject/Help/*.hhp 138 | DocProject/Help/Html2 139 | DocProject/Help/html 140 | 141 | # Click-Once directory 142 | publish/ 143 | 144 | # Publish Web Output 145 | *.[Pp]ublish.xml 146 | *.azurePubxml 147 | # TODO: Comment the next line if you want to checkin your web deploy settings 148 | # but database connection strings (with potential passwords) will be unencrypted 149 | #*.pubxml 150 | *.publishproj 151 | 152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 153 | # checkin your Azure Web App publish settings, but sensitive information contained 154 | # in these scripts will be unencrypted 155 | PublishScripts/ 156 | 157 | # NuGet Packages 158 | *.nupkg 159 | # The packages folder can be ignored because of Package Restore 160 | **/packages/* 161 | # except build/, which is used as an MSBuild target. 162 | !**/packages/build/ 163 | # Uncomment if necessary however generally it will be regenerated when needed 164 | #!**/packages/repositories.config 165 | # NuGet v3's project.json files produces more ignoreable files 166 | *.nuget.props 167 | *.nuget.targets 168 | 169 | # Microsoft Azure Build Output 170 | csx/ 171 | *.build.csdef 172 | 173 | # Microsoft Azure Emulator 174 | ecf/ 175 | rcf/ 176 | 177 | # Windows Store app package directories and files 178 | AppPackages/ 179 | BundleArtifacts/ 180 | Package.StoreAssociation.xml 181 | _pkginfo.txt 182 | 183 | # Visual Studio cache files 184 | # files ending in .cache can be ignored 185 | *.[Cc]ache 186 | # but keep track of directories ending in .cache 187 | !*.[Cc]ache/ 188 | 189 | # Others 190 | ClientBin/ 191 | ~$* 192 | *~ 193 | *.dbmdl 194 | *.dbproj.schemaview 195 | *.jfm 196 | *.pfx 197 | *.publishsettings 198 | node_modules/ 199 | orleans.codegen.cs 200 | 201 | # Since there are multiple workflows, uncomment next line to ignore bower_components 202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 203 | #bower_components/ 204 | 205 | # RIA/Silverlight projects 206 | Generated_Code/ 207 | 208 | # Backup & report files from converting an old project file 209 | # to a newer Visual Studio version. Backup files are not needed, 210 | # because we have git ;-) 211 | _UpgradeReport_Files/ 212 | Backup*/ 213 | UpgradeLog*.XML 214 | UpgradeLog*.htm 215 | 216 | # SQL Server files 217 | *.mdf 218 | *.ldf 219 | 220 | # Business Intelligence projects 221 | *.rdl.data 222 | *.bim.layout 223 | *.bim_*.settings 224 | 225 | # Microsoft Fakes 226 | FakesAssemblies/ 227 | 228 | # GhostDoc plugin setting file 229 | *.GhostDoc.xml 230 | 231 | # Node.js Tools for Visual Studio 232 | .ntvs_analysis.dat 233 | 234 | # Visual Studio 6 build log 235 | *.plg 236 | 237 | # Visual Studio 6 workspace options file 238 | *.opt 239 | 240 | # Visual Studio LightSwitch build output 241 | **/*.HTMLClient/GeneratedArtifacts 242 | **/*.DesktopClient/GeneratedArtifacts 243 | **/*.DesktopClient/ModelManifest.xml 244 | **/*.Server/GeneratedArtifacts 245 | **/*.Server/ModelManifest.xml 246 | _Pvt_Extensions 247 | 248 | # Paket dependency manager 249 | .paket/paket.exe 250 | paket-files/ 251 | 252 | # FAKE - F# Make 253 | .fake/ 254 | 255 | # JetBrains Rider 256 | .idea/ 257 | *.sln.iml 258 | 259 | # CodeRush 260 | .cr/ 261 | 262 | # Python Tools for Visual Studio (PTVS) 263 | __pycache__/ 264 | *.pyc -------------------------------------------------------------------------------- /src/function/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-azuretools.vscode-azurefunctions", 4 | "ms-dotnettools.csharp" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /src/function/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Attach to .NET Functions", 6 | "type": "coreclr", 7 | "request": "attach", 8 | "processId": "${command:azureFunctions.pickProcess}" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /src/function/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "azureFunctions.deploySubpath": "bin/Release/net6.0/publish", 3 | "azureFunctions.projectLanguage": "C#", 4 | "azureFunctions.projectRuntime": "~4", 5 | "debug.internalConsoleOptions": "neverOpen", 6 | "azureFunctions.preDeployTask": "publish (functions)" 7 | } -------------------------------------------------------------------------------- /src/function/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "clean (functions)", 6 | "command": "dotnet", 7 | "args": [ 8 | "clean", 9 | "/property:GenerateFullPaths=true", 10 | "/consoleloggerparameters:NoSummary" 11 | ], 12 | "type": "process", 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build (functions)", 17 | "command": "dotnet", 18 | "args": [ 19 | "build", 20 | "/property:GenerateFullPaths=true", 21 | "/consoleloggerparameters:NoSummary" 22 | ], 23 | "type": "process", 24 | "dependsOn": "clean (functions)", 25 | "group": { 26 | "kind": "build", 27 | "isDefault": true 28 | }, 29 | "problemMatcher": "$msCompile" 30 | }, 31 | { 32 | "label": "clean release (functions)", 33 | "command": "dotnet", 34 | "args": [ 35 | "clean", 36 | "--configuration", 37 | "Release", 38 | "/property:GenerateFullPaths=true", 39 | "/consoleloggerparameters:NoSummary" 40 | ], 41 | "type": "process", 42 | "problemMatcher": "$msCompile" 43 | }, 44 | { 45 | "label": "publish (functions)", 46 | "command": "dotnet", 47 | "args": [ 48 | "publish", 49 | "--configuration", 50 | "Release", 51 | "/property:GenerateFullPaths=true", 52 | "/consoleloggerparameters:NoSummary" 53 | ], 54 | "type": "process", 55 | "dependsOn": "clean release (functions)", 56 | "problemMatcher": "$msCompile" 57 | }, 58 | { 59 | "type": "func", 60 | "dependsOn": "build (functions)", 61 | "options": { 62 | "cwd": "${workspaceFolder}/bin/Debug/net6.0" 63 | }, 64 | "command": "host start", 65 | "isBackground": true, 66 | "problemMatcher": "$func-dotnet-watch" 67 | } 68 | ] 69 | } -------------------------------------------------------------------------------- /src/function/AnalyzeDocument.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System.Collections.Generic; 21 | 22 | namespace DemoForm; 23 | 24 | public class Document 25 | { 26 | private readonly ILogger _logger; 27 | private readonly IFormClientFactory _formClientFactory; 28 | 29 | public Document(ILogger log, IFormClientFactory formClientFactory) 30 | { 31 | _logger = log; 32 | _formClientFactory = formClientFactory; 33 | } 34 | 35 | 36 | 37 | [FunctionName("AnalyzeDocument")] 38 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 39 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 40 | [OpenApiRequestBody("application/json", typeof(DocumentInfo), Description = "The info of the document to analyze", Required = true)] 41 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Description = "The results of the form analyzer extraction")] 42 | public async Task Run( 43 | [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req) 44 | { 45 | DocumentInfo documentInfo; 46 | if (req.Body != null) 47 | { 48 | using (var sr = new StreamReader(req.Body)) 49 | { 50 | string requestBody = await sr.ReadToEndAsync(); 51 | documentInfo = JsonConvert.DeserializeObject(requestBody); 52 | 53 | var validator = new DocumentInfoParameterValidator(); 54 | var result = validator.Validate(documentInfo); 55 | 56 | if (!result.IsValid) 57 | return new BadRequestObjectResult("The parameters are invalid"); 58 | 59 | var client = _formClientFactory.CreateAnalysisClient(documentInfo.Environment); 60 | 61 | AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, 62 | documentInfo.ModelId, 63 | new Uri(documentInfo.DocumentUrl)); 64 | // This should not be done in PRODUCTION 65 | // Should query the result at a X frequency, this code is only for demo purpose 66 | await operation.WaitForCompletionAsync(); 67 | 68 | AnalyzeResult operationResult = operation.Value; 69 | var documentsResult = new List(); 70 | 71 | foreach (AnalyzedDocument document in operationResult.Documents) 72 | { 73 | var documentResult = new DocumentResult 74 | { 75 | DocType = document.DocumentType 76 | }; 77 | 78 | foreach (KeyValuePair fieldKvp in document.Fields) 79 | { 80 | string fieldName = fieldKvp.Key; 81 | DocumentField field = fieldKvp.Value; 82 | 83 | documentResult.Fields.Add(new Fields 84 | { 85 | FieldName = fieldName, 86 | Content = field.Content, 87 | Confidence = field.Confidence 88 | }); 89 | } 90 | 91 | documentsResult.Add(documentResult); 92 | } 93 | 94 | return new OkObjectResult(documentsResult); 95 | } 96 | } 97 | 98 | return new BadRequestObjectResult("The parameters are invalid"); 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /src/function/CopyModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public class CopyModel 23 | { 24 | private readonly ILogger _logger; 25 | private readonly IFormClientFactory _formClientFactory; 26 | 27 | public CopyModel(ILogger log, IFormClientFactory formClientFactory) 28 | { 29 | _logger = log; 30 | _formClientFactory = formClientFactory; 31 | } 32 | 33 | [FunctionName("CopyModel")] 34 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 35 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 36 | [OpenApiRequestBody("application/json", typeof(CopyModelParameter), Description = "The Copy Model Information", Required = false)] 37 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DocumentModelDetails), Description = "The Copy Custom Model definition")] 38 | public async Task Run( 39 | [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req) 40 | { 41 | 42 | try 43 | { 44 | CopyModelParameter copyModel; 45 | if (req.Body != null) 46 | { 47 | using (var sr = new StreamReader(req.Body)) 48 | { 49 | string requestBody = await sr.ReadToEndAsync(); 50 | copyModel = JsonConvert.DeserializeObject(requestBody); 51 | } 52 | 53 | var validator = new CopyModelParameterValidator(); 54 | var result = validator.Validate(copyModel); 55 | 56 | if (!result.IsValid) 57 | return new BadRequestObjectResult("The parameters are invalid"); 58 | 59 | var sourceClient = _formClientFactory.CreateAdministrationClient(copyModel.SourceEnvironment); 60 | var targetClient = _formClientFactory.CreateAdministrationClient(copyModel.DestinationEnvironment); 61 | 62 | // Get info of the model to copy (description) 63 | var response = await sourceClient.GetDocumentModelAsync(copyModel.SourceModelId); 64 | 65 | if (!response.GetRawResponse().Status.IsSuccessStatusCode()) 66 | return new NotFoundObjectResult("Cannot get the info of the source model"); 67 | 68 | DocumentModelCopyAuthorization copyAuthorization = await targetClient.GetCopyAuthorizationAsync(response.Value.ModelId,response.Value.Description); 69 | CopyDocumentModelToOperation newModelOperation = await sourceClient.CopyDocumentModelToAsync(WaitUntil.Completed, copyModel.SourceModelId, copyAuthorization); 70 | 71 | return new OkObjectResult(newModelOperation.Value); 72 | 73 | } 74 | else 75 | { 76 | return new BadRequestObjectResult("The CopyModel parameters cannot be null"); 77 | } 78 | } 79 | catch (Exception ex) 80 | { 81 | _logger.LogError(ex.Message, ex); 82 | return new ObjectResult("Internal Server Error") { StatusCode = 500 }; 83 | } 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/function/DeleteModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public class DeleteModel 23 | { 24 | private readonly ILogger _logger; 25 | private readonly IFormClientFactory _factory; 26 | 27 | public DeleteModel(ILogger log, IFormClientFactory factory) 28 | { 29 | _logger = log; 30 | _factory = factory; 31 | } 32 | 33 | [FunctionName("DeleteModel")] 34 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 35 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 36 | [OpenApiRequestBody("application/json", typeof(DeleteModelParameter), Description = "The Delete Parameter", Required = false)] 37 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "The OK response")] 38 | public async Task Run( 39 | [HttpTrigger(AuthorizationLevel.Function, "delete", Route = null)] HttpRequest req) 40 | { 41 | 42 | 43 | try 44 | { 45 | if (req.Body == null) 46 | return new BadRequestObjectResult("The DeleteModel parameters cannot be null"); 47 | 48 | DeleteModelParameter deleteModelParameter; 49 | using (var sr = new StreamReader(req.Body)) 50 | { 51 | string requestBody = await sr.ReadToEndAsync(); 52 | deleteModelParameter = JsonConvert.DeserializeObject(requestBody); 53 | } 54 | 55 | var validator = new DeleteModelParameterValidator(); 56 | var result = validator.Validate(deleteModelParameter); 57 | 58 | if (!result.IsValid) 59 | return new BadRequestObjectResult("The DeleteModel parameters is invalid"); 60 | 61 | var trainingClient = _factory.CreateAdministrationClient(deleteModelParameter.Environment); 62 | 63 | Response response = await trainingClient.DeleteDocumentModelAsync(deleteModelParameter.ModelId); 64 | 65 | return new ObjectResult(string.Empty) { StatusCode = response.Status }; 66 | 67 | } 68 | catch (Exception ex) 69 | { 70 | _logger.LogError(ex.Message, ex); 71 | return new ObjectResult("Internal Server Error") { StatusCode = 500 }; 72 | } 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/function/Extension/Extension.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | namespace DemoForm; 22 | 23 | public static class Extension 24 | { 25 | public static bool IsSuccessStatusCode(this int statusCode) 26 | { 27 | return ((int)statusCode >= 200) && ((int)statusCode <= 299); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/function/Factory/FormClientFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System.Collections.Generic; 21 | 22 | namespace DemoForm; 23 | 24 | public class FormClientFactory : IFormClientFactory 25 | { 26 | private readonly Dictionary _adminClients; 27 | private readonly Dictionary _analysisClients; 28 | 29 | public FormClientFactory() 30 | { 31 | _adminClients = new Dictionary(); 32 | _analysisClients = new Dictionary(); 33 | } 34 | 35 | public DocumentModelAdministrationClient CreateAdministrationClient(MODEL_ENVIRONMENT env) 36 | { 37 | if (_adminClients.ContainsKey(env)) 38 | { 39 | return _adminClients[env]; 40 | } 41 | 42 | var credential = GetAzureCredentials(env); 43 | var formRecognizerEndpoint = GetFormRecognizerEndpoint(env); 44 | 45 | var trainingClient = new DocumentModelAdministrationClient(new Uri(formRecognizerEndpoint), credential); 46 | 47 | _adminClients.Add(env, trainingClient); 48 | 49 | return trainingClient; 50 | } 51 | 52 | public DocumentAnalysisClient CreateAnalysisClient(MODEL_ENVIRONMENT env) 53 | { 54 | if (_analysisClients.ContainsKey(env)) 55 | { 56 | return _analysisClients[env]; 57 | } 58 | 59 | var credential = GetAzureCredentials(env); 60 | var formRecognizerEndpoint = GetFormRecognizerEndpoint(env); 61 | 62 | var client = new DocumentAnalysisClient(new Uri(formRecognizerEndpoint), credential); 63 | 64 | _analysisClients.Add(env, client); 65 | 66 | return client; 67 | } 68 | 69 | private AzureKeyCredential GetAzureCredentials(MODEL_ENVIRONMENT env) 70 | { 71 | string formRecognizerKey; 72 | 73 | switch (env) 74 | { 75 | case MODEL_ENVIRONMENT.DEV: 76 | formRecognizerKey = Environment.GetEnvironmentVariable("FormRecognizerDevKey"); 77 | break; 78 | case MODEL_ENVIRONMENT.QA: 79 | formRecognizerKey = Environment.GetEnvironmentVariable("FormRecognizerQaKey"); 80 | break; 81 | default: 82 | formRecognizerKey = Environment.GetEnvironmentVariable("FormRecognizerProdKey"); 83 | break; 84 | } 85 | 86 | return new AzureKeyCredential(formRecognizerKey); 87 | } 88 | 89 | private string GetFormRecognizerEndpoint(MODEL_ENVIRONMENT env) 90 | { 91 | string formRecognizerEndpoint; 92 | 93 | switch (env) 94 | { 95 | case MODEL_ENVIRONMENT.DEV: 96 | formRecognizerEndpoint = Environment.GetEnvironmentVariable("FormRecognizerDevEndpoint"); 97 | break; 98 | case MODEL_ENVIRONMENT.QA: 99 | formRecognizerEndpoint = Environment.GetEnvironmentVariable("FormRecognizerQaEndpoint"); 100 | break; 101 | default: 102 | formRecognizerEndpoint = Environment.GetEnvironmentVariable("FormRecognizerProdEndpoint"); 103 | break; 104 | } 105 | 106 | return formRecognizerEndpoint; 107 | } 108 | } -------------------------------------------------------------------------------- /src/function/Factory/IFormClientFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public interface IFormClientFactory 23 | { 24 | DocumentModelAdministrationClient CreateAdministrationClient(MODEL_ENVIRONMENT env); 25 | 26 | DocumentAnalysisClient CreateAnalysisClient(MODEL_ENVIRONMENT env); 27 | } 28 | -------------------------------------------------------------------------------- /src/function/GetModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System.Collections.Generic; 21 | 22 | namespace DemoForm; 23 | 24 | public class GetModel 25 | { 26 | private readonly ILogger _logger; 27 | private readonly IFormClientFactory _formClientFactory; 28 | 29 | public GetModel(ILogger log, IFormClientFactory factory) 30 | { 31 | _logger = log; 32 | _formClientFactory = factory; 33 | } 34 | 35 | [FunctionName("GetModel")] 36 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 37 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 38 | [OpenApiParameter(name: "environment", In = ParameterLocation.Query, Required = true, Type = typeof(MODEL_ENVIRONMENT), Description = "The environment to get the models")] 39 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Description = "The models in the environment")] 40 | public async Task Run( 41 | [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req) 42 | { 43 | 44 | try 45 | { 46 | string environment = req.Query["environment"]; 47 | 48 | if (string.IsNullOrEmpty(environment)) 49 | return new BadRequestObjectResult("The Environment query string cannot be null"); 50 | 51 | MODEL_ENVIRONMENT formEnvironment; 52 | if (!Enum.TryParse(environment, out formEnvironment)) 53 | return new BadRequestObjectResult("The Environment query string is invalid"); 54 | 55 | var trainingClient = _formClientFactory.CreateAdministrationClient(formEnvironment); 56 | 57 | AsyncPageable models = trainingClient.GetDocumentModelsAsync(); 58 | var modelsInfo = new List(); 59 | await foreach (DocumentModelSummary modelInfo in models) 60 | { 61 | // Remove the pre-build model from the list 62 | if (!modelInfo.ModelId.ToLower().Contains("prebuilt")) 63 | modelsInfo.Add(new ModelInfo(modelInfo)); 64 | } 65 | 66 | return new OkObjectResult(modelsInfo); 67 | } 68 | catch (Exception ex) 69 | { 70 | _logger.LogError(ex.Message, ex); 71 | return new ObjectResult("Internal Server Error") { StatusCode = 500 }; 72 | } 73 | 74 | 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/function/Startup.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using System; 21 | using DemoForm; 22 | using Microsoft.Azure.Functions.Extensions.DependencyInjection; 23 | using Microsoft.Extensions.DependencyInjection; 24 | 25 | [assembly: FunctionsStartup(typeof(Startup))] 26 | namespace DemoForm; 27 | public class Startup : FunctionsStartup 28 | { 29 | public override void Configure(IFunctionsHostBuilder builder) 30 | { 31 | var blobService = new BlobServiceClient(Environment.GetEnvironmentVariable("DevStorageCnxString")); 32 | var containerClient = blobService.GetBlobContainerClient(Environment.GetEnvironmentVariable("ModelContainer")); 33 | 34 | builder.Services.AddSingleton(); 35 | builder.Services.AddSingleton(containerClient); 36 | } 37 | } -------------------------------------------------------------------------------- /src/function/TrainModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public class TrainModel 23 | { 24 | private readonly ILogger _logger; 25 | private readonly IFormClientFactory _formClientFactory; 26 | private readonly BlobContainerClient _containerClient; 27 | 28 | public TrainModel(ILogger log, IFormClientFactory formClientFactory, BlobContainerClient blobContainerClient) 29 | { 30 | _logger = log; 31 | _formClientFactory = formClientFactory; 32 | _containerClient = blobContainerClient; 33 | } 34 | 35 | [FunctionName("TrainModel")] 36 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 37 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 38 | [OpenApiRequestBody("application/json",typeof(Model),Description = "The model parameter", Required = false)] 39 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DocumentModelDetails), Description = "The Custom Model definition")] 40 | public async Task Run( 41 | [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req) 42 | { 43 | try 44 | { 45 | string modelId = string.Empty; 46 | string modelDescription = string.Empty; 47 | if (req.Body != null) 48 | { 49 | using (var sr = new StreamReader(req.Body)) 50 | { 51 | string requestBody = await sr.ReadToEndAsync(); 52 | var model = JsonConvert.DeserializeObject(requestBody); 53 | modelId = model?.ModelId ?? string.Empty; 54 | modelDescription = model?.Description ?? string.Empty; 55 | } 56 | } 57 | 58 | 59 | var sas = _containerClient.GenerateSasUri(Azure.Storage.Sas.BlobContainerSasPermissions.All, 60 | DateTime.UtcNow.AddMinutes(15)); 61 | 62 | // By default the training is done in the DEV environment 63 | var trainingClient = _formClientFactory.CreateAdministrationClient(MODEL_ENVIRONMENT.DEV); 64 | 65 | var buildOptions = new BuildDocumentModelOptions(); 66 | if (!string.IsNullOrEmpty(modelDescription)) 67 | { 68 | buildOptions.Description = modelDescription; 69 | } 70 | 71 | BuildDocumentModelOperation operation; 72 | if (!string.IsNullOrEmpty(modelId)) 73 | { 74 | operation = await trainingClient.BuildDocumentModelAsync(WaitUntil.Completed, sas, DocumentBuildMode.Template, modelId, options: buildOptions); 75 | } 76 | else 77 | { 78 | operation = await trainingClient.BuildDocumentModelAsync(WaitUntil.Completed, sas, DocumentBuildMode.Template, options: buildOptions); 79 | } 80 | 81 | //Response operationResponse = await operation.WaitForCompletionAsync(); 82 | // To check response here 83 | 84 | DocumentModelDetails documentModel = operation.Value; 85 | 86 | return new OkObjectResult(documentModel); 87 | } 88 | catch (Exception ex) 89 | { 90 | _logger.LogError(ex.Message, ex); 91 | return new ObjectResult("Internal Server Error") { StatusCode = 500 }; 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /src/function/ValidateModelExists.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | using Microsoft.CodeAnalysis.VisualBasic.Syntax; 22 | 23 | namespace DemoForm; 24 | 25 | public class ValidateModelExists 26 | { 27 | private readonly ILogger _logger; 28 | private readonly IFormClientFactory _formFactory; 29 | 30 | public ValidateModelExists(ILogger log, IFormClientFactory factory) 31 | { 32 | _logger = log; 33 | _formFactory = factory; 34 | } 35 | 36 | [FunctionName("ValidateModelExists")] 37 | [OpenApiOperation(operationId: "Run", tags: new[] { "name" })] 38 | [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] 39 | [OpenApiParameter(name: "modelId", In = ParameterLocation.Query, Required = true, Type = typeof(string), Description = "The **modelId** to validate")] 40 | [OpenApiParameter(name: "environment", In = ParameterLocation.Query, Required = true, Type = typeof(MODEL_ENVIRONMENT), Description = "The **environment** where is the model located")] 41 | [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DocumentModelDetails), Description = "The Custom Model definition")] 42 | public async Task Run( 43 | [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req) 44 | { 45 | try 46 | { 47 | string modelId = req.Query["modelid"]; 48 | string environment = req.Query["environment"]; 49 | 50 | if (string.IsNullOrEmpty(modelId)) 51 | { 52 | return new BadRequestObjectResult("The modelId is required"); 53 | } 54 | 55 | MODEL_ENVIRONMENT formEnvironment; 56 | if (!Enum.TryParse(environment,out formEnvironment)) 57 | { 58 | return new BadRequestObjectResult("The environment is invalid"); 59 | } 60 | 61 | var trainingClient = _formFactory.CreateAdministrationClient(formEnvironment); 62 | 63 | Response operation = await trainingClient.GetDocumentModelAsync(modelId); 64 | 65 | return new OkObjectResult(operation.Value); 66 | 67 | } 68 | catch (RequestFailedException rex) 69 | { 70 | if (rex.Status == 404) 71 | return new NotFoundResult(); 72 | 73 | _logger.LogError(rex.Message,rex); 74 | 75 | return new ObjectResult("Something happen when retrieving the model") { StatusCode = rex.Status }; 76 | } 77 | catch (Exception ex) 78 | { 79 | _logger.LogError(ex.Message, ex); 80 | return new ObjectResult("Internal Server Error") { StatusCode = 500 }; 81 | } 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /src/function/Validator/CopyModelParameterValidator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public class CopyModelParameterValidator : AbstractValidator 23 | { 24 | public CopyModelParameterValidator() 25 | { 26 | RuleFor(p => p.SourceModelId).NotEmpty().NotNull(); 27 | RuleFor(p => p.SourceEnvironment).IsInEnum(); 28 | RuleFor(p => p.DestinationEnvironment).IsInEnum(); 29 | RuleFor(p => p.DestinationEnvironment).NotEqual(p => p.SourceEnvironment); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/function/Validator/DeleteModelParameterValidator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | using FluentValidation; 21 | 22 | namespace DemoForm; 23 | 24 | public class DeleteModelParameterValidator : AbstractValidator 25 | { 26 | public DeleteModelParameterValidator() 27 | { 28 | RuleFor(p => p.ModelId).NotNull().NotEmpty(); 29 | RuleFor(p => p.Environment).IsInEnum(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/function/Validator/DocumentInfoParameterValidator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | namespace DemoForm; 21 | 22 | public class DocumentInfoParameterValidator : AbstractValidator 23 | { 24 | public DocumentInfoParameterValidator() 25 | { 26 | RuleFor(d => d.ModelId).NotEmpty().NotNull(); 27 | RuleFor(d => d.DocumentUrl).NotEmpty().NotNull(); 28 | RuleFor(d => d.Environment).IsInEnum(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/function/function.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net6.0 4 | v4 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | PreserveNewest 20 | 21 | 22 | PreserveNewest 23 | Never 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/function/global.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Notice: Any links, references, or attachments that contain sample scripts, code, or commands comes with the following notification. 3 | * 4 | * This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. 5 | * THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 6 | * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 7 | * 8 | * We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, 9 | * provided that You agree: 10 | * 11 | * (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; 12 | * (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and 13 | * (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, 14 | * including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 15 | * 16 | * Please note: None of the conditions outlined in the disclaimer above will superseded the terms and conditions contained within the Premier Customer Services Description. 17 | * 18 | * DEMO POC - "AS IS" 19 | */ 20 | 21 | global using System.IO; 22 | global using System.Net; 23 | global using System.Threading.Tasks; 24 | global using Microsoft.AspNetCore.Http; 25 | global using Microsoft.AspNetCore.Mvc; 26 | global using Microsoft.Azure.WebJobs; 27 | global using Microsoft.Azure.WebJobs.Extensions.Http; 28 | global using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; 29 | global using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Enums; 30 | global using Microsoft.Extensions.Logging; 31 | global using Microsoft.OpenApi.Models; 32 | global using Azure.Storage.Blobs; 33 | global using System; 34 | global using Azure.AI.FormRecognizer.DocumentAnalysis; 35 | global using Azure; 36 | global using Newtonsoft.Json; 37 | global using FluentValidation; 38 | global using Azure.AI.FormRecognizer.Training; 39 | global using Demo.Shared.Models; -------------------------------------------------------------------------------- /src/function/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "logging": { 4 | "applicationInsights": { 5 | "samplingSettings": { 6 | "isEnabled": true, 7 | "excludedTypes": "Request" 8 | } 9 | } 10 | } 11 | } --------------------------------------------------------------------------------