Skip to content

Commit

Permalink
LANTERN-629-Adding humana web scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
archita-ekkirala committed Aug 26, 2024
1 parent ccc02bb commit f196349
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var anthemURL = "https://patient360.anthem.com/P360Member/fhir"

// var guidewellURL = "https://developer.bcbsfl.com/interop/interop-developer-portal/product/469/api/466#/PatientAccessAPI_105/overview"
// var hcscURL = "https://interoperability.hcsc.com/s/patient-access-api"
// var humanaURL = "https://developers.humana.com/patient-api/doc"
var humanaURL = "https://developers.humana.com/patient-api/doc"
// var kaiserURL = "https://developer.kp.org/#/apis/639c015049655aa96ab5b2f1"
// var molinaURL = "https://developer.interop.molinahealthcare.com/api-details#api=patient-access&operation=5f72ab665269f310ef58b361"
var unitedHealthURL = "https://www.uhc.com/legal/interoperability-apis"
Expand Down Expand Up @@ -510,8 +510,8 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
// GuidewellURLWebscraper(chplURL, fileToWriteTo)
// } else if URLsEqual(chplURL, hcscURL) {
// HcscURLWebscraper(chplURL, fileToWriteTo)
// } else if URLsEqual(chplURL, humanaURL) {
// HumanaURLWebscraper(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, humanaURL) {
HumanaURLWebscraper(chplURL, fileToWriteTo)
//} else if URLsEqual(chplURL, kaiserURL) {
//KaiserURLWebscraper(chplURL, fileToWriteTo)
// } else if URLsEqual(chplURL, molinaURL) {
Expand Down
42 changes: 42 additions & 0 deletions endpointmanager/pkg/chplendpointquerier/humanaurlwebscraper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package chplendpointquerier

import (
"strings"

"github.com/PuerkitoBio/goquery"
"github.com/onc-healthit/lantern-back-end/endpointmanager/pkg/helpers"
log "github.com/sirupsen/logrus"
"fmt"
)

func HumanaURLWebscraper(CHPLURL string, fileToWriteTo string) {

fmt.Print("Running")

var lanternEntryList []LanternEntry
var endpointEntryList EndpointList

doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, "p")
if err != nil {
log.Fatal(err)
}
doc.Find("p").Each(func(index int, pElement *goquery.Selection) {
pElement.Find("label").Each(func(index int, labelElement *goquery.Selection){
if (strings.Contains(labelElement.Text(), "https")){
url := labelElement.Text()
url = strings.TrimSuffix(url, "/Patient")
var entry LanternEntry
entry.URL = url
lanternEntryList = append(lanternEntryList, entry)
}
})
})

endpointEntryList.Endpoints = lanternEntryList

err = WriteCHPLFile(endpointEntryList, fileToWriteTo)
if err != nil {
log.Fatal(err)
}

}

0 comments on commit f196349

Please sign in to comment.