Skip to content

Commit

Permalink
BCDA-7197: v1 API throws an error for REACH ACOs when "_type" paramet…
Browse files Browse the repository at this point in the history
…er is not used (#859)

## 🎫 Ticket

https://jira.cms.gov/browse/BCDA-7197

## 🛠 Changes

When verifying resource type (when _type is empty), the Claim and
ClaimResponse data types will only be returned if the ACO is allowed
those resources and if the version of the endpoint is not V1.

## ℹ️ Context for reviewers

The v1 endpoints for `/Group` and `/Patient` will return Claim and
ClaimResponse resource types for specific ACOs; this functionality
should only occur in v2 endpoints `/Group` and `/Patient`.

## ✅ Acceptance Validation

- added unit test for getResourceTypes
- postman tests passing after deploying API and running tests

## 🔒 Security Implications

- [ ] This PR adds a new software dependency or dependencies.
- [ ] This PR modifies or invalidates one or more of our security
controls.
- [ ] This PR stores or transmits data that was not stored or
transmitted before.
- [ ] This PR requires additional review of its security implications
for other reasons.

If any security implications apply, add Jason Ashbaugh (GitHub username:
StewGoin) as a reviewer and do not merge this PR without his approval.
  • Loading branch information
laurenkrugen-navapbc authored Jul 13, 2023
1 parent 023431f commit 6a6bd66
Show file tree
Hide file tree
Showing 3 changed files with 558 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bcda/api/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func (h *Handler) getResourceTypes(parameters middleware.RequestParameters, cmsI
resourceTypes = append(resourceTypes, "Patient", "ExplanationOfBenefit", "Coverage")
}

if utils.ContainsString(acoConfig.Data, constants.PartiallyAdjudicated) {
if utils.ContainsString(acoConfig.Data, constants.PartiallyAdjudicated) && h.apiVersion != "v1" {
resourceTypes = append(resourceTypes, "Claim", "ClaimResponse")
}
}
Expand Down
27 changes: 27 additions & 0 deletions bcda/api/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,33 @@ func (s *RequestsTestSuite) TestJobFailedStatus() {
}
}

func (s *RequestsTestSuite) TestGetResourceTypes() {

testCases := []struct {
aco string
apiVersion string
expectedResources []string
}{
{"TEST123", "v1", []string{"Patient", "ExplanationOfBenefit", "Coverage"}},
{"D1234", "v1", []string{"Patient", "ExplanationOfBenefit", "Coverage"}},
{"A0000", "v1", []string{"Patient", "ExplanationOfBenefit", "Coverage"}},
{"TEST123", "v2", []string{"Patient", "ExplanationOfBenefit", "Coverage", "Claim", "ClaimResponse"}},
{"A0000", "v2", []string{"Patient", "ExplanationOfBenefit", "Coverage"}},
}
for _, test := range testCases {
h := newHandler(s.resourceType, "/"+test.apiVersion+"/fhir", test.apiVersion, s.db)
rp := middleware.RequestParameters{
Version: test.apiVersion,
ResourceTypes: []string{},
Since: time.Time{},
}
rt := h.getResourceTypes(rp, test.aco)

assert.Equal(s.T(), rt, test.expectedResources)
}

}

func (s *RequestsTestSuite) genGroupRequest(groupID string, rp middleware.RequestParameters) *http.Request {
req := httptest.NewRequest("GET", "http://bcda.cms.gov/api/v1/Group/$export", nil)

Expand Down
Loading

0 comments on commit 6a6bd66

Please sign in to comment.