mphapi 0.3.0__py3-none-any.whl → 0.4.1__py3-none-any.whl

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.
mphapi/claim.py CHANGED
@@ -1,24 +1,17 @@
1
1
  from enum import Enum, IntEnum
2
- from typing import Optional
2
+ from typing import Annotated, Optional
3
3
 
4
- from pydantic import AliasGenerator, BaseModel, ConfigDict, Field
5
- from pydantic.alias_generators import to_camel
4
+ from pydantic import BaseModel, Field
6
5
 
7
6
  from .date import Date
8
-
9
- camel_case_model_config = ConfigDict(
10
- alias_generator=AliasGenerator(
11
- validation_alias=to_camel, serialization_alias=to_camel
12
- ),
13
- populate_by_name=True,
14
- )
7
+ from .fields import camel_case_model_config, field_name
15
8
 
16
9
 
17
10
  class FormType(str, Enum):
18
11
  """Type of form used to submit the claim. Can be HCFA or UB-04 (from CLM05_02)"""
19
12
 
20
- HCFA = "HCFA"
21
13
  UB_04 = "UB-04"
14
+ HCFA = "HCFA"
22
15
 
23
16
 
24
17
  class BillTypeSequence(str, Enum):
@@ -26,24 +19,24 @@ class BillTypeSequence(str, Enum):
26
19
  Discharge, 7: Replacement, etc.) (from CLM05_03)
