Skip to content

Commit

Permalink
Created a new webscraper and test file for Zoobook Systems
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi-salunkhe-mettle committed Nov 21, 2024
1 parent 9a34eb4 commit aa57981
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ var axeiumURL = "https://apifhir.axeium.net:8443/reference-server/"
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"
var zoobooksystemsURL = "https://zoobooksystems.com/api-documentation/"

var bundleQuerierArray = [30]string{"https://ac-fhir.harrisambulatory.com/endpoints/r4", "https://dynamicfhirpresentation.dynamicfhirsandbox.com/fhir/r4/endpoints",
"https://ct-fhir.harrisambulatory.com/Endpoints/R4", "https://kantime.com/wp-content/uploads/2024/03/fhir-base-urls.json",
Expand Down Expand Up @@ -583,6 +584,8 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
CSVParser(chplURL, fileToWriteTo, "./endpoints.csv", -1, 0, true, 1, 0)
} else if URLsEqual(chplURL, ehealthlineURL) {
EhealthlineWebscraper(ehealthlineURL, fileToWriteTo)
} else if URLsEqual(chplURL, zoobooksystemsURL) {
ZoobooksystemsWebscraper(zoobooksystemsURL, fileToWriteTo)
} else {
log.Warnf("Handler is required for url %s", chplURL)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func TestWebScrapers(t *testing.T) {
url: "https://www.ezemrx.com/fhir",
fileName: "ezEMRx_Inc_EndpointSources.json",
},
{
scraperFunc: ZoobooksystemsWebscraper,
url: "https://zoobooksystems.com/api-documentation/",
fileName: "Zoobook_Systems_LLC_EndpointSources.json",
},
}

for _, tc := range testCases {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package chplendpointquerier

import (
"strings"

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

func ZoobooksystemsWebscraper(CHPLURL string, fileToWriteTo string) {

var lanternEntryList []LanternEntry
var endpointEntryList EndpointList
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, ".col-lg-6.text-secondary.fw-bold")
if err != nil {
log.Fatal(err)
}

inProduction := false

doc.Find(".col-lg-6").Each(func(index int, divhtml *goquery.Selection) {
if divhtml.Text() == "PRODUCTION" {
inProduction = true
}

if inProduction {
divhtml.Find("a").Each(func(indextr int, ahtml *goquery.Selection) {
if strings.Contains(ahtml.Text(), "https") && !strings.Contains(ahtml.Text(), "oauth") {
var entry LanternEntry

entryURL := strings.TrimSpace(ahtml.Text())
entry.URL = entryURL

lanternEntryList = append(lanternEntryList, entry)

endpointEntryList.Endpoints = lanternEntryList

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

return
}
})
}
})
}

0 comments on commit aa57981

Please sign in to comment.