hccinfhir 0.0.7__tar.gz → 0.0.9__tar.gz

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.
Files changed (43) hide show
  1. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/PKG-INFO +1 -1
  2. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/datamodels.py +5 -3
  3. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_calculate.py +6 -0
  4. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_demographics.py +3 -3
  5. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/pyproject.toml +1 -1
  6. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/.gitignore +0 -0
  7. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/LICENSE +0 -0
  8. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/README.md +0 -0
  9. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/__init__.py +0 -0
  10. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/__init__.py +0 -0
  11. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_coefficients_2025.csv +0 -0
  12. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_dx_to_cc_2025.csv +0 -0
  13. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_eligible_cpt_hcpcs_2023.csv +0 -0
  14. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_eligible_cpt_hcpcs_2024.csv +0 -0
  15. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_eligible_cpt_hcpcs_2025.csv +0 -0
  16. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/data/ra_hierarchies_2025.csv +0 -0
  17. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/extractor.py +0 -0
  18. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/extractor_837.py +0 -0
  19. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/extractor_fhir.py +0 -0
  20. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/filter.py +0 -0
  21. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/hccinfhir.py +0 -0
  22. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_coefficients.py +0 -0
  23. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_dx_to_cc.py +0 -0
  24. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_hierarchies.py +0 -0
  25. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/model_interactions.py +0 -0
  26. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/__init__.py +0 -0
  27. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_0.txt +0 -0
  28. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_1.txt +0 -0
  29. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_10.txt +0 -0
  30. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_11.txt +0 -0
  31. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_2.txt +0 -0
  32. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_3.txt +0 -0
  33. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_4.txt +0 -0
  34. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_5.txt +0 -0
  35. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_6.txt +0 -0
  36. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_7.txt +0 -0
  37. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_8.txt +0 -0
  38. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_837_9.txt +0 -0
  39. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_eob_1.json +0 -0
  40. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_eob_2.json +0 -0
  41. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_eob_200.ndjson +0 -0
  42. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/samples/sample_eob_3.json +0 -0
  43. {hccinfhir-0.0.7 → hccinfhir-0.0.9}/hccinfhir/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hccinfhir
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: HCC Algorithm for FHIR Resources
5
5
  Project-URL: Homepage, https://github.com/mimilabs/hccinfhir
6
6
  Project-URL: Issues, https://github.com/mimilabs/hccinfhir/issues
@@ -69,9 +69,9 @@ class Demographics(BaseModel):
69
69
  """
70
70
  age: Union[int, float] = Field(..., description="[required] Beneficiary age")
71
71
  sex: Literal['M', 'F', '1', '2'] = Field(..., description="[required] Beneficiary sex")
72
- dual_elgbl_cd: Optional[Literal[None, 'NA', '99', '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10']] = Field('NA', description="Dual status code")
73
- orec: Optional[Literal[None, '0', '1', '2', '3']] = Field('0', description="Original reason for entitlement")
74
- crec: Optional[Literal[None, '0', '1', '2', '3']] = Field('0', description="Current reason for entitlement")
72
+ dual_elgbl_cd: Optional[Literal[None, '', 'NA', '99', '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10']] = Field('NA', description="Dual status code")
73
+ orec: Optional[Literal[None, '', '0', '1', '2', '3']] = Field('', description="Original reason for entitlement")
74
+ crec: Optional[Literal[None, '', '0', '1', '2', '3']] = Field('', description="Current reason for entitlement")
75
75
  new_enrollee: Optional[bool] = Field(False, description="True if beneficiary is a new enrollee")
76
76
  snp: Optional[bool] = Field(False, description="True if beneficiary is in SNP")
77
77
  version: Optional[str] = Field("V2", description="Version of categorization used (V2, V4, V6)")
@@ -90,6 +90,8 @@ class Demographics(BaseModel):
90
90
  class RAFResult(TypedDict):
91
91
  """Type definition for RAF calculation results"""
92
92
  risk_score: float
93
+ risk_score_demographics: float
94
+ risk_score_hcc: float
93
95
  hcc_list: List[str]
94
96
  cc_to_dx: Dict[str, Set[str]]
95
97
  coefficients: Dict[str, float]
@@ -76,11 +76,17 @@ def calculate_raf(diagnosis_codes: List[str],
76
76
  hcc_set = apply_hierarchies(hcc_set, model_name)
77
77
  interactions = apply_interactions(demographics, hcc_set, model_name)
78
78
  coefficients = apply_coefficients(demographics, hcc_set, interactions, model_name)
79
+
80
+ coefficients_demographics = apply_coefficients(demographics, set(), {}, model_name)
79
81
 
80
82
  risk_score = sum(coefficients.values())
83
+ risk_score_demographics = sum(coefficients_demographics.values())
84
+ risk_score_hcc = risk_score - risk_score_demographics
81
85
 
82
86
  return {
83
87
  'risk_score': risk_score,
88
+ 'risk_score_demographics': risk_score_demographics,
89
+ 'risk_score_hcc': risk_score_hcc,
84
90
  'hcc_list': list(hcc_set),
85
91
  'cc_to_dx': cc_to_dx,
86
92
  'coefficients': coefficients,
@@ -120,9 +120,9 @@ def categorize_demographics(age: Union[int, float],
120
120
 
121
121
  # V2/V4 Logic (Medicare Population)
122
122
  elif version in ('V2', 'V4'):
123
- if orec is None:
124
- raise ValueError("OREC is required for V2/V4 categorization")
125
-
123
+ if orec is None or orec == '':
124
+ orec = '0' # Default to 0 if OREC is None
125
+
126
126
  # New enrollee logic
127
127
  if new_enrollee:
128
128
  prefix = 'NEF' if std_sex == '2' else 'NEM'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hccinfhir"
7
- version = "0.0.7"
7
+ version = "0.0.9"
8
8
  authors = [
9
9
  { name="Yubin Park", email="yubin.park@mimilabs.ai" },
10
10
  ]
File without changes
File without changes
File without changes
File without changes
File without changes