27
20
  """
28
21
 
29
- NON_PAY = "G"
30
- ADMIT_THROUGH_DISCHARGE = "H"
31
- FIRST_INTERIM = "I"
32
- CONTINUING_INTERIM = "J"
33
- LAST_INTERIM = "K"
34
- LATE_CHARGE = "M"
35
- FIRST_INTERIM_DEPRECATED = "P"
36
- REPLACEMENT = "Q"
37
- VOID_OR_CANCEL = "0"
38
- FINAL_CLAIM = "1"
39
- CWF_ADJUSTMENT = "2"
40
- CMS_ADJUSTMENT = "3"
41
- INTERMEDIARY_ADJUSTMENT = "4"
42
- OTHER_ADJUSTMENT = "5"
43
- OIG_ADJUSTMENT = "6"
44
- MSP_ADJUSTMENT = "7"
45
- QIO_ADJUSTMENT = "8"
46
- PROVIDER_ADJUSTMENT = "9"
22
+ NON_PAY = "0"
23
+ ADMIT_THROUGH_DISCHARGE = "1"
24
+ FIRST_INTERIM = "2"
25
+ CONTINUING_INTERIM = "3"
26
+ LAST_INTERIM = "4"
27
+ LATE_CHARGE = "5"
28
+ FIRST_INTERIM_DEPRECATED = "6"
29
+ REPLACEMENT = "7"
30
+ VOID_OR_CANCEL = "8"
31
+ FINAL_CLAIM = "9"
32
+ CWF_ADJUSTMENT = "G"
33
+ CMS_ADJUSTMENT = "H"
34
+ INTERMEDIARY_ADJUSTMENT = "I"
35
+ OTHER_ADJUSTMENT = "J"
36
+ OIG_ADJUSTMENT = "K"
37
+ MSP_ADJUSTMENT = "M"
38
+ QIO_ADJUSTMENT = "P"
39
+ PROVIDER_ADJUSTMENT = "Q"
47
40
 
48
41
 
49
42
  class SexType(IntEnum):
@@ -55,12 +48,17 @@ class SexType(IntEnum):
55
48
 
56
49
 
57
50
  class Provider(BaseModel):
51
+ """
52
+ Provider represents the service provider that rendered healthcare services on behalf of the patient.
53
+ This can be found in Loop 2000A and/or Loop 2310 NM101-77 at the claim level, and may also be overridden at the service level in the 2400 loop
54
+ """
55
+
58
56
  model_config = camel_case_model_config
59
57
 
60
58
  npi: str
61
59
  """National Provider Identifier of the provider (from NM109, required)"""
62
60
 
63
- provider_tax_id: Optional[str] = None
61
+ provider_tax_id: Annotated[Optional[str], field_name("providerTaxID")] = None
64
62
  """City of the provider (from N401, highly recommended)"""
65
63
 
66
64
  provider_phones: Optional[list[str]] = None
@@ -102,31 +100,30 @@ class Provider(BaseModel):
102
100
  provider_state: Optional[str] = None
103
101
  """Address line 2 of the provider (from N302, optional)"""
104
102
 
105
- provider_zip: str
103
+ provider_zip: Annotated[str, field_name("providerZIP")]
106
104
  """ZIP code of the provider (from N403, required)"""
107
105
 
108
106
 
109
107
  class ValueCode(BaseModel):
110
- """Code indicating the type of value provided (from HIxx_02)"""
111
-
112
108
  model_config = camel_case_model_config
113
109
 
114
110
  code: str
111
+ """Code indicating the type of value provided (from HIxx_02)"""
115
112
 
116
- """Amount associated with the value code (from HIxx_05)"""
117
113
  amount: float
114
+ """Amount associated with the value code (from HIxx_05)"""
118
115
 
119
116
 
120
117
  class Diagnosis(BaseModel):
121
- """Principal ICD diagnosis for the patient (from HI ABK or BK)"""
118
+ """Principal, Other Diagnosis, Admitting Diagnosis, External Cause of Injury"""
122
119
 
123
120
  model_config = camel_case_model_config
124
121
 
125
122
  code: str
126
- """ICD code for the diagnosis"""
123
+ """ICD-10 diagnosis code (from HIxx_02)"""
127
124
 
128
- description: Optional[str] = None
129
- """Description of the diagnosis"""
125
+ present_on_admission: Optional[str] = None
126
+ """Flag indicates whether diagnosis was present at the time of admission (from HIxx_09)"""
130
127
 
131
128
 
132
129
  class Service(BaseModel):
@@ -144,6 +141,8 @@ class Service(BaseModel):
144
141
  procedure_code: Optional[str] = None
145
142
  """Procedure code (from SV101_02 / SV202_02)"""
146
143
 
144
+ hipps_code: Optional[str] = None
145
+
147
146
  procedure_modifiers: Optional[list[str]] = None
148
147
  """Procedure modifiers (from SV101_03, 4, 5, 6 / SV202_03, 4, 5, 6)"""
149
148
 
@@ -177,14 +176,16 @@ class Service(BaseModel):
177
176
  diagnosis_pointers: Optional[list[int]] = None
178
177
  """Diagnosis pointers (from SV107)"""
179
178
 
180
- ambulance_pickup_zip: Optional[str] = None
179
+ ambulance_pickup_zip: Annotated[Optional[str], field_name("ambulancePickupZIP")] = (
180
+ None
181
+ )
181
182
  """ZIP code where ambulance picked up patient. Supplied if different than claim-level value (from NM1 PW)"""
182
183
 
183
184
 
184
185
  class Claim(Provider, BaseModel):
185
186
  model_config = camel_case_model_config
186
187
 
187
- claim_id: Optional[str] = None
188
+ claim_id: Annotated[Optional[str], field_name("claimID")] = None
188
189
  """Unique identifier for the claim (from REF D9)"""
189
190
 
190
191
  plan_code: Optional[str] = None
@@ -198,13 +199,19 @@ class Claim(Provider, BaseModel):
198
199
  patient_date_of_birth: Optional[Date] = None
199
200
  """Patient date of birth (from DMG03)"""
200
201
 
201
- patient_height_in_cm: Optional[float] = None
202
+ patient_height_in_cm: Annotated[
203
+ Optional[float], field_name("patientHeightInCM")
204
+ ] = None
202
205
  """Patient height in centimeters (from HI value A9, MEA value HT)"""
203
206
 
204
- patient_weight_in_kg: Optional[float] = None
207
+ patient_weight_in_kg: Annotated[
208
+ Optional[float], field_name("patientWeightInKG")
209
+ ] = None
205
210
  """Patient weight in kilograms (from HI value A8, PAT08, CR102 [ambulance only])"""
206
211
 
207
- ambulance_pickup_zip: Optional[str] = None
212
+ ambulance_pickup_zip: Annotated[Optional[str], field_name("ambulancePickupZIP")] = (
213
+ None
214
+ )
208
215
  """Location where patient was picked up in ambulance (from HI with HIxx_01=BE and HIxx_02=A0
209
216
  or NM1 loop with NM1 PW)
