added a details page (unwired)

fixed logo
print more error messages.
added aetna client.
This commit is contained in:
Jason Kulatunga 2022-09-10 23:12:29 -04:00
parent e24ff1b8f6
commit aefe96c71e
8 changed files with 68 additions and 3 deletions

View File

@ -152,6 +152,16 @@ func (sr *sqliteRepository) GetSources(ctx context.Context) ([]models.Source, er
return providerCredentials, results.Error
}
//func (sr *sqliteRepository) GetSource(ctx context.Context, providerId string) (models.Source, error) {
//
// var providerCredentials models.Source
// results := sr.gormClient.WithContext(ctx).
// Where(models.Source{UserID: sr.GetCurrentUser().ID, ProviderId: providerId}).
// Find(&providerCredentials)
//
// return providerCredential, results.Error
//}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Utilities
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/aetna"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/base"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/cigna"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
@ -17,6 +18,8 @@ func NewClient(providerId string, appConfig config.Interface, globalLogger logru
var updatedSource *models.Source
var err error
switch providerId {
case "aetna":
providerClient, updatedSource, err = aetna.NewClient(appConfig, globalLogger, credentials, testHttpClient...)
case "anthem":
providerClient, updatedSource, err = cigna.NewClient(appConfig, globalLogger, credentials, testHttpClient...)
case "cigna":

View File

@ -0,0 +1,47 @@
package aetna
import (
"context"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
"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 AetnaClient struct {
*base.FHIR401Client
}
func NewClient(appConfig config.Interface, globalLogger logrus.FieldLogger, source models.Source, testHttpClient ...*http.Client) (base.Client, *models.Source, error) {
baseClient, updatedSource, err := base.NewFHIR401Client(appConfig, globalLogger, source, testHttpClient...)
return AetnaClient{
baseClient,
}, updatedSource, err
}
func (c AetnaClient) SyncAll(db database.DatabaseRepository) error {
bundle, err := c.GetPatientBundle(c.Source.PatientId)
if err != nil {
c.Logger.Infof("An error occured while getting patient bundle %s", c.Source.PatientId)
return err
}
wrappedResourceModels, err := c.ProcessBundle(bundle)
if err != nil {
c.Logger.Infof("An error occured while processing patient bundle %s", c.Source.PatientId)
return err
}
//todo, create the resources in dependency order
for _, apiModel := range wrappedResourceModels {
err = db.UpsertResource(context.Background(), apiModel)
if err != nil {
c.Logger.Info("An error occured while upserting resource")
return err
}
}
return nil
}

View File

@ -97,7 +97,7 @@ func (c *BaseClient) GetRequest(resourceSubpath string, decodeModelPtr interface
defer resp.Body.Close()
if resp.StatusCode >= 300 || resp.StatusCode < 200 {
return fmt.Errorf("An error occurred during request - %d - %s", resp.StatusCode, resp.Status)
return fmt.Errorf("An error occurred during request %s - %d - %s", url, resp.StatusCode, resp.Status)
}
err = json.NewDecoder(resp.Body).Decode(decodeModelPtr)

View File

@ -83,6 +83,7 @@ func RawRequestSource(c *gin.Context) {
for _, source := range sources {
if source.ProviderId == c.Param("sourceType") {
foundSource = &source
break
}
}

View File

@ -4,10 +4,12 @@ import { BrowserModule } from "@angular/platform-browser";
import { Routes, RouterModule } from "@angular/router";
import { DashboardComponent } from './pages/dashboard/dashboard.component';
import { MedicalSourcesComponent } from './pages/medical-sources/medical-sources.component';
import {ResourceDetailComponent} from './pages/resource-detail/resource-detail.component';
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
{ path: 'detail', component: ResourceDetailComponent },
{ path: 'sources', component: MedicalSourcesComponent },
// { path: 'general-pages', loadChildren: () => import('./general-pages/general-pages.module').then(m => m.GeneralPagesModule) },
// { path: 'ui-elements', loadChildren: () => import('./ui-elements/ui-elements.module').then(m => m.UiElementsModule) },

View File

@ -14,6 +14,7 @@ import {SharedModule} from './components/shared.module';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'
import { fas } from '@fortawesome/free-solid-svg-icons';
import { far } from '@fortawesome/free-regular-svg-icons';
import { ResourceDetailComponent } from './pages/resource-detail/resource-detail.component';
@NgModule({
declarations: [
@ -22,6 +23,7 @@ import { far } from '@fortawesome/free-regular-svg-icons';
FooterComponent,
DashboardComponent,
MedicalSourcesComponent,
ResourceDetailComponent,
],
imports: [
BrowserModule,

View File

@ -1,12 +1,12 @@
<div class="az-header">
<div class="container">
<div class="az-header-left">
<a routerLink="/" class="az-logo"><span></span> azia</a>
<a routerLink="/" class="az-logo"><span></span> fasten</a>
<a href="#" id="azMenuShow" (click)="toggleHeaderMenu($event)" class="az-header-menu-icon d-lg-none"><span></span></a>
</div><!-- az-header-left -->
<div class="az-header-menu">
<div class="az-header-menu-header">
<a routerLink="/" class="az-logo"><span></span> azia</a>
<a routerLink="/" class="az-logo"><span></span> fasten</a>
<a href="#" (click)="toggleHeaderMenu($event)" class="close">&times;</a>
</div><!-- az-header-menu-header -->
<ul class="nav">