-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into LANTERN-804-Add-webscraper-fhirpt-url
- Loading branch information
Showing
10 changed files
with
140 additions
and
86 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
endpointmanager/pkg/chplendpointquerier/chntechsolutionswebscraper.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package chplendpointquerier | ||
|
||
import ( | ||
"regexp" | ||
"strings" | ||
|
||
"github.com/PuerkitoBio/goquery" | ||
"github.com/onc-healthit/lantern-back-end/endpointmanager/pkg/helpers" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func ChntechsolutionsWebscraper(CHPLURL string, fileToWriteTo string) { | ||
|
||
var lanternEntryList []LanternEntry | ||
var endpointEntryList EndpointList | ||
var entry LanternEntry | ||
|
||
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, "") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
doc.Find("p").Each(func(index int, phtml *goquery.Selection) { | ||
phtml.Find("code").Each(func(index int, phtml *goquery.Selection) { | ||
urlString := strings.ReplaceAll(phtml.Text(), "\n", " ") | ||
pattern := `https[^\s]*metadata` | ||
re := regexp.MustCompile(pattern) | ||
match := re.FindString(urlString) | ||
if len(match) != 0 { | ||
match = strings.TrimSpace(match) | ||
entry.URL = strings.TrimSuffix(match, "/metadata") | ||
lanternEntryList = append(lanternEntryList, entry) | ||
endpointEntryList.Endpoints = lanternEntryList | ||
} | ||
|
||
}) | ||
}) | ||
|
||
err = WriteCHPLFile(endpointEntryList, fileToWriteTo) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
endpointmanager/pkg/chplendpointquerier/correctekwebscraper.go
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
endpointmanager/pkg/chplendpointquerier/zoobooksystemswebscraper.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ZoobooksystemsWebscraper(CHPLURL string, fileToWriteTo string) error { | ||
|
||
var lanternEntryList []LanternEntry | ||
var endpointEntryList EndpointList | ||
doc, err := helpers.ChromedpQueryEndpointList(CHPLURL, ".col-lg-6.text-secondary.fw-bold") | ||
if err != nil { | ||
return 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 | ||
} | ||
}) | ||
} | ||
}) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters