Skip to content

Commit

Permalink
Merge pull request #439 from onc-healthit/LANTERN-787-EzemrxWebscraper
Browse files Browse the repository at this point in the history
LANTERN-787: Created a new webscraper for ezEMRx Inc.
  • Loading branch information
vishnu-mettles authored Nov 18, 2024
2 parents 9d42631 + bc387bf commit 546a149
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ var bundleQuerierArray = [30]string{"https://ac-fhir.harrisambulatory.com/endpoi
"https://appstudio.interopengine.com/partner/fhirR4endpoints-umc.json", "https://testauth.strateqhealth.com/SmartOnFHIR/ValidURLs.json",
"https://fhir.ethizo.com/api/4.0.0/service_based_url"}

var ezemrxURL = "https://www.ezemrx.com/fhir"

func contains(arr [30]string, str string) bool {
for _, v := range arr {
if v == str {
Expand Down Expand Up @@ -554,6 +556,8 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
AspMDeWebscraper(aspmdURL, fileToWriteTo)
} else if URLsEqual(chplURL, axeiumURL) {
AxeiumeWebscraper(axeiumURL, fileToWriteTo)
} else if URLsEqual(chplURL, ezemrxURL) {
EzemrxWebscraper(chplURL, fileToWriteTo)
} else if contains(bundleQuerierArray, chplURL) {
BundleQuerierParser(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, ehealthlineURL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func TestWebScrapers(t *testing.T) {
url: "https://fhirapi.asp.md:3030/aspmd/fhirserver/fhir_aspmd.asp",
fileName: "ASPMD_Inc_EndpointSources.json",
},
{
scraperFunc: EzemrxWebscraper,
url: "https://www.ezemrx.com/fhir",
fileName: "ezEMRx_Inc_EndpointSources.json",
},
}

for _, tc := range testCases {
Expand Down
38 changes: 38 additions & 0 deletions endpointmanager/pkg/chplendpointquerier/ezemrxwebscraper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package chplendpointquerier

import (
"strings"

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

func EzemrxWebscraper(CHPLURL string, fileToWriteTo string) {

var lanternEntryList []LanternEntry
var endpointEntryList EndpointList
var entry LanternEntry

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

divElem := doc.Find("#comp-lb6njyhb").First()
pElem := divElem.Find("p").First()
spanElem := pElem.Find("span").First()

parts := strings.Split(spanElem.Text(), "\n")

entry.URL = strings.TrimSpace(parts[1])

lanternEntryList = append(lanternEntryList, entry)

endpointEntryList.Endpoints = lanternEntryList

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

}

0 comments on commit 546a149

Please sign in to comment.