orangeslice 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,190 +0,0 @@
1
- # Healthcare NPI Database Service
2
-
3
- Execute SQL queries against the NPI (National Provider Identifier) healthcare database containing 1.8M+ healthcare organizations.
4
-
5
- ## Usage
6
-
7
- ```typescript
8
- const result = await services.healthcare.npi({ query: "SELECT * FROM healthcare_orgs WHERE state = 'CA' LIMIT 10" });
9
- // result.rows: Array of matching records
10
- // result.rowCount: Number of rows returned
11
- ```
12
-
13
- ## Schema
14
-
15
- ```
16
- taxonomy_codes (884 rows) - Specialty lookup table
17
- ├── code (PK, e.g., "207RC0000X")
18
- ├── title ("Cardiovascular Disease Physician")
19
- ├── definition (full description)
20
- ├── provider_type ("Allopathic & Osteopathic Physicians")
21
- ├── classification ("Internal Medicine")
22
- ├── specialization ("Cardiovascular Disease")
23
- └── hierarchy[] (full path array)
24
-
25
- healthcare_orgs (1.8M rows) - Organizations
26
- ├── npi (PK, 10-digit identifier)
27
- ├── name, other_name
28
- ├── address_line1, address_line2, city, state, zip, phone
29
- ├── is_subpart, parent_org_name
30
- └── enumeration_date, last_update_date
31
-
32
- org_taxonomies (2.6M rows) - Junction table
33
- ├── npi → healthcare_orgs
34
- ├── taxonomy_code → taxonomy_codes
35
- ├── is_primary (boolean)
36
- └── position (1-15)
37
- ```
38
-
39
- ## Query Patterns
40
-
41
- ### 1. Find taxonomy codes first (fast, 35ms)
42
-
43
- ```typescript
44
- const result = await services.healthcare.npi({
45
- query: `
46
- SELECT code, title, classification, specialization
47
- FROM taxonomy_codes
48
- WHERE to_tsvector('english', title || ' ' || COALESCE(definition,''))
49
- @@ to_tsquery('cardiology | heart')
50
- `
51
- });
52
- ```
53
-
54
- ### 2. Query orgs by taxonomy
55
-
56
- ```typescript
57
- const result = await services.healthcare.npi({
58
- query: `
59
- SELECT o.name, o.city, o.state, t.title
60
- FROM healthcare_orgs o
61
- JOIN org_taxonomies ot ON o.npi = ot.npi
62
- JOIN taxonomy_codes t ON ot.taxonomy_code = t.code
63
- WHERE o.state = 'CA'
64
- AND t.classification = 'Internal Medicine'
65
- LIMIT 100
66
- `
67
- });
68
- ```
69
-
70
- ### 3. Search orgs by name
71
-
72
- ```typescript
73
- const result = await services.healthcare.npi({
74
- query: `
75
- SELECT npi, name, city, state
76
- FROM healthcare_orgs
77
- WHERE to_tsvector('english', name) @@ to_tsquery('kaiser & permanente')
78
- LIMIT 50
79
- `
80
- });
81
- ```
82
-
83
- ### 4. Filter by provider_type
84
-
85
- ```typescript
86
- // provider_type values: Hospitals, Ambulatory Health Care Facilities,
87
- // Agencies, Suppliers, Allopathic & Osteopathic Physicians, etc.
88
- const result = await services.healthcare.npi({
89
- query: `
90
- SELECT o.name, o.city FROM healthcare_orgs o
91
- JOIN org_taxonomies ot ON o.npi = ot.npi
92
- JOIN taxonomy_codes t ON ot.taxonomy_code = t.code
93
- WHERE t.provider_type = 'Hospitals' AND o.state = 'TX'
94
- LIMIT 100
95
- `
96
- });
97
- ```
98
-
99
- ### 5. Get all services for an org
100
-
101
- ```typescript
102
- const result = await services.healthcare.npi({
103
- query: `
104
- SELECT t.title, t.specialization
105
- FROM org_taxonomies ot
106
- JOIN taxonomy_codes t ON ot.taxonomy_code = t.code
107
- WHERE ot.npi = 1234567890
108
- ORDER BY ot.position
109
- `
110
- });
111
- ```
112
-
113
- ### 6. Find multi-specialty orgs
114
-
115
- ```typescript
116
- const result = await services.healthcare.npi({
117
- query: `
118
- SELECT o.name, o.city, COUNT(*) as specialties
119
- FROM healthcare_orgs o
120
- JOIN org_taxonomies ot ON o.npi = ot.npi
121
- GROUP BY o.npi, o.name, o.city
122
- HAVING COUNT(*) >= 3
123
- LIMIT 10
124
- `
125
- });
126
- ```
127
-
128
- ### 7. Find subparts of a parent
129
-
130
- ```typescript
131
- const result = await services.healthcare.npi({
132
- query: `
133
- SELECT name, city, state
134
- FROM healthcare_orgs
135
- WHERE parent_org_name ILIKE '%kaiser%'
136
- LIMIT 50
137
- `
138
- });
139
- ```
140
-
141
- ## Key provider_type Values
142
-
143
- - `Hospitals`
144
- - `Ambulatory Health Care Facilities` (clinics)
145
- - `Agencies` (home health, hospice)
146
- - `Suppliers` (DME, pharmacy)
147
- - `Allopathic & Osteopathic Physicians`
148
- - `Nursing & Custodial Care Facilities`
149
- - `Behavioral Health & Social Service Providers`
150
- - `Dental Providers`
151
- - `Transportation Services`
152
-
153
- ## Key classification Values
154
-
155
- - `Clinic/Center`, `Internal Medicine`, `Pediatrics`
156
- - `Family Medicine`, `General Acute Care Hospital`
157
- - `Skilled Nursing Facility`, `Pharmacy`
158
- - `Dentist`, `Physical Therapist`, `Radiology`
159
-
160
- **Credits: 1/result (per-result). Reserves based on query `LIMIT`.**
161
-
162
- ## LIMIT Guidelines
163
-
164
- ### Exploration (use small limits)
165
-
166
- ```sql
167
- -- Test with small limit first - 5 credits
168
- SELECT * FROM healthcare_orgs WHERE state = 'TX' LIMIT 5
169
- ```
170
-
171
- ### Data Extraction
172
-
173
- ```sql
174
- -- 100 rows = 100 credits
175
- SELECT npi, name, city, state
176
- FROM healthcare_orgs
177
- WHERE state = 'CA'
178
- LIMIT 100
179
- ```
180
-
181
- ## Tips
182
-
183
- - **Always include LIMIT** - The database has 1.8M+ rows
184
- - Always search `taxonomy_codes` first to find relevant codes
185
- - Use `ILIKE '%term%'` for partial matches on text fields
186
- - Use `to_tsquery()` for full-text search (faster)
187
- - State codes are uppercase 2-letter (CA, TX, NY)
188
- - Cities are uppercase (LOS ANGELES, NEW YORK)
189
- - Join through `org_taxonomies` for specialty filtering
190
- - Only SELECT queries are allowed (no INSERT, UPDATE, DELETE)