Skip to content

Commit

Permalink
fix CareEvolution (now configured as a Confidential client)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Sep 25, 2022
1 parent 2ba9f34 commit 581d008
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
3 changes: 3 additions & 0 deletions backend/pkg/hub/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/athena"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/base"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/bluebutton"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/careevolution"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/cerner"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/cigna"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/epic"
Expand All @@ -35,6 +36,8 @@ func NewClient(sourceType pkg.SourceType, ctx context.Context, appConfig config.
sourceClient, updatedSource, err = cigna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
case pkg.SourceTypeBlueButtonMedicare:
sourceClient, updatedSource, err = bluebutton.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
case pkg.SourceTypeCareEvolution:
sourceClient, updatedSource, err = careevolution.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
case pkg.SourceTypeCerner:
sourceClient, updatedSource, err = cerner.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
case pkg.SourceTypeCigna:
Expand Down
22 changes: 22 additions & 0 deletions backend/pkg/hub/internal/fhir/careevolution/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package careevolution

import (
"context"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/base"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
"github.com/sirupsen/logrus"
"net/http"
)

type CareEvolutionClient struct {
*base.FHIR401Client
}

func NewClient(ctx context.Context, appConfig config.Interface, globalLogger logrus.FieldLogger, source models.Source, testHttpClient ...*http.Client) (base.Client, *models.Source, error) {
baseClient, updatedSource, err := base.NewFHIR401Client(ctx, appConfig, globalLogger, source, testHttpClient...)
baseClient.Headers["Accept"] = "application/json+fhir"
return CareEvolutionClient{
baseClient,
}, updatedSource, err
}
5 changes: 2 additions & 3 deletions backend/pkg/web/handler/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ func GetMetadataSource(c *gin.Context) {
string(pkg.SourceTypeEpic): {Display: "Epic (Sandbox)", SourceType: pkg.SourceTypeEpic, Category: []string{"Sandbox"}, Supported: true},
string(pkg.SourceTypeLogica): {Display: "Logica (Sandbox)", SourceType: pkg.SourceTypeLogica, Category: []string{"Sandbox"}, Supported: true},
string(pkg.SourceTypeHealthIT): {Display: "HealthIT (Sandbox)", SourceType: pkg.SourceTypeHealthIT, Category: []string{"Sandbox"}, Supported: true},
//fails with CORS error when swapping token. Must be a confidential client.
string(pkg.SourceTypeCareEvolution): {Display: "CareEvolution (Sandbox)", SourceType: pkg.SourceTypeCareEvolution, Category: []string{"Sandbox"}, Supported: false},

// enabled
string(pkg.SourceTypeAetna): {Display: "Aetna", SourceType: pkg.SourceTypeAetna, Category: []string{"Insurance"}, Supported: true},
Expand All @@ -23,9 +25,6 @@ func GetMetadataSource(c *gin.Context) {
//TODO: infinite pagination for Encounters??
string(pkg.SourceTypeCerner): {Display: "Cerner (Sandbox)", SourceType: pkg.SourceTypeCerner, Category: []string{"Sandbox"}, Supported: true},

//TODO: fails with CORS error when swapping token. Should be confidential client.
string(pkg.SourceTypeCareEvolution): {Display: "CareEvolution (Sandbox)", SourceType: pkg.SourceTypeCareEvolution, Category: []string{"Sandbox"}, Supported: false},

// pending
string(pkg.SourceTypeAnthem): {Display: "Anthem", SourceType: pkg.SourceTypeAnthem, Category: []string{"Insurance"}},
string(pkg.SourceTypeCedarSinai): {Display: "Cedar Sinai", SourceType: pkg.SourceTypeCedarSinai, Category: []string{"Hospital"}},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AppComponent implements OnInit {
}

modifyHeader(location) {
if(location.url.startsWith('/auth'))
if(location.url?.startsWith('/auth'))
{
this.showHeader = false;
} else {
Expand Down
20 changes: 11 additions & 9 deletions frontend/src/app/pages/source-detail/source-detail.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="az-content">
<div *ngIf="resourceTypeCounts" class="container">

<div class="container">
<div class="az-content-left">
<ul class="list-group">
<li *ngFor="let resourceGroup of resourceTypeCounts | keyvalue" (click)="selectResourceType(resourceGroup.key)" class="list-group-item d-flex justify-content-between align-items-center">
Expand All @@ -19,14 +20,15 @@
</div><!-- az-content-body -->
</div><!-- container -->

<div class="container">
<div class="az-error-wrapper">
<h1>{{selectedSource.source_type}}</h1>
<h2>No resources found for this Healthcare provider</h2>
<h6>You may need to re-authenticate to this source, or wait for the resources to sync.</h6>
<a routerLink="/sources" class="btn btn-outline-indigo">Sources</a>
<ng-template #empty >
<div class="container">
<div class="az-error-wrapper">
<h1>{{selectedSource.source_type}}</h1>
<h2>No resources found for this Healthcare provider</h2>
<h6>You may need to re-authenticate to this source, or wait for the resources to sync.</h6>
<a routerLink="/sources" class="btn btn-outline-indigo">Sources</a>
</div>
</div>

</div>
</ng-template>

</div><!-- az-content -->

0 comments on commit 581d008

Please sign in to comment.