-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing missing Epic Legacy client and Definition.
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
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,43 @@ | ||
// Copyright (C) Fasten Health, Inc. - All Rights Reserved. | ||
// | ||
// THIS FILE IS GENERATED BY https://github.com/fastenhealth/fasten-sources-gen | ||
// PLEASE DO NOT EDIT BY HAND | ||
|
||
package platform | ||
|
||
import ( | ||
"context" | ||
base "github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
models "github.com/fastenhealth/fasten-sources/clients/models" | ||
pkg "github.com/fastenhealth/fasten-sources/pkg" | ||
logrus "github.com/sirupsen/logrus" | ||
"net/http" | ||
) | ||
|
||
type sourceClientEpicLegacy struct { | ||
models.SourceClient | ||
} | ||
|
||
/* | ||
This client is used for Epic/MyChart installations that do not support dynamic client registration: | ||
*/ | ||
// https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/.well-known/smart-configuration | ||
// https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/metadata | ||
// https://fhir.epic.com/Documentation?docId=testpatients | ||
func GetSourceClientEpicLegacy(env pkg.FastenLighthouseEnvType, ctx context.Context, globalLogger logrus.FieldLogger, sourceCreds models.SourceCredential, testHttpClient ...*http.Client) (models.SourceClient, error) { | ||
baseClient, err := base.GetSourceClientFHIR401(env, ctx, globalLogger, sourceCreds, testHttpClient...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// API requires the following headers for every request | ||
baseClient.Headers["Accept"] = "application/json+fhir" | ||
|
||
return sourceClientEpicLegacy{baseClient}, err | ||
} | ||
|
||
// Operation-PatientEverything is not supported - https://build.fhir.org/operation-patient-everything.html | ||
// Manually processing individual resources | ||
func (c sourceClientEpicLegacy) SyncAll(db models.DatabaseRepository) (models.UpsertSummary, error) { | ||
supportedResources := append(c.GetUsCoreResources(), []string{"Account", "Appointment", "Consent", "FamilyMemberHistory", "InsurancePlan", "MedicationRequest", "NutritionOrder", "Person", "Provenance", "Questionnaire", "QuestionnaireResponse", "RelatedPerson", "Schedule", "ServiceRequest", "Slot"}...) | ||
return c.SyncAllByResourceName(db, supportedResources) | ||
} |
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,49 @@ | ||
// Copyright (C) Fasten Health, Inc. - All Rights Reserved. | ||
// | ||
// THIS FILE IS GENERATED BY https://github.com/fastenhealth/fasten-sources-gen | ||
// PLEASE DO NOT EDIT BY HAND | ||
|
||
package platform | ||
|
||
import ( | ||
models "github.com/fastenhealth/fasten-sources/definitions/models" | ||
pkg "github.com/fastenhealth/fasten-sources/pkg" | ||
) | ||
|
||
/* | ||
This client is used for Epic/MyChart installations that do not support dynamic client registration: | ||
*/ | ||
// https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/.well-known/smart-configuration | ||
// https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4/metadata | ||
// https://fhir.epic.com/Documentation?docId=testpatients | ||
func GetSourceEpicLegacy(env pkg.FastenLighthouseEnvType, clientIdLookup map[pkg.SourceType]string) (models.LighthouseSourceDefinition, error) { | ||
sourceDef := models.LighthouseSourceDefinition{} | ||
sourceDef.AuthorizationEndpoint = "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/authorize" | ||
sourceDef.TokenEndpoint = "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token" | ||
sourceDef.IntrospectionEndpoint = "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/introspect" | ||
sourceDef.RegistrationEndpoint = "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/register" | ||
|
||
sourceDef.Issuer = "https://fhir.epic.com" | ||
sourceDef.Scopes = []string{"fhirUser", "openid", "profile"} | ||
sourceDef.GrantTypesSupported = []string{"authorization_code"} | ||
sourceDef.ResponseType = []string{"code"} | ||
sourceDef.ResponseModesSupported = []string{"fragment", "query"} | ||
sourceDef.Audience = "https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4" | ||
sourceDef.CodeChallengeMethodsSupported = []string{"S256"} | ||
|
||
sourceDef.ApiEndpointBaseUrl = "https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4" | ||
// retrieve client-id, if available | ||
if clientId, clientIdOk := clientIdLookup[pkg.SourceTypeEpicLegacy]; clientIdOk { | ||
sourceDef.ClientId = clientId | ||
} | ||
sourceDef.RedirectUri = pkg.GetCallbackEndpoint(string(pkg.SourceTypeEpic)) | ||
|
||
sourceDef.Display = "Epic Legacy (Sandbox)" | ||
sourceDef.PlatformType = pkg.SourceTypeEpicLegacy | ||
sourceDef.SourceType = pkg.SourceTypeEpicLegacy | ||
sourceDef.Category = []string{"Sandbox"} | ||
sourceDef.Aliases = []string{} | ||
sourceDef.PatientAccessUrl = "www.epic.com" | ||
|
||
return sourceDef, nil | ||
} |