Skip to content

Commit 9b50548

Browse files
BFD-4764: Prior Auth Server Implementation (#3201)
Co-authored-by: Austin Schey <austin.schey@forpeople.us>
1 parent bb05a7f commit 9b50548

81 files changed

Lines changed: 10064 additions & 3222 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
ALTER TABLE idr.prior_auth
2+
ADD COLUMN bfd_order_refer_careteam_name character varying(135),
3+
ADD COLUMN bfd_order_refer_npi_type integer,
4+
ADD COLUMN bfd_render_careteam_name character varying(135),
5+
ADD COLUMN bfd_render_npi_type integer,
6+
ADD COLUMN bfd_att_phy_careteam_name character varying(135),
7+
ADD COLUMN bfd_att_phy_npi_type integer;
8+
9+
ALTER TABLE idr.prior_auth
10+
ADD COLUMN resource_id UUID DEFAULT gen_random_uuid();
11+
12+
CREATE TABLE idr.prior_auth_item (
13+
mbi_num VARCHAR(11) NOT NULL,
14+
utn VARCHAR(14) NOT NULL,
15+
current_segment INT NOT NULL,
16+
hcpcs_or_cpt_or_hipps VARCHAR(5) NOT NULL,
17+
price_mod1 VARCHAR(2) NOT NULL,
18+
price_mod2 VARCHAR(2) NOT NULL,
19+
place_of_serv VARCHAR(2) NOT NULL,
20+
rev_code_1 VARCHAR(4) NOT NULL,
21+
pa_dt_added DATE NOT NULL,
22+
pa_dt_updated DATE,
23+
pa_decision VARCHAR(1) NOT NULL,
24+
pa_req_sub_dt DATE NOT NULL,
25+
pa_req_rec_dt DATE NOT NULL,
26+
pa_decision_dt DATE,
27+
pa_decision_exp_dt DATE,
28+
service_cnts INT NOT NULL,
29+
svc_render_st VARCHAR(2) NOT NULL,
30+
mr_count_ind INT NOT NULL,
31+
mr_count_st_dt DATE,
32+
mr_count_end_dt DATE,
33+
rrb_excl_ind VARCHAR(1) NOT NULL,
34+
bfd_created_ts TIMESTAMPTZ NOT NULL,
35+
bfd_updated_ts TIMESTAMPTZ,
36+
PRIMARY KEY(mbi_num, utn, current_segment)
37+
);
38+
39+
ALTER TABLE idr.prior_auth
40+
DROP CONSTRAINT prior_auth_pkey,
41+
DROP COLUMN current_segment,
42+
ADD CONSTRAINT prior_auth_pkey PRIMARY KEY (mbi_num, utn);
43+
44+
ALTER TABLE idr.prior_auth
45+
DROP COLUMN hcpcs_or_cpt_or_hipps,
46+
DROP COLUMN price_mod1,
47+
DROP COLUMN price_mod2,
48+
DROP COLUMN place_of_serv,
49+
DROP COLUMN rev_code_1,
50+
DROP COLUMN pa_dt_added,
51+
DROP COLUMN pa_dt_updated,
52+
DROP COLUMN pa_decision,
53+
DROP COLUMN pa_req_sub_dt,
54+
DROP COLUMN pa_req_rec_dt,
55+
DROP COLUMN pa_decision_dt,
56+
DROP COLUMN pa_decision_exp_dt,
57+
DROP COLUMN service_cnts,
58+
DROP COLUMN svc_render_st,
59+
DROP COLUMN mr_count_ind,
60+
DROP COLUMN mr_count_st_dt,
61+
DROP COLUMN mr_count_end_dt,
62+
DROP COLUMN rrb_excl_ind;
63+

apps/bfd-model-idr/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
container_name: matchbox-db
3333
restart: always
3434
ports:
35-
- "5432:5432"
35+
- "15432:5432"
3636
environment:
3737
POSTGRES_DB: 'matchbox'
3838
POSTGRES_USER: 'matchbox'

apps/bfd-model-idr/maps/ExplanationOfBenefit-Helper.map

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -358,58 +358,6 @@ conceptmap "CLM_PD_STUS_CD" {
358358
s:"T" == t:"partial"
359359
}
360360

361-
conceptmap "CLM_AUDT_TRL_STUS_CD_MCS" {
362-
prefix s = "https://hl7.org/fhir/string"
363-
prefix t = "https://hl7.org/fhir/string"
364-
365-
s:"A" = t:"queued"
366-
s:"B" = t:"queued"
367-
s:"C" = t:"partial"
368-
s:"D" = t:"complete"
369-
s:"E" = t:"complete"
370-
s:"F" = t:"complete"
371-
s:"G" = t:"complete"
372-
s:"J" = t:"queued"
373-
s:"K" = t:"queued"
374-
s:"L" = t:"partial"
375-
s:"M" = t:"complete"
376-
s:"N" = t:"complete"
377-
s:"P" = t:"complete"
378-
s:"Q" = t:"complete"
379-
s:"R" = t:"complete"
380-
s:"U" = t:"complete"
381-
s:"V" = t:"complete"
382-
s:"W" = t:"complete"
383-
s:"X" = t:"complete"
384-
s:"Y" = t:"complete"
385-
s:"Z" = t:"complete"
386-
s:"1" = t:"queued"
387-
s:"2" = t:"queued"
388-
s:"3" = t:"partial"
389-
s:"4" = t:"complete"
390-
s:"5" = t:"complete"
391-
s:"6" = t:"error"
392-
s:"8" = t:"complete"
393-
s:"9" = t:"complete"
394-
}
395-
396-
// Separate concept map for FISS since outcome differs for codes F & M
397-
conceptmap "CLM_AUDT_TRL_STUS_CD_FISS" {
398-
prefix s = "https://hl7.org/fhir/string"
399-
prefix t = "https://hl7.org/fhir/string"
400-
401-
s:"A" == t:"queued"
402-
s:"F" == t:"partial"
403-
s:"I" == t:"partial"
404-
s:"S" == t:"partial"
405-
s:"M" == t:"partial"
406-
s:"P" == t:"complete"
407-
s:"R" == t:"complete"
408-
s:"D" == t:"complete"
409-
s:"T" == t:"partial"
410-
s:"U" == t:"complete"
411-
}
412-
413361
conceptmap "CLM_DGNS_PRCDR_ICD_IND_PROCEDURE" {
414362
prefix s = "https://hl7.org/fhir/string"
415363
prefix t = "https://hl7.org/fhir/string"

apps/bfd-model-idr/maps/ExplanationOfBenefit-PriorAuth.map

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ group createEOBPriorAuth(source src: ExplanationOfBenefitPA, target tgt: BFDEOB)
3434
} "Create metadata";
3535

3636
src -> tgt.type = create('CodeableConcept') as tgtCC then {
37-
//CodeSystem -> CLM_TYPE_CD
37+
//CodeSystem -> CLM_TYPE
3838
//Two types - 1: PDEX, 2: CMS-specific. use concept map
3939
src.CLM_TYPE as typeCd -> tgtCC.coding = translate(typeCd,'https://bfd.cms.gov/MappingLanguage/Maps/ExplanationOfBenefit-Helper#PriorAuthType','coding') "translate code";
4040
//No blanks here since 2023.
@@ -98,10 +98,9 @@ group createEOBPriorAuth(source src: ExplanationOfBenefitPA, target tgt: BFDEOB)
9898
//Current_segment (line item)
9999
paItem.CURRENT_SEGMENT as sequenceNumber -> tgtItem.sequence = sequenceNumber "Add sequence number";
100100

101-
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.length()=5 and itemCode.substring(0,1).convertsToInteger()) -> tgtItem.productOrService = cc("http://www.ama-assn.org/go/cpt", itemCode) "Add item code";
102-
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.length()=5 and itemCode.substring(0,1).convertsToInteger().not()) -> tgtItem.productOrService = cc("https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets", itemCode) "Add item code";
103-
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.length()=5 and itemCode.substring(1,2).convertsToInteger().not()) -> tgtItem.productOrService = cc("https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/ProspMedicareFeeSvcPmtGen/HIPPSCodes", itemCode) "Add item code";
104-
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.length()!=5) -> tgtItem.productOrService = cc("http://terminology.hl7.org/CodeSystem/data-absent-reason","not-applicable") "add DAR";
101+
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.substring(0,1).convertsToInteger() and src.CLM_TYPE != 'I') -> tgtItem.productOrService = cc("http://www.ama-assn.org/go/cpt", itemCode) "Add item code";
102+
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(itemCode.substring(0,1).convertsToInteger().not() and src.CLM_TYPE != 'I') -> tgtItem.productOrService = cc("https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets", itemCode) "Add item code";
103+
paItem.HCPCS_OR_CPT_OR_HIPPS as itemCode where(src.CLM_TYPE = 'I') -> tgtItem.productOrService = cc("https://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/ProspMedicareFeeSvcPmtGen/HIPPSCodes", itemCode) "Add item code";
105104

