Skip to content

Commit

Permalink
Moved the Guidewell API URLs to payer-patient-access.csv and created …
Browse files Browse the repository at this point in the history
…a unit test file for GuidewellURLWebscraper
  • Loading branch information
rishi-salunkhe-mettle committed Oct 15, 2024
1 parent ddf774c commit f58e34d
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ var cignaURL = "https://developer.cigna.com/docs/service-apis/patient-access/imp
var anthemURL = "https://patient360.anthem.com/P360Member/fhir"

var hcscURL = "https://interoperability.hcsc.com/s/provider-directory-api"
var guidewellURL = "https://developer.bcbsfl.com/interop/interop-developer-portal/product/469/api/466#/PatientAccessAPI_105/overview"
var guidewellPatAccURL = "https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get"
var guidewellP2PURL = "https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get"
var humanaURL = "https://developers.humana.com/apis/patient-api/doc"
var kaiserURL = "https://developer.kp.org/#/apis/639c015049655aa96ab5b2f1"

Expand Down Expand Up @@ -512,7 +513,7 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
AnthemURLParser("https://patient360.anthem.com/P360Member/fhir/endpoints", fileToWriteTo)
} else if URLsEqual(chplURL, hcscURL) {
HcscURLWebscraper(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, guidewellURL) {
} else if URLsEqual(chplURL, guidewellPatAccURL) || URLsEqual(chplURL, guidewellP2PURL) {
GuidewellURLWebscraper(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, humanaURL) {
HumanaURLWebscraper(chplURL, fileToWriteTo)
Expand Down
34 changes: 14 additions & 20 deletions endpointmanager/pkg/chplendpointquerier/guidewellurlwebscraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,24 @@ func entryExists(lanternEntryList []LanternEntry, lanternEntry LanternEntry) boo
func GuidewellURLWebscraper(CHPLURL string, fileToWriteTo string) {
var lanternEntryList []LanternEntry
var endpointEntryList EndpointList
patientAccessChplUrl := "https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get"
payer2payerChplUrl := "https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get"
// providerDirectoryChplUrl := "https://developer.bcbsfl.com/interop/interop-developer-portal/product/530/api/300#/ProviderDirectoryAPI_108/overview"
CHPLURLs := []string{patientAccessChplUrl, payer2payerChplUrl}

for i := 0; i < len(CHPLURLs); i++ {
doc, err := helpers.ChromedpQueryEndpointList(CHPLURLs[i], "div.apiEndpointUrl")
if err != nil {
log.Fatal(err)
}
doc.Find("div.apiEndpointUrl").Each(func(index int, urlElements *goquery.Selection) {

var lanternEntry LanternEntry

fhirURL := urlElements.Text()
lanternEntry.URL = fhirURL
if !entryExists(lanternEntryList, lanternEntry) {
lanternEntryList = append(lanternEntryList, lanternEntry)
}
})
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, "div.apiEndpointUrl")
if err != nil {
log.Fatal(err)
}
doc.Find("div.apiEndpointUrl").Each(func(index int, urlElements *goquery.Selection) {

var lanternEntry LanternEntry

fhirURL := urlElements.Text()
lanternEntry.URL = fhirURL
if !entryExists(lanternEntryList, lanternEntry) {
lanternEntryList = append(lanternEntryList, lanternEntry)
}
})

endpointEntryList.Endpoints = lanternEntryList
err := WriteCHPLFile(endpointEntryList, fileToWriteTo)
err = WriteCHPLFile(endpointEntryList, fileToWriteTo)
if err != nil {
log.Fatal(err)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package chplendpointquerier

import (
"os"
"testing"

th "github.com/onc-healthit/lantern-back-end/endpointmanager/pkg/testhelper"
)

func Test_GuidewellURLWebscraper(t *testing.T) {

// Patient Access API Test Cases
// 1. Happy case: Valid url, valid file format
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPatientAccessEndpointSources.json")

fileExists, err := doesfileExist("TEST_Medicare_GuidewellPatientAccessEndpointSources.json")
th.Assert(t, err == nil, err)
th.Assert(t, fileExists, "JSON file does not exist")

fileEmpty, err := isFileEmpty("TEST_Medicare_GuidewellPatientAccessEndpointSources.json")
th.Assert(t, err == nil, err)
th.Assert(t, !fileEmpty, "Empty JSON file")

err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.json")
th.Assert(t, err == nil, err)

err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.json")
th.Assert(t, err == nil, err)

// 2. Different file format
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPatientAccessEndpointSources.csv")

fileExists, err = doesfileExist("TEST_Medicare_GuidewellPatientAccessEndpointSources.csv")
th.Assert(t, err == nil, err)
th.Assert(t, fileExists, "CSV file does not exist")

fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPatientAccessEndpointSources.csv")
th.Assert(t, err == nil, err)
th.Assert(t, !fileEmpty, "Empty CSV file")

err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.csv")
th.Assert(t, err == nil, err)

err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.csv")
th.Assert(t, err == nil, err)

// Payer2Payer API Test Cases
// 1. Happy case: Valid url, valid file format
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPayer2PayerEndpointSources.json")

fileExists, err = doesfileExist("TEST_Medicare_GuidewellPayer2PayerEndpointSources.json")
th.Assert(t, err == nil, err)
th.Assert(t, fileExists, "JSON file does not exist")

fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPayer2PayerEndpointSources.json")
th.Assert(t, err == nil, err)
th.Assert(t, !fileEmpty, "Empty JSON file")

err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.json")
th.Assert(t, err == nil, err)

err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.json")
th.Assert(t, err == nil, err)

// 2. Different file format
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv")

fileExists, err = doesfileExist("TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv")
th.Assert(t, err == nil, err)
th.Assert(t, fileExists, "CSV file does not exist")

fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv")
th.Assert(t, err == nil, err)
th.Assert(t, !fileEmpty, "Empty CSV file")

err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv")
th.Assert(t, err == nil, err)

err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv")
th.Assert(t, err == nil, err)

}
12 changes: 9 additions & 3 deletions resources/dev_resources/MedicareStateEndpointResourcesList.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
},
{
"FormatType": "Lantern",
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/469/api/466#/PatientAccessAPI_105/overview",
"EndpointName": "Guidewell",
"FileName": "Medicare_GuidewellEndpointSources.json"
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get",
"EndpointName": "GuidewellPatientAccess",
"FileName": "Medicare_GuidewellPatientAccessEndpointSources.json"
},
{
"FormatType": "Lantern",
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get",
"EndpointName": "GuidewellPayer2Payer",
"FileName": "Medicare_GuidewellPayer2PayerEndpointSources.json"
},
{
"FormatType": "Lantern",
Expand Down
12 changes: 9 additions & 3 deletions resources/prod_resources/MedicareStateEndpointResourcesList.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
},
{
"FormatType": "Lantern",
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/469/api/466#/PatientAccessAPI_105/overview",
"EndpointName": "Guidewell",
"FileName": "Medicare_GuidewellEndpointSources.json"
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get",
"EndpointName": "GuidewellPatientAccess",
"FileName": "Medicare_GuidewellPatientAccessEndpointSources.json"
},
{
"FormatType": "Lantern",
"URL": "https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get",
"EndpointName": "GuidewellPayer2Payer",
"FileName": "Medicare_GuidewellPayer2PayerEndpointSources.json"
},
{
"FormatType": "Lantern",
Expand Down
3 changes: 2 additions & 1 deletion resources/prod_resources/payer-patient-access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Aetna,https://developerportal.aetna.com/fhirapis,,,,
Centene,https://partners.centene.com/apiDetail/2718669d-6e2e-42b5-8c90-0a82f13a30ba,,,,
Cigna,https://developer.cigna.com/docs/service-apis/patient-access/implementation-guide#Implementation-Guide-Base-URL,,,,
Elevance Health (Anthem),https://patient360.anthem.com/P360Member/fhir,,,,
Guidewell ,https://developer.bcbsfl.com/interop/interop-developer-portal/product/469/api/466#/PatientAccessAPI_105/overview,,,,
Guidewell Patient Access,https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get,,,,
Guidewell Payer2Payer,https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get,,,,
HCSC,https://interoperability.hcsc.com/s/provider-directory-api,,,,
Humana,https://developers.humana.com/apis/patient-api/doc,,,,
Kaiser Permanente,https://developer.kp.org/#/apis/639c015049655aa96ab5b2f1,,,,
Expand Down

0 comments on commit f58e34d

Please sign in to comment.