210
217
  """
@@ -212,13 +219,11 @@ class Claim(Provider, BaseModel):
212
219
  form_type: Optional[FormType] = None
213
220
  """Type of form used to submit the claim. Can be HCFA or UB-04 (from CLM05_02)"""
214
221
 
215
- bill_type_or_pos: Optional[str] = None
222
+ bill_type_or_pos: Annotated[Optional[str], field_name("billTypeOrPOS")] = None
216
223
  """Describes type of facility where services were rendered (from CLM05_01)"""
217
224
 
218
225
  bill_type_sequence: Optional[BillTypeSequence] = None
219
- """Where the claim is at in its billing lifecycle (e.g. 0: Non-Pay, 1: Admit Through
220
- Discharge, 7: Replacement, etc.) (from CLM05_03)
221
- """
226
+ """Where the claim is at in its billing lifecycle (e.g. 0: Non-Pay, 1: Admit Through Discharge, 7: Replacement, etc.) (from CLM05_03)"""
222
227
 
223
228
  billed_amount: Optional[float] = None
224
229
  """Billed amount from provider (from CLM02)"""
@@ -272,16 +277,16 @@ class Claim(Provider, BaseModel):
272
277
  class RateSheetService(BaseModel):
273
278
  model_config = camel_case_model_config
274
279
 
275
- procedure_code: str
280
+ procedure_code: Optional[str] = None
276
281
  """Procedure code (from SV101_02 / SV202_02)"""
277
282
 
278
- procedure_modifiers: list[str]
283
+ procedure_modifiers: Optional[list[str]] = None
279
284
  """Procedure modifiers (from SV101_03, 4, 5, 6 / SV202_03, 4, 5, 6)"""
280
285
 
281
- billed_amount: float
286
+ billed_amount: Optional[float] = None
282
287
  """Billed charge for the service (from SV102 / SV203)"""
283
288
 
284
- allowed_amount: float
289
+ allowed_amount: Optional[float] = None
285
290
  """Plan allowed amount for the service (non-EDI)"""
286
291
 
287
292
 
@@ -289,44 +294,44 @@ class RateSheet(BaseModel):
289
294
  npi: str
290
295
  """National Provider Identifier of the provider (from NM109, required)"""
291
296
 
292
- provider_first_name: str
297
+ provider_first_name: Optional[str] = None
293
298
  """First name of the provider (NM104, highly recommended)"""
294
299
 
295
- provider_last_name: str
300
+ provider_last_name: Optional[str] = None
296
301
  """Last name of the provider (from NM103, highly recommended)"""
297
302
 
298
- provider_org_name: str
303
+ provider_org_name: Optional[str] = None
299
304
  """Organization name of the provider (from NM103, highly recommended)"""
300
305
 
301
- provider_address: str
306
+ provider_address: Optional[str] = None
302
307
  """Address of the provider (from N301, highly recommended)"""
303
308
 
304
- provider_city: str
309
+ provider_city: Optional[str] = None
305
310
  """City of the provider (from N401, highly recommended)"""
306
311
 
307
- provider_state: str
312
+ provider_state: Optional[str] = None
308
313
  """State of the provider (from N402, highly recommended)"""
309
314
 
310
- provider_zip: str
315
+ provider_zip: Annotated[str, field_name("providerZIP")]
311
316
  """ZIP code of the provider (from N403, required)"""
312
317
 
313
- form_type: FormType
318
+ form_type: Optional[FormType] = None
314
319
  """Type of form used to submit the claim. Can be HCFA or UB-04 (from CLM05_02)"""
315
320
 
316
- bill_type_or_pos: str
321
+ bill_type_or_pos: Annotated[Optional[str], field_name("billTypeOrPOS")] = None
317
322
  """Describes type of facility where services were rendered (from CLM05_01)"""
318
323
 
319
- drg: str
324
+ drg: Optional[str] = None
320
325
  """Diagnosis Related Group for inpatient services (from HI DR)"""
321
326
 
322
- billed_amount: float
327
+ billed_amount: Optional[float] = None
323
328
  """Billed amount from provider (from CLM02)"""
324
329
 
325
- allowed_amount: float
330
+ allowed_amount: Optional[float] = None
326
331
  """Amount allowed by the plan for payment. Both member and plan responsibility (non-EDI)"""
327
332
 
328
- paid_amount: float
333
+ paid_amount: Optional[float] = None
329
334
  """Amount paid by the plan for the claim (non-EDI)"""
330
335
 
331
- services: list[RateSheetService]
336
+ services: Optional[list[RateSheetService]] = None
332
337
  """One or more services provided to the patient (from LX loop)"""
mphapi/fields.py ADDED
@@ -0,0 +1,17 @@
1
+ from typing import Any
2
+
3
+ from pydantic import AliasGenerator, ConfigDict, Field
4
+ from pydantic.alias_generators import to_camel
5
+
6
+ camel_case_model_config = ConfigDict(
7
+ alias_generator=AliasGenerator(
8
+ validation_alias=to_camel, serialization_alias=to_camel
9
+ ),
10
+ populate_by_name=True,
11
+ )
12
+
13
+
14
+ # The return value of Field itself is typed as Any even though it's technically always of type `FieldInfo`.
15
+ # For once this unsoundness is desired, as it's meant to be assignable to any field type.
16
+ def field_name(alias: str) -> Any:
17
+ return Field(validation_alias=alias, serialization_alias=alias)
mphapi/pricing.py CHANGED
@@ -1,9 +1,9 @@
1
1
  from enum import Enum
2
- from typing import Optional
2
+ from typing import Annotated, Optional
3
3
 
4
4
  from pydantic import BaseModel, Field
5
5
 
6
- from .claim import camel_case_model_config
6
+ from .fields import camel_case_model_config, field_name
7
7
  from .response import ResponseError
8
8
 
9
9
 
@@ -20,22 +20,22 @@ class ClaimRepricingCode(str, Enum):
20
20
  class LineRepricingCode(str, Enum):
21
21
  # line-level Medicare repricing codes
22
22
  MEDICARE = "MED"
23
- SYNTHETIC_MEDICARE = "SYN"
24
- COST_PERCENT = "CST"
25
23
  MEDICARE_PERCENT = "MPT"
26
24
  MEDICARE_NO_OUTLIER = "MNO"
25
+ SYNTHETIC_MEDICARE = "SYN"
27
26
  BILLED_PERCENT = "BIL"
28
27
  FEE_SCHEDULE = "FSC"
29
28
  PER_DIEM = "PDM"
30
29
  FLAT_RATE = "FLT"
30
+ COST_PERCENT = "CST"
31
31
  LIMITED_TO_BILLED = "LTB"
32
32
 
33
33
  # line-level zero dollar repricing explanations
34
+ NOT_REPRICED_PER_REQUEST = "NRP"
34
35
  NOT_ALLOWED_BY_MEDICARE = "NAM"
35
36
  PACKAGED = "PKG"
36
37
  NEEDS_MORE_INFO = "IFO"
37
38
  PROCEDURE_CODE_PROBLEM = "CPB"
38
- NOT_REPRICED_PER_REQUEST = "NRP"
39
39
 
40
40
 
41
41
  class HospitalType(str, Enum):
@@ -46,6 +46,12 @@ class HospitalType(str, Enum):
46
46
  ACUTE_CARE_DOD = "Acute Care - Department of Defense"
47
47
 
48
48
 
49
+ class RuralIndicator(str, Enum):
50
+ RURAL = "R"
51
+ SUPER_RURAL = "B"
52
+ URBAN = ""
53
+
54
+
49
55
  class InpatientPriceDetail(BaseModel):
50
56
  """InpatientPriceDetail contains pricing details for an inpatient claim"""
51
57
 
@@ -109,12 +115,6 @@ class OutpatientPriceDetail(BaseModel):
109
115
  """Credit for devices that are not used due to a terminated procedure"""
110
116
 
111
117
 
112
- class RuralIndicator(str, Enum):
113
- RURAL = "R"
114
- SUPER_RURAL = "B"
115
- URBAN = ""
116
-
117
-
118
118
  class ProviderDetail(BaseModel):
119
119
  """
