Public/New-FakePatientParameters.ps1

function New-FakePatientParameters {
    [OutputType([HashTable])]
    param([int]$Count = 1)
    process {
        For ($i = 0; $i -lt $Count; $i++) {
            $gender = @("male", "female") | Select-Object -skip (get-random -Min 0 -Max 2) -first 1
            $p = invoke-restmethod -Uri https://api.namefake.com/$($gender)
            $nameParts = $p.name.split(" ")
            if ($nameParts.length -gt 2) {
                if ($nameParts[0] -like "*.") {
                    $given = $p.name.split(" ")[1]
                    $family = $p.name.split(" ")[2]
                }
                else {
                    $given = $p.name.split(" ")[0]
                    $family = $p.name.split(" ")[1]
                }
            }
            elseif ($nameParts.length -eq 2) {
                $given = $p.name.split(" ")[0]
                $family = $p.name.split(" ")[1]
            }
            [HashTable]@{
                GivenName  = $given
                FamilyName = $family
                BirthDate  = [datetime]::ParseExact($p.birth_data, 'yyyy-MM-dd', $null)
                Gender     = $gender
                EMRPID     = (new-guid).ToString()
                MRN        = (new-guid).ToString()
            }
        }
    }
}