106105
paItem.PRICE_MOD1 as modifierCode where(modifierCode.length()=2) -> tgtItem.modifier = cc("https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets", modifierCode) "Add modifier";
107106
paItem.PRICE_MOD2 as modifierCode where(modifierCode.length()=2) -> tgtItem.modifier = cc("https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets", modifierCode) "Add modifier";
@@ -223,7 +222,7 @@ group addPADecisionExpDt(source src: String, target tgt: Extension){
223222

224223
group addServiceCnts(source src: String, target tgt: Extension){
225224
src -> tgt.url = "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS" "Add extension url";
226-
src as val -> tgt.value = cast(val, "decimal") "set value";
225+
src as val -> tgt.value = cast(val, "unsignedInt") "set value";
227226
}
228227

229228
group addSvcRenderSt(source src: String, target tgt: Extension){
@@ -236,7 +235,7 @@ group addSvcRenderSt(source src: String, target tgt: Extension){
236235

237236
group addMRCountInd(source src: String, target tgt: Extension){
238237
src -> tgt.url = "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND" "Add extension url";
239-
src as val -> tgt.value = cast(val, "decimal") "set value";
238+
src as val -> tgt.value = cast(val, 'unsignedInt') "set value";
240239
}
241240

242241
group addMRCountStDt(source src: String, target tgt: Extension){

apps/bfd-model-idr/out/ExplanationOfBenefit-PriorAuth.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"system" : "http://hl7.org/fhir/sid/us-npi",
9393
"value" : "1065725636"
9494
},
95-
"display" : "Indiana"
95+
"display" : "Practitioner"
9696
},
9797
"role" : {
9898
"coding" : [{
@@ -117,7 +117,7 @@
117117
"system" : "http://hl7.org/fhir/sid/us-npi",
118118
"value" : "2601139399"
119119
},
120-
"display" : "Jones, Gromit"
120+
"display" : "Practitioner"
121121
},
122122
"role" : {
123123
"coding" : [{
@@ -142,7 +142,7 @@
142142
"system" : "http://hl7.org/fhir/sid/us-npi",
143143
"value" : "1248968152"
144144
},
145-
"display" : "Tiana"
145+
"display" : "Practitioner"
146146
},
147147
"role" : {
148148
"coding" : [{
@@ -155,7 +155,7 @@
155155
{
156156
"sequence" : 4,
157157
"provider" : {
158-
"type" : "Organization",
158+
"type" : "Practitioner",
159159
"identifier" : {
160160
"type" : {
161161
"coding" : [{
@@ -167,7 +167,7 @@
167167
"system" : "http://hl7.org/fhir/sid/us-npi",
168168
"value" : "1118124233"
169169
},
170-
"display" : "CBS Health Corporation"
170+
"display" : "Practitioner"
171171
},
172172
"role" : {
173173
"coding" : [{
@@ -255,7 +255,7 @@
255255
},
256256
{
257257
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
258-
"valueDecimal" : 13
258+
"valueUnsignedInt" : 13
259259
},
260260
{
261261
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -266,7 +266,7 @@
266266
},
267267
{
268268
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
269-
"valueDecimal" : 43
269+
"valueUnsignedInt" : 43
270270
},
271271
{
272272
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -318,7 +318,7 @@
318318
},
319319
{
320320
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
321-
"valueDecimal" : 4
321+
"valueUnsignedInt" : 4
322322
},
323323
{
324324
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -329,7 +329,7 @@
329329
},
330330
{
331331
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
332-
"valueDecimal" : 14
332+
"valueUnsignedInt" : 14
333333
},
334334
{
335335
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -381,7 +381,7 @@
381381
},
382382
{
383383
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
384-
"valueDecimal" : 1
384+
"valueUnsignedInt" : 1
385385
},
386386
{
387387
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -392,7 +392,7 @@
392392
},
393393
{
394394
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
395-
"valueDecimal" : 94
395+
"valueUnsignedInt" : 94
396396
},
397397
{
398398
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -448,7 +448,7 @@
448448
},
449449
{
450450
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
451-
"valueDecimal" : 8
451+
"valueUnsignedInt" : 8
452452
},
453453
{
454454
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -459,7 +459,7 @@
459459
},
460460
{
461461
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
462-
"valueDecimal" : 54
462+
"valueUnsignedInt" : 54
463463
},
464464
{
465465
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -511,7 +511,7 @@
511511
},
512512
{
513513
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
514-
"valueDecimal" : 9
514+
"valueUnsignedInt" : 9
515515
},
516516
{
517517
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -522,7 +522,7 @@
522522
},
523523
{
524524
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
525-
"valueDecimal" : 45
525+
"valueUnsignedInt" : 45
526526
},
527527
{
528528
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -580,7 +580,7 @@
580580
},
581581
{
582582
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
583-
"valueDecimal" : 15
583+
"valueUnsignedInt" : 15
584584
},
585585
{
586586
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -591,7 +591,7 @@
591591
},
592592
{
593593
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
594-
"valueDecimal" : 58
594+
"valueUnsignedInt" : 58
595595
},
596596
{
597597
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -655,7 +655,7 @@
655655
},
656656
{
657657
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
658-
"valueDecimal" : 2
658+
"valueUnsignedInt" : 2
659659
},
660660
{
661661
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -666,7 +666,7 @@
666666
},
667667
{
668668
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
669-
"valueDecimal" : 74
669+
"valueUnsignedInt" : 74
670670
},
671671
{
672672
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -718,7 +718,7 @@
718718
},
719719
{
720720
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
721-
"valueDecimal" : 8
721+
"valueUnsignedInt" : 8
722722
},
723723
{
724724
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -729,7 +729,7 @@
729729
},
730730
{
731731
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
732-
"valueDecimal" : 85
732+
"valueUnsignedInt" : 85
733733
},
734734
{
735735
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -787,7 +787,7 @@
787787
},
788788
{
789789
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
790-
"valueDecimal" : 14
790+
"valueUnsignedInt" : 14
791791
},
792792
{
793793
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -798,7 +798,7 @@
798798
},
799799
{
800800
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
801-
"valueDecimal" : 11
801+
"valueUnsignedInt" : 11
802802
},
803803
{
804804
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",
@@ -850,7 +850,7 @@
850850
},
851851
{
852852
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SERVICE-CNTS",
853-
"valueDecimal" : 9
853+
"valueUnsignedInt" : 9
854854
},
855855
{
856856
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/SVC-RENDER-ST",
@@ -861,7 +861,7 @@
861861
},
862862
{
863863
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-IND",
864-
"valueDecimal" : 1
864+
"valueUnsignedInt" : 1
865865
},
866866
{
867867
"url" : "https://bluebutton.cms.gov/fhir/StructureDefinition/MR-COUNT-ST-DT",

0 commit comments

Comments
 (0)