120
120
  ProviderDetail contains basic information about the provider and/or locality used for pricing.
@@ -185,49 +185,52 @@ class PricedService(BaseModel):
185
185
 
186
186
  model_config = camel_case_model_config
187
187
 
188
- line_number: str
188
+ line_number: Optional[str] = None
189
189
  """Number of the service line item (copied from input)"""
190
190
 
191
191
  provider_detail: Optional[ProviderDetail] = None
192
192
  """Provider Details used when pricing the service if different than the claim"""
193
193
 
194
- medicare_amount: float
194
+ medicare_amount: Optional[float] = None
195
195
  """Amount Medicare would pay for the service"""
196
196
 
197
- allowed_amount: float
197
+ allowed_amount: Optional[float] = None
198
198
  """Allowed amount based on a contract or RBP pricing"""
199
199
 
200
- allowed_calculation_error: str
201
- """Reason the allowed amount was not calculated"""
202
-
203
- repricing_code: LineRepricingCode
200
+ medicare_repricing_code: Optional[LineRepricingCode] = None
204
201
  """Explains the methodology used to calculate Medicare"""
205
202
 
206
- repricing_note: str
203
+ medicare_repricing_note: Optional[str] = None
207
204
  """Note explaining approach for pricing or reason for error"""
208
205
 
