Public/Get-ObservationsForPatient.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<#
    .SYNOPSIS
    Query observations from salesforce for a specific patient.

    .DESCRIPTION
    Each object in the array contains the members
        - Id

    .INPUTS
    None. You cannot pipe objects to Get-ObservationsForPatient.

    .OUTPUTS
    An array of PSObject

    .PARAMETER Patient
    A patient PSObject from Get-Patients

    .EXAMPLE
    C:\PS> $observations = Get-ObservationsForPatient -Patient (Get-Patients -SelectCdrIds @("41dd4997-9d17-4527-8e86-6bdf4a102173"))

    .LINK
    See Get-Patients

    .NOTES
    Assumes config is initialized for org access.
#>

function Get-ObservationsForPatient {
    param([PSObject]$Patient)
    Invoke-SfQuery "SELECT Id FROM phecc__Observation__c WHERE phecc__Patient__c='$($Patient.sfPatient.Id)'"
}