forked from neilharvey94044/NPPES-Data-Load
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Process-MedicareDME.ps1
25 lines (18 loc) · 1.11 KB
/
Process-MedicareDME.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Transforms Medicare DME Referring NPI input file to pipe delimited file without header row
# and then loads to SQL Server table medicare_npi_hcpcs using BCP command using
# medicare_npi_hcpcs_format.xml format file
#Requires -Version 7.0
Param ( [Parameter(Mandatory=$True)] [ValidateNotNull()] [string] $npifilename, `
[Parameter(Mandatory=$False)] [ValidateNotNull()] [string] $filtercol, `
[Parameter(Mandatory=$False)] [ValidateNotNull()] [string] $filterval `
)
# Get SQL credentials
$sqlparms = ./Get-SQLCredential.ps1
$server = $sqlparms['server']
$database = $sqlparms['database']
$user = $sqlparms['userid']
$pswd = $sqlparms['password']
# Process the Medicare datafile; optional filter may be applied
python CleanCSV.py .\data\$npifilename ".\data\tmp_medicareDME.dat" $filtercol $filterval
Write-Host "Loading Medicare data into SQL Server using bcp..."
bcp dbo.medicare_npi_hcpcs_dme IN .\data\tmp_medicareDME.dat -f medicare_npi_hcpcs_dme_format.xml -e error_medicareDME.dat -m 10 -S $server -d $database -U $user -P $pswd #-T Either use -T or -U & -P depending on connection type