Initiate the deployment wizard using this button:
###Validate the deployment: Ensure you are connected to the correct tenant and subscription
Connect-AzAccount -Tenant "<<your_tenant_id>>" -Subscription "<<your_subscription_id>>"
$fhirservice is the endpoint you copied in the previous step.
$fhirservice = 'https://<<your_healtcare_api_service>>'
$token = (Get-AzAccessToken -ResourceUrl $fhirservice).token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $($token)")
$headers.Add("Content-Type", "application/json")
$FhirGetMalePatients = Invoke-RestMethod "$fhirservice/Patient?gender:not=female" `
-Method 'GET' `
-Headers $headers
Write-Host $FhirGetPatient
To simplify dowloading sample data and posting it to the API you can either clone this repo and run download.ps1 or you can run edit and paste this:
$token = (Get-AzAccessToken -ResourceUrl $fhirservice).token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $($token)")
$headers.Add("Content-Type", "application/json")
function DownloadFilesFromRepo {
Param(
[string]$Owner,
[string]$Repository,
[string]$Path,
[string]$fhirservice
)
$baseUri = "https://api.github.com/"
$args = "repos/$Owner/$Repository/contents/$Path"
$wr = Invoke-WebRequest -Uri $($baseuri+$args)
$objects = $wr.Content | ConvertFrom-Json
$files = $objects | where {$_.type -eq "file"} | Select -exp download_url
$directories = $objects | where {$_.type -eq "dir"}
$directories | ForEach-Object {
DownloadFilesFromRepo -Owner $Owner -Repository $Repository -Path $_.path -DestinationPath $($DestinationPath+$_.name)
}
foreach ($file in $files[0]) {
$dlfile = Invoke-WebRequest -Uri $file
try {
$FhirGetPatient = Invoke-RestMethod "$fhirservice/" `
-Method 'POST' `
-Headers $headers `
-Body $dlfile
Write-Host $file
} catch {
throw "Unable to download '$($file)' Patient: '$($FhirGetPatient)'"
}
}
}
DownloadFilesFromRepo -Owner 'esbran' -Repository 'CatHealthAPI' -Path 'sampledata/fhir/' -fhirservice 'https://{<<your_fhir_service>>}.azurehealthcareapis.com'
Remember to replace <<your_fhir_service>> in the last line before running the function DownloadFilesFromRepo.
Exsample of a search that returns all non-femail patients:
$FhirGetMalePatients = Invoke-RestMethod "$fhirservice/Patient?gender:not=female" `
-Method 'GET' `
-Headers $headers
Write-Host $FhirGetPatient
Other examples can be found here: FHIR Search
There are a few known issues:
- Existing storage account and existing workspace is currently not mapped
- Container for storage account must be created post deployment (will be fixed shortly)
- FHIR sync agent is coming shortly
- FHIR proxy is coming shortly