209
- technical_component_amount: float
206
+ allowed_repricing_code: Optional[LineRepricingCode] = None
207
+ """Explains the methodology used to calculate allowed amount"""
208
+
209
+ allowed_repricing_note: Optional[str] = None
210
+ """Note explaining approach for pricing or reason for error"""
211
+
212
+ technical_component_amount: Optional[float] = None
210
213
  """Amount Medicare would pay for the technical component"""
211
214
 
212
- professional_component_amount: float
215
+ professional_component_amount: Optional[float] = None
213
216
  """Amount Medicare would pay for the professional component"""
214
217
 
215
- medicare_std_dev: float
218
+ medicare_std_dev: Optional[float] = None
216
219
  """Standard deviation of the estimated Medicare amount (estimates service only)"""
217
220
 
218
- medicare_source: str
221
+ medicare_source: Optional[str] = None
219
222
  """Source of the Medicare amount (e.g. physician fee schedule, OPPS, etc.)"""
220
223
 
221
- pricer_result: str
224
+ pricer_result: Optional[str] = None
222
225
  """Pricing service return details"""
223
226
 
224
- status_indicator: str
227
+ status_indicator: Optional[str] = None
225
228
  """Code which gives more detail about how Medicare pays for the service"""
226
229
 
227
- payment_indicator: str
230
+ payment_indicator: Optional[str] = None
228
231
  """Text which explains the type of payment for Medicare"""
229
232
 
230
- payment_apc: str
233
+ payment_apc: Annotated[Optional[str], field_name("paymentAPC")] = None
231
234
  """Ambulatory Payment Classification"""
