ClinicalTrialsBlueprint/README.md

7.0 KiB

Clinical Trials Matching Service Blueprint

Requirements

Clone this repository to your local drive

git clone https://github.com/microsoft/ClinicalTrialsBlueprint
cd ClinicalTrialsBlueprint

Install the Azure PowerShell module

Connect to Azure Subscription

Login-AzAccount
$account = Set-AzContext -Subscription <Your Subscription Name>

Fill Parameters

Assign a name for the matching service

$ctmServiceName = "<ctm matching service>"

also fill the parameter files with missing parameters and chosen service same as $ctmServiceName

.\arm-templates\azuredeploy-fhir.parameters.json
.\arm-templates\azuredeploy-logicapps.parameters.json
.\arm-templates\azuredeploy-ctm.parameters.json

Setup the FHIR Server

Create a Resource group for the FHIR server. It must be in a separate resource group from other resources in the blueprint becuase we are creating a Windows service plan

$fhirRg = New-AzResourceGroup -Name <fhir server group name> -Location eastus

Create the FHIR server deployment. You will to provide a admin password for the SQL server

New-AzResourceGroupDeployment -ResourceGroupName $fhirRg.ResourceGroupName `
                              -TemplateFile .\arm-templates\azuredeploy-fhir.json `
                              -TemplateParameterFile .\arm-templates\azuredeploy-fhir.parameters.json 
                              

Create secondary FHIR server

New-AzResourceGroupDeployment -ResourceGroupName $fhirRg.ResourceGroupName `
                              -TemplateFile .\arm-templates\azuredeploy-fhir.json `
                              -TemplateParameterFile .\arm-templates\azuredeploy-fhir.parameters.json `
                              -isSecondary $true

Verify that the FHIR Server is running

$metadataUrl = "https://$ctmServiceName-fhir.azurewebsites.net/metadata" 
$metadata = Invoke-WebRequest -Uri $metadataUrl
$metadata.RawContent

It will take a minute or so for the server to respond the first time.

Setup the Matching service

Create Resource Group that will contain all the resources required for the blueprint resources

$ctmRg = New-AzResourceGroup -Name <service Name> -Location eastus

Create Logic Applications to manage automatic restructuring

$logicAppsOutput = New-AzResourceGroupDeployment -ResourceGroupName $ctmRg.ResourceGroupName `
                  -TemplateFile .\arm-templates\azuredeploy-logicapps.json `
                  -TemplateParameterFile .\arm-templates\azuredeploy-logicapps.parameters.json `
                  -accountId (Get-AzContext).Account.Id

Open resource group in azure portal and authorize 2 API connections (arm and office365)

arm azure arm authorize

Create Primary Clinical Trials Matching service Azure resources

$matchingOutput = New-AzResourceGroupDeployment -ResourceGroupName $ctmRg.ResourceGroupName `
                  -TemplateFile .\arm-templates\azuredeploy-ctm.json `
                  -TemplateParameterFile .\arm-templates\azuredeploy-ctm.parameters.json 

Stopping primary structuring instance

. .\scripts\structuring.ps1
Stop-CtmStructuring -resourceGroupName $ctmRg.ResourceGroupName -containerGroupName $matchingOutput.Outputs.structuringName.Value

Create Secondary Clinical Trials Matching service that will be used as the primary service is being serviced. You need only to pass isSecondary parameter as true

$matchingSecondaryOutput = New-AzResourceGroupDeployment -ResourceGroupName $ctmRg.ResourceGroupName `
                          -TemplateFile .\arm-templates\azuredeploy-ctm.json `
                          -TemplateParameterFile .\arm-templates\azuredeploy-ctm.parameters.json `
                          -isSecondary $true 
                

Check that the TextAnalytics for Healthcare service is running and ready

$taReadyUrl = $matchingOutput.Outputs.gatewayEndpoint.Value + "/ta4h/ready"
$taReadyResponse = Invoke-WebRequest -Uri $taReadyUrl
$taReadyResponse.RawContent

Check that the Query Engine Service is running

$queryUrl = $matchingOutput.Outputs.gatewayEndpoint.Value + "/qe"
$queryResponse = Invoke-WebRequest -Uri $queryUrl
$queryResponse.RawContent

Check that the Disqualification Engine Service is running

$disqualificationUrl = $matchingOutput.Outputs.gatewayEndpoint.Value + "/disq"
$disqualificationResponse = Invoke-WebRequest -Uri $disqualificationUrl
$disqualificationResponse.RawContent

Restrict Access to service

. .\scripts\restrictAccess.ps1
Add-CTMRestrictIPs -resourceGroupName $ctmRg.ResourceGroupName -serviceName $ctmServiceName `
                   -fhirResoureGroupName $fhirRg.ResourceGroupName 

Setup the Healthcare Bot Service

Assign the Healthcare Bot service name

$botServiceName = "<healthcare bot service>"
$secondaryBotServiceName = "<secondary healthcare bot service>"

Load the marketplace script

. .\scripts\marketplace.ps1

Create the Healthcare primary and secondary bots Azure Marketplace SaaS Application

$saasSubscriptionId =  New-HbsSaaSApplication -name $botServiceName -planId free
$secondarySaaSSubscriptionId =  New-HbsSaaSApplication -name $secondaryBotServiceName -planId free

You can also see all your existing SaaS applications by running this command.

Get-HbsSaaSApplication

Deploy a primary Healthcare Bot resources for the Marketplace SaaS application you just created or already had before.

.\scripts\azuredeploy-healthcarebot.ps1 -ResourceGroup $ctmRg.ResourceGroupName `
                -saasSubscriptionId $saasSubscriptionId  -serviceName $botServiceName `
                -botLocation US -matchingOutput $matchingOutput 

You can now deploy a secondary Healthcare bot by running this command

.\scripts\azuredeploy-healthcarebot.ps1 -ResourceGroup $ctmRg.ResourceGroupName `
                -saasSubscriptionId $secondarySaaSSubscriptionId  `
                -serviceName $secondaryBotServiceName `
                -botLocation US -matchingOutput $matchingSecondaryOutput 

Configuration Change

When it's necessary to change the configuration of the matching services, Update the parameters file

.\arm-templates\azuredeploy-ctm.parameters.json

With the wanted configuration and run the following

. .\scripts\config-change.ps1
ChangeConfig -resourceGroupName <resource group name> -serviceName <service name>

Notice that, a configuration change will not be permited if a Structuring process is running.