forked from neilharvey94044/NPPES-Data-Load
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nppes_code_values.sql
330 lines (263 loc) · 8.37 KB
/
nppes_code_values.sql
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
-- NPPES Code Table Values as per the NPPES_Data_Dissemination_CodeValues.pdf document
-- Includes table creation, indexes, Foreign Key and data population scripts
-- It should be noted that not everything may have a Foreign Key. The State table in particular contains
-- much more than the US State codes. There are full names of regions, states and countries from other parts
-- of the world.
--The references shown here (eg, 1.1) are taken from the source document.
---------------------------------------
-- 1.1 Entity Type Codes
---------------------------------------
If OBJECT_ID('npi_entity_type', 'U') IS NOT NULL
DROP TABLE [npi_entity_type]
GO
CREATE TABLE [dbo].[npi_entity_type] (
[Entity_Type_Code] int,
[Entity_Type_Description] varchar(50)
)
CREATE INDEX npi_entity_type_idx on [dbo].[npi_entity_type] (Entity_Type_Code);
GO
INSERT INTO npi_entity_type
(Entity_Type_Code,
Entity_Type_Description)
VALUES
(1,
'Individual');
INSERT INTO npi_entity_type
(Entity_Type_Code,
Entity_Type_Description)
VALUES
(2,
'Organization');
---------------------------------------
-- 1.2 Sole Proprietor Codes
---------------------------------------
If OBJECT_ID('npi_proprietor', 'U') IS NOT NULL
DROP TABLE [npi_proprietor]
GO
CREATE TABLE [dbo].[npi_proprietor] (
[Sole_Proprietor_Code] varchar(1),
[Sole_Proprietor_Desc] varchar(20)
)
INSERT INTO [dbo].[npi_proprietor]
([Sole_Proprietor_Code],
[Sole_Proprietor_Desc])
VALUES
('X',
'Not Answered')
INSERT INTO [dbo].[npi_proprietor]
([Sole_Proprietor_Code],
[Sole_Proprietor_Desc])
VALUES
('Y',
'Yes')
INSERT INTO [dbo].[npi_proprietor]
([Sole_Proprietor_Code],
[Sole_Proprietor_Desc])
VALUES
('N',
'No')
---------------------------------------
-- 1.3 Subpart Codes
---------------------------------------
If OBJECT_ID('npi_subpart', 'U') IS NOT NULL
DROP TABLE [npi_subpart]
GO
CREATE TABLE [dbo].[npi_subpart] (
[Subpart_Code] varchar(1),
[Subpart_Desc] varchar(20)
)
INSERT INTO [dbo].[npi_subpart]
([Subpart_Code],
[Subpart_Desc])
VALUES
('X',
'Not Answered')
INSERT INTO [dbo].[npi_subpart]
([Subpart_Code],
[Subpart_Desc])
VALUES
('Y',
'Yes')
INSERT INTO [dbo].[npi_subpart]
([Subpart_Code],
[Subpart_Desc])
VALUES
('N',
'No')
---------------------------------------
-- 1.4 Gender Codes
---------------------------------------
If OBJECT_ID('npi_gender', 'U') IS NOT NULL
DROP TABLE [npi_gender]
GO
CREATE TABLE [dbo].[npi_gender] (
[Gender_Code] varchar(1),
[Gender_Desc] varchar(6)
)
INSERT INTO [dbo].[npi_gender]
([Gender_Code],
[Gender_Desc])
VALUES
('M',
'Male')
INSERT INTO [dbo].[npi_gender]
([Gender_Code],
[Gender_Desc])
VALUES
('F',
'Female')
---------------------------------------
-- 1.5 Deactivation Reason Codes
---------------------------------------
--The fields NPI_Deactivation_Reason_Code does not seem to be populated
--and according to the documentaiton, there are no codes used as the description
--would be used directly as a value. No reference table is needed.
-----------------------------------------
-- 1.6 Other Provider Name Type Codes
-----------------------------------------
If OBJECT_ID('npi_other_provider_name_type', 'U') IS NOT NULL
DROP TABLE [npi_other_provider_name_type]
GO
CREATE TABLE [dbo].[npi_other_provider_name_type](
[Name_Type_Code] varchar(1),
[Name_Type_Desc] varchar(26),
[Entity Name Type Code] varchar(20)
)
INSERT INTO [dbo].[npi_other_provider_name_type]
([Name_Type_Code],
[Name_Type_Desc],
[Entity Name Type Code])
VALUES
('1',
'Former Name',
'I - Individual')
INSERT INTO [dbo].[npi_other_provider_name_type]
([Name_Type_Code],
[Name_Type_Desc],
[Entity Name Type Code])
VALUES
('2',
'Professional Name',
'I - Individual')
INSERT INTO [dbo].[npi_other_provider_name_type]
([Name_Type_Code],
[Name_Type_Desc],
[Entity Name Type Code])
VALUES
('3',
'Doing Business As',
'O - Organization')
INSERT INTO [dbo].[npi_other_provider_name_type]
([Name_Type_Code],
[Name_Type_Desc],
[Entity Name Type Code])
VALUES
('4',
'Former Legal Business Name',
'O - Organization')
INSERT INTO [dbo].[npi_other_provider_name_type]
([Name_Type_Code],
[Name_Type_Desc],
[Entity Name Type Code])
VALUES
('5',
'Other Name',
'B - Both')
-------------------------------------
-- 1.7 Name Prefix Codes
-------------------------------------
--It is not necessary to create this reference table because the codes
--are exactly the same as the descriptions. For example 'Mr.' maps to 'Mr.'
-------------------------------------
-- 1.8 Name Suffix Codes
-------------------------------------
--It is not necessary to create this reference table because the codes
--are exactly the same as the descriptions. For example 'Jr.' maps to 'Jr.'
-------------------------------------
-- 1.9 State Codes
-------------------------------------
If OBJECT_ID('npi_state', 'U') IS NOT NULL
DROP TABLE [npi_state]
GO
CREATE TABLE [dbo].[npi_state](
[State_Reference_Code] varchar(2),
[State_Name] varchar(50),
[State_Type_Code] varchar(1)
)
--NB - Load will be done by BCP command line command elsewhere using
-- the npi_state.dat data file
-------------------------------------
-- 1.10 Country Codes
-------------------------------------
If OBJECT_ID('npi_country', 'U') IS NOT NULL
DROP TABLE [npi_country]
GO
CREATE TABLE [dbo].[npi_country](
[Country_Code] varchar(2),
[Country_Name] varchar(50)
)
--NB - Load will be done by BCP command line command elsewhere using
-- the npi_country.dat data file
--------------------------------------------------
-- 1.11 Other Provider Identifirer Issuer Codes
--------------------------------------------------
If OBJECT_ID('npi_other_provider_issuer', 'U') IS NOT NULL
DROP TABLE [npi_other_provider_issuer]
GO
CREATE TABLE [dbo].[npi_other_provider_issuer](
[Other_Provider_Type_Code] varchar(2),
[Other_Provider_Type_Desc] varchar(8)
)
INSERT INTO [dbo].[npi_other_provider_issuer]
([Other_Provider_Type_Code],
[Other_Provider_Type_Desc])
VALUES
('01',
'OTHER')
INSERT INTO [dbo].[npi_other_provider_issuer]
([Other_Provider_Type_Code],
[Other_Provider_Type_Desc])
VALUES
('05',
'MEDICAID')
Other_Provider_Identifier_Type_Code varchar(2)
-------------------------------------
-- 1.12 Taxonomy Codes
-------------------------------------
--Taxonomy codes are handled in its own script since it requires downloading
--directly from the source site and transforming before being loaded
-------------------------------------
-- 1.13 Primary Taxonomy
-------------------------------------
If OBJECT_ID('npi_primary_taxonomy', 'U') IS NOT NULL
DROP TABLE [npi_primary_taxonomy]
GO
CREATE TABLE [dbo.][npi_primary_taxonomy(
[Primary_Taxonomy_Switch_Code].[
)
Primary_Taxoinomy_Switch_Code varchar(1)
-------------------------------------
-- 1.14 Postal Codes
-------------------------------------
--No reference chart needed as these are ZIP codes and are self-referencing
-------------------------------------
-- 1.15 Group Taxonomy
-------------------------------------
If OBJECT_ID('npi_group_taxonomy', 'U') IS NOT NULL
DROP TABLE [npi_group_taxonomy]
GO
group_taxonomy_code varchar(10)
-------------------------------------
-- 1.16 Endpoint Type Codes
-------------------------------------
If OBJECT_ID('npi_endpoint_type', 'U') IS NOT NULL
DROP TABLE [npi_endpoint_type]
GO
endpoint_type varchar(7)
-------------------------------------
-- 1.17 Endpoint Affiliation
-------------------------------------
If OBJECT_ID('npi_endpoint_affiliation', 'U') IS NOT NULL
DROP TABLE [npi_endpoint_affiliation]
GO
endpoint_affiliation_code varchar(1)