232
235
 
233
236
  edit_detail: Optional[LineEdits] = None
@@ -239,7 +242,7 @@ class Pricing(BaseModel):
239
242
 
240
243
  model_config = camel_case_model_config
241
244
 
242
- claim_id: Optional[str] = None
245
+ claim_id: Annotated[Optional[str], field_name(alias="claimID")] = None
243
246
  """The unique identifier for the claim (copied from input)"""
244
247
 
245
248
  medicare_amount: Optional[float] = None
@@ -248,9 +251,6 @@ class Pricing(BaseModel):
248
251
  allowed_amount: Optional[float] = None
249
252
  """The allowed amount based on a contract or RBP pricing"""
250
253
 
251
- allowed_calculation_error: Optional[str] = None
252
- """The reason the allowed amount was not calculated"""
253
-
254
254
  medicare_repricing_code: Optional[ClaimRepricingCode] = None
255
255
  """Explains the methodology used to calculate Medicare (MED or IFO)"""
256
256
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mphapi
3
- Version: 0.3.0
3
+ Version: 0.4.1
4
4
  Summary: A Python interface to the MyPriceHealth API
5
5
  Author: David Archibald
6
6
  Author-email: davidarchibald@myprice.health
@@ -0,0 +1,10 @@
1
+ mphapi/__init__.py,sha256=pY3H-ikyEKrkHm8f3L7-5_IaDf8G9vYMUVsWJRV8e04,210
2
+ mphapi/claim.py,sha256=UWlj3VaNWXIxoBpQWbdzEFbTvpxBCiDbQXFnZGC3OD0,11527
3
+ mphapi/client.py,sha256=AHEClAKS3j0wMdrjFhAmQqCJ_4Axc01DiOxZiOMzWhs,6297
4
+ mphapi/date.py,sha256=Vdv3xqZh610xFl1HK1e_YGK9tkdFs0giUTvCT5bbbRU,1504
5
+ mphapi/fields.py,sha256=nRFqDwFONLiYcYXb4I54vuvNAUlCTErtp7S3BB16aNo,604
6
+ mphapi/pricing.py,sha256=gYkVsyXn--69CjHoyHYVYPXYXXejoSmbDjqmWdknodY,10159
7
+ mphapi/response.py,sha256=opgHtRH7hIgz9tMSVV7966OJDAIB9O4BvOUW_KcJzqI,2958
8
+ mphapi-0.4.1.dist-info/METADATA,sha256=ob2qO3VmgRltd8H_ex4WSQSyHWqYTWG6WhyhBDkjA_E,382
9
+ mphapi-0.4.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
10
+ mphapi-0.4.1.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- mphapi/__init__.py,sha256=pY3H-ikyEKrkHm8f3L7-5_IaDf8G9vYMUVsWJRV8e04,210
2
- mphapi/claim.py,sha256=eYHVNddhM-F6IKWuRQJxIlp5XFG2jDMp9xPY6z-Gx9w,10567
3
- mphapi/client.py,sha256=AHEClAKS3j0wMdrjFhAmQqCJ_4Axc01DiOxZiOMzWhs,6297
4
- mphapi/date.py,sha256=Vdv3xqZh610xFl1HK1e_YGK9tkdFs0giUTvCT5bbbRU,1504
5
- mphapi/pricing.py,sha256=Wrf_eSrRxoiq-7jExBAHLBAge1k4WGcEs4MmBVyUWtk,9773
6
- mphapi/response.py,sha256=opgHtRH7hIgz9tMSVV7966OJDAIB9O4BvOUW_KcJzqI,2958
7
- mphapi-0.3.0.dist-info/METADATA,sha256=OiY73X61c87oWHsOFT7mqKSv2YXBgCA_itYjkrN1YJ8,382
8
- mphapi-0.3.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
9
- mphapi-0.3.0.dist-info/RECORD,,
File without changes