Skip to content

Commit

Permalink
Merge pull request #441 from onc-healthit/LANTERN-782-curemd-webscraper
Browse files Browse the repository at this point in the history
LANTERN-782-Add-curemd-webscraper
  • Loading branch information
vishnu-mettles authored Nov 22, 2024
2 parents 9a34eb4 + 723ecc9 commit 97c3462
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ var pointclickURL = "https://fhir.pointclickcare.com/"
var nextgenPracticeURL = "https://www.nextgen.com/api/practice-search"
var aspmdURL = "https://fhirapi.asp.md:3030/aspmd/fhirserver/fhir_aspmd.asp"
var axeiumURL = "https://apifhir.axeium.net:8443/reference-server/"
var curemdURL = "https://www.curemd.com/developer/base-fhir-urls/"
var emdscloudURL = "https://identity.emdscloud.com/api/api-resource/fhir"
var betaAfoundriaURL = "https://beta.afoundria.com/api/fhir/urls"
var ehealthlineURL = "http://ehealthline.com/dev/pdf/FHIR%20API%20Endpoints.htm"
Expand Down Expand Up @@ -567,6 +568,8 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
EzemrxWebscraper(chplURL, fileToWriteTo)
} else if contains(bundleQuerierArray, chplURL) {
BundleQuerierParser(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, curemdURL) {
CuremdWebscraper(curemdURL, fileToWriteTo)
} else if URLsEqual(emdscloudURL, chplURL) {
EmdsCloudWebscraper(emdscloudURL, fileToWriteTo)
} else if URLsEqual(chplURL, betaAfoundriaURL) {
Expand Down
45 changes: 45 additions & 0 deletions endpointmanager/pkg/chplendpointquerier/curemdwebscraper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package chplendpointquerier

import (
"strings"

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

func CuremdWebscraper(CHPLURL string, fileToWriteTo string) {

var entry LanternEntry
var lanternEntryList []LanternEntry
var endpointEntryList EndpointList

doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, "")
if err != nil {
log.Fatal(err)
}

doc.Find("label").Each(func(index int, item *goquery.Selection) {
labelText := strings.TrimSpace(item.Text())
if labelText == "Capability Statement:" {
pTag := item.NextFiltered("p")
if pTag.Length() > 0 {
pTag.Find("a").Each(func(i int, link *goquery.Selection) {
url, exists := link.Attr("href")
if exists {
entry.URL = url
lanternEntryList = append(lanternEntryList, entry)
}
})
}
}
})

endpointEntryList.Endpoints = lanternEntryList

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

}

0 comments on commit 97c3462

Please sign in to comment.