Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CHPL endpoint list Apr 24 #371

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Install golangci-lint
run: brew install golangci/tap/golangci-lint
- name: Install golangci-lint\
run: brew install golangci-lint
- name: Run Go Lintr
run: make lint_go
Rlintr:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ var myeyecarerecordsURL = "https://smartonfhir.myeyecarerecords.com/fhir/Endpoin
var nextgenAPIURL = "https://www.nextgen.com/patient-access-api"
var sabiamedURL = "https://www.sabiamed.com/api-endpoints"
var zoommdURL = "https://www.zoommd.com/zoommd-file-api-endpoints"
var footholdURL = "https://fhir.footholdtechnology.com/demodb/endpoints"
var pointclickURL = "https://fhir.pointclickcare.com/"
var nextgenPracticeURL = "https://www.nextgen.com/api/practice-search"

func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {

Expand Down Expand Up @@ -515,6 +518,12 @@ func QueryCHPLEndpointList(chplURL string, fileToWriteTo string) {
// MolinaURLWebscraper(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, unitedHealthURL) {
UnitedHealthURLWebscraper(chplURL, fileToWriteTo)
} else if URLsEqual(chplURL, footholdURL) {
FootholdURLQuerierParser(footholdURL, fileToWriteTo)
} else if URLsEqual(chplURL, pointclickURL) {
PointclickWebscraper(pointclickURL, fileToWriteTo)
} else if URLsEqual(chplURL, nextgenPracticeURL) {
NextgenPracticeWebscraper(nextgenPracticeURL, fileToWriteTo)
}
}

Expand Down
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"
)

func NextgenPracticeWebscraper(CHPLURL string, fileToWriteTo string) {

var lanternEntryList []LanternEntry
var endpointEntryList EndpointList
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, ".col-md-12.margin-top25")
if err != nil {
log.Fatal(err)
}
doc.Find(".col-md-12.margin-top25").Each(func(index int, divhtml *goquery.Selection) {
divhtml.Find("ul").Each(func(indextr int, ulhtml *goquery.Selection) {
ulhtml.Find("li").Each(func(indextr int, lihtml *goquery.Selection) {
if strings.Contains(lihtml.Text(), "Patient Access Endpoint FHIR R4") {
parts := strings.Split(lihtml.Text(), " - ")
var entry LanternEntry

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

lanternEntryList = append(lanternEntryList, entry)
}
})
})
})

endpointEntryList.Endpoints = lanternEntryList

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

}
51 changes: 51 additions & 0 deletions endpointmanager/pkg/chplendpointquerier/pointclickwebscraper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package chplendpointquerier

import (
"strings"

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

func PointclickWebscraper(CHPLURL string, fileToWriteTo string) {

var lanternEntryList []LanternEntry
var endpointEntryList EndpointList
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, ".container")
if err != nil {
log.Fatal(err)
}
doc.Find(".container").Each(func(index int, containerhtml *goquery.Selection) {
containerhtml.Find("section").Each(func(index int, sectionhtml *goquery.Selection) {
sectionhtml.Find("ol").Each(func(indextr int, olhtml *goquery.Selection) {
olhtml.Find("li").Each(func(indextr int, lihtml *goquery.Selection) {
lihtml.Find("ol").Each(func(indextr int, ol2html *goquery.Selection) {
ol2html.Find("li").Each(func(indextr int, li2html *goquery.Selection) {
if strings.Contains(li2html.Text(), "Note: The base FHIR URL") {
aElem := li2html.Find("a").First()
hrefText, exists := aElem.Attr("href")
if exists {
var entry LanternEntry

entryURL := strings.TrimSpace(hrefText)
entry.URL = entryURL

lanternEntryList = append(lanternEntryList, entry)
}
}
})
})
})
})
})
})

endpointEntryList.Endpoints = lanternEntryList

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

}
2 changes: 1 addition & 1 deletion resources/dev_resources/CHPLEndpointResourcesList.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
},
{
"FormatType": "Lantern",
"URL": "https://mmdpcf.modulemd.com/cf.fhir.r4",
"URL": "https://mmdpcf.modulemd.com/cf.fhir.r4/metadata",
"EndpointName": "ModuleMD",
"FileName": "ModuleMD_EndpointSources.json"
},
Expand Down
Loading
Loading