adding docker image.
adding cerner client. adding new images using yarn for npm package management.
|
@ -0,0 +1,7 @@
|
||||||
|
/vendor
|
||||||
|
/.idea
|
||||||
|
/.github
|
||||||
|
/.git
|
||||||
|
/frontend/node_modules
|
||||||
|
/frontend/.angular
|
||||||
|
/dist
|
|
@ -0,0 +1,26 @@
|
||||||
|
FROM node:18.9.0 as frontend-build
|
||||||
|
WORKDIR /usr/src/fastenhealth/frontend
|
||||||
|
#COPY frontend/package.json frontend/yarn.lock ./
|
||||||
|
COPY frontend/package.json ./
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
|
COPY frontend/ ./
|
||||||
|
RUN yarn run build -- --output-path=../dist
|
||||||
|
|
||||||
|
FROM golang:1.18 as backend-build
|
||||||
|
WORKDIR /go/src/github.com/fastenhealth/fastenhealth-onprem
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go mod vendor \
|
||||||
|
&& go install github.com/golang/mock/mockgen@v1.6.0 \
|
||||||
|
&& go generate ./... \
|
||||||
|
&& go vet ./... \
|
||||||
|
&& go test ./...
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 go build -o /go/bin/fasten ./backend/cmd/fasten/
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/static-debian11
|
||||||
|
|
||||||
|
COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/dist
|
||||||
|
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
|
||||||
|
COPY config.yaml /opt/fasten/config.yaml
|
||||||
|
CMD ["/opt/fasten/fasten"]
|
|
@ -1,6 +1,5 @@
|
||||||
package pkg
|
package pkg
|
||||||
|
|
||||||
//go:generate stringer -type=SourceType
|
|
||||||
// SourceType contains all the various medical, insurance, health care providers which Fasten can communicate with
|
// SourceType contains all the various medical, insurance, health care providers which Fasten can communicate with
|
||||||
type SourceType string
|
type SourceType string
|
||||||
|
|
||||||
|
@ -10,10 +9,12 @@ const (
|
||||||
SourceTypeAetna SourceType = "aetna"
|
SourceTypeAetna SourceType = "aetna"
|
||||||
SourceTypeAnthem SourceType = "anthem"
|
SourceTypeAnthem SourceType = "anthem"
|
||||||
SourceTypeCedarSinai SourceType = "cedarssinai"
|
SourceTypeCedarSinai SourceType = "cedarssinai"
|
||||||
|
SourceTypeCerner SourceType = "cerner"
|
||||||
SourceTypeCigna SourceType = "cigna"
|
SourceTypeCigna SourceType = "cigna"
|
||||||
SourceTypeCommonSpirit SourceType = "commonspirit"
|
SourceTypeCommonSpirit SourceType = "commonspirit"
|
||||||
SourceTypeDeltaDental SourceType = "deltadental"
|
SourceTypeDeltaDental SourceType = "deltadental"
|
||||||
SourceTypeDignityHealth SourceType = "dignityhealth"
|
SourceTypeDignityHealth SourceType = "dignityhealth"
|
||||||
|
SourceTypeEpic SourceType = "epic"
|
||||||
SourceTypeHCAHealthcare SourceType = "hcahealthcare"
|
SourceTypeHCAHealthcare SourceType = "hcahealthcare"
|
||||||
SourceTypeHumana SourceType = "humana"
|
SourceTypeHumana SourceType = "humana"
|
||||||
SourceTypeKaiser SourceType = "kaiser"
|
SourceTypeKaiser SourceType = "kaiser"
|
||||||
|
|
|
@ -63,18 +63,107 @@ func (mr *MockDatabaseRepositoryMockRecorder) CreateSource(arg0, arg1 interface{
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSource", reflect.TypeOf((*MockDatabaseRepository)(nil).CreateSource), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSource", reflect.TypeOf((*MockDatabaseRepository)(nil).CreateSource), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentUser mocks base method.
|
// CreateUser mocks base method.
|
||||||
func (m *MockDatabaseRepository) GetCurrentUser() models.User {
|
func (m *MockDatabaseRepository) CreateUser(arg0 context.Context, arg1 *models.User) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "GetCurrentUser")
|
ret := m.ctrl.Call(m, "CreateUser", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateUser indicates an expected call of CreateUser.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) CreateUser(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUser", reflect.TypeOf((*MockDatabaseRepository)(nil).CreateUser), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCurrentUser mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetCurrentUser(arg0 context.Context) models.User {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetCurrentUser", arg0)
|
||||||
ret0, _ := ret[0].(models.User)
|
ret0, _ := ret[0].(models.User)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentUser indicates an expected call of GetCurrentUser.
|
// GetCurrentUser indicates an expected call of GetCurrentUser.
|
||||||
func (mr *MockDatabaseRepositoryMockRecorder) GetCurrentUser() *gomock.Call {
|
func (mr *MockDatabaseRepositoryMockRecorder) GetCurrentUser(arg0 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentUser", reflect.TypeOf((*MockDatabaseRepository)(nil).GetCurrentUser))
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentUser", reflect.TypeOf((*MockDatabaseRepository)(nil).GetCurrentUser), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPatientForSources mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetPatientForSources(ctx context.Context) ([]models.ResourceFhir, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetPatientForSources", ctx)
|
||||||
|
ret0, _ := ret[0].([]models.ResourceFhir)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPatientForSources indicates an expected call of GetPatientForSources.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetPatientForSources(ctx interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPatientForSources", reflect.TypeOf((*MockDatabaseRepository)(nil).GetPatientForSources), ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResource mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetResource(arg0 context.Context, arg1 string) (*models.ResourceFhir, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetResource", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(*models.ResourceFhir)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResource indicates an expected call of GetResource.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetResource(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResource", reflect.TypeOf((*MockDatabaseRepository)(nil).GetResource), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResourceBySourceId mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetResourceBySourceId(arg0 context.Context, arg1, arg2 string) (*models.ResourceFhir, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetResourceBySourceId", arg0, arg1, arg2)
|
||||||
|
ret0, _ := ret[0].(*models.ResourceFhir)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetResourceBySourceId indicates an expected call of GetResourceBySourceId.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetResourceBySourceId(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceBySourceId", reflect.TypeOf((*MockDatabaseRepository)(nil).GetResourceBySourceId), arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSource mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetSource(arg0 context.Context, arg1 string) (*models.Source, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetSource", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(*models.Source)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSource indicates an expected call of GetSource.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetSource(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSource", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSource), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSourceSummary mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetSourceSummary(arg0 context.Context, arg1 string) (*models.SourceSummary, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetSourceSummary", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(*models.SourceSummary)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSourceSummary indicates an expected call of GetSourceSummary.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetSourceSummary(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSourceSummary", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSourceSummary), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSources mocks base method.
|
// GetSources mocks base method.
|
||||||
|
@ -92,30 +181,61 @@ func (mr *MockDatabaseRepositoryMockRecorder) GetSources(arg0 interface{}) *gomo
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSources", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSources), arg0)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSources", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSources), arg0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpsertOrganziation mocks base method.
|
// GetSummary mocks base method.
|
||||||
func (m *MockDatabaseRepository) UpsertOrganziation(arg0 context.Context, arg1 *models.Organization) error {
|
func (m *MockDatabaseRepository) GetSummary(ctx context.Context) (*models.Summary, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "UpsertOrganziation", arg0, arg1)
|
ret := m.ctrl.Call(m, "GetSummary", ctx)
|
||||||
|
ret0, _ := ret[0].(*models.Summary)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSummary indicates an expected call of GetSummary.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetSummary(ctx interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSummary", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSummary), ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserByEmail mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) GetUserByEmail(arg0 context.Context, arg1 string) (*models.User, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetUserByEmail", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(*models.User)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserByEmail indicates an expected call of GetUserByEmail.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) GetUserByEmail(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserByEmail", reflect.TypeOf((*MockDatabaseRepository)(nil).GetUserByEmail), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResources mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) ListResources(arg0 context.Context, arg1 models.ListResourceQueryOptions) ([]models.ResourceFhir, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ListResources", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].([]models.ResourceFhir)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListResources indicates an expected call of ListResources.
|
||||||
|
func (mr *MockDatabaseRepositoryMockRecorder) ListResources(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResources", reflect.TypeOf((*MockDatabaseRepository)(nil).ListResources), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpsertResource mocks base method.
|
||||||
|
func (m *MockDatabaseRepository) UpsertResource(arg0 context.Context, arg1 models.ResourceFhir) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "UpsertResource", arg0, arg1)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpsertOrganziation indicates an expected call of UpsertOrganziation.
|
// UpsertResource indicates an expected call of UpsertResource.
|
||||||
func (mr *MockDatabaseRepositoryMockRecorder) UpsertOrganziation(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockDatabaseRepositoryMockRecorder) UpsertResource(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertOrganziation", reflect.TypeOf((*MockDatabaseRepository)(nil).UpsertOrganziation), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertResource", reflect.TypeOf((*MockDatabaseRepository)(nil).UpsertResource), arg0, arg1)
|
||||||
}
|
|
||||||
|
|
||||||
// UpsertProfile mocks base method.
|
|
||||||
func (m *MockDatabaseRepository) UpsertProfile(arg0 context.Context, arg1 *models.Profile) error {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
ret := m.ctrl.Call(m, "UpsertProfile", arg0, arg1)
|
|
||||||
ret0, _ := ret[0].(error)
|
|
||||||
return ret0
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpsertProfile indicates an expected call of UpsertProfile.
|
|
||||||
func (mr *MockDatabaseRepositoryMockRecorder) UpsertProfile(arg0, arg1 interface{}) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertProfile", reflect.TypeOf((*MockDatabaseRepository)(nil).UpsertProfile), arg0, arg1)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
|
"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/aetna"
|
||||||
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/base"
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/base"
|
||||||
|
"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/cigna"
|
||||||
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/logica"
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/logica"
|
||||||
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/manual"
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/hub/internal/fhir/manual"
|
||||||
|
@ -26,6 +27,8 @@ func NewClient(sourceType pkg.SourceType, ctx context.Context, appConfig config.
|
||||||
sourceClient, updatedSource, err = aetna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
sourceClient, updatedSource, err = aetna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
||||||
case pkg.SourceTypeAnthem:
|
case pkg.SourceTypeAnthem:
|
||||||
sourceClient, updatedSource, err = cigna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
sourceClient, updatedSource, err = cigna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
||||||
|
case pkg.SourceTypeCerner:
|
||||||
|
sourceClient, updatedSource, err = cerner.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
||||||
case pkg.SourceTypeCigna:
|
case pkg.SourceTypeCigna:
|
||||||
sourceClient, updatedSource, err = cigna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
sourceClient, updatedSource, err = cigna.NewClient(ctx, appConfig, globalLogger, credentials, testHttpClient...)
|
||||||
case pkg.SourceTypeLogica:
|
case pkg.SourceTypeLogica:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package base
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
mock_config "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config/mock"
|
mock_config "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config/mock"
|
||||||
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
|
||||||
|
@ -9,6 +10,7 @@ import (
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -35,10 +37,10 @@ func TestNewFHIR401Client(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
//test
|
//test
|
||||||
client, _, err := NewFHIR401Client(fakeConfig, testLogger, models.Source{
|
client, _, err := NewFHIR401Client(context.Background(), fakeConfig, testLogger, models.Source{
|
||||||
RefreshToken: "test-refresh-token",
|
RefreshToken: "test-refresh-token",
|
||||||
AccessToken: "test-access-token",
|
AccessToken: "test-access-token",
|
||||||
})
|
}, &http.Client{})
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -55,10 +57,10 @@ func TestFHIR401Client_ProcessBundle(t *testing.T) {
|
||||||
testLogger := logrus.WithFields(logrus.Fields{
|
testLogger := logrus.WithFields(logrus.Fields{
|
||||||
"type": "test",
|
"type": "test",
|
||||||
})
|
})
|
||||||
client, _, err := NewFHIR401Client(fakeConfig, testLogger, models.Source{
|
client, _, err := NewFHIR401Client(context.Background(), fakeConfig, testLogger, models.Source{
|
||||||
RefreshToken: "test-refresh-token",
|
RefreshToken: "test-refresh-token",
|
||||||
AccessToken: "test-access-token",
|
AccessToken: "test-access-token",
|
||||||
})
|
}, &http.Client{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
jsonBytes, err := readTestFixture("testdata/fixtures/401-R4/bundle/cigna_syntheticuser05-everything.json")
|
jsonBytes, err := readTestFixture("testdata/fixtures/401-R4/bundle/cigna_syntheticuser05-everything.json")
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package mock_base
|
package mock_base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
os "os"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
database "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
|
database "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
|
||||||
|
@ -61,3 +62,55 @@ func (mr *MockClientMockRecorder) SyncAll(db interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncAll", reflect.TypeOf((*MockClient)(nil).SyncAll), db)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncAll", reflect.TypeOf((*MockClient)(nil).SyncAll), db)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncAllBundle mocks base method.
|
||||||
|
func (m *MockClient) SyncAllBundle(db database.DatabaseRepository, bundleFile *os.File) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "SyncAllBundle", db, bundleFile)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// SyncAllBundle indicates an expected call of SyncAllBundle.
|
||||||
|
func (mr *MockClientMockRecorder) SyncAllBundle(db, bundleFile interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncAllBundle", reflect.TypeOf((*MockClient)(nil).SyncAllBundle), db, bundleFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockResourceInterface is a mock of ResourceInterface interface.
|
||||||
|
type MockResourceInterface struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockResourceInterfaceMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockResourceInterfaceMockRecorder is the mock recorder for MockResourceInterface.
|
||||||
|
type MockResourceInterfaceMockRecorder struct {
|
||||||
|
mock *MockResourceInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockResourceInterface creates a new mock instance.
|
||||||
|
func NewMockResourceInterface(ctrl *gomock.Controller) *MockResourceInterface {
|
||||||
|
mock := &MockResourceInterface{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockResourceInterfaceMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||||
|
func (m *MockResourceInterface) EXPECT() *MockResourceInterfaceMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceRef mocks base method.
|
||||||
|
func (m *MockResourceInterface) ResourceRef() (string, *string) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ResourceRef")
|
||||||
|
ret0, _ := ret[0].(string)
|
||||||
|
ret1, _ := ret[1].(*string)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceRef indicates an expected call of ResourceRef.
|
||||||
|
func (mr *MockResourceInterfaceMockRecorder) ResourceRef() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResourceRef", reflect.TypeOf((*MockResourceInterface)(nil).ResourceRef))
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package cerner
|
||||||
|
|
||||||
|
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 CernerClient 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...)
|
||||||
|
return CernerClient{
|
||||||
|
baseClient,
|
||||||
|
}, updatedSource, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c CernerClient) SyncAll(db database.DatabaseRepository) error {
|
||||||
|
|
||||||
|
bundle, err := c.GetPatientBundle(c.Source.PatientId)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
wrappedResourceModels, err := c.ProcessBundle(bundle)
|
||||||
|
if err != nil {
|
||||||
|
c.Logger.Infof("An error occurred 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 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -11,6 +11,8 @@ func GetMetadataSource(c *gin.Context) {
|
||||||
metadataSource := map[string]models.MetadataSource{
|
metadataSource := map[string]models.MetadataSource{
|
||||||
|
|
||||||
string(pkg.SourceTypeLogica): {Display: "Logica (Sandbox)", SourceType: pkg.SourceTypeLogica, Category: []string{"Sandbox"}, Supported: true},
|
string(pkg.SourceTypeLogica): {Display: "Logica (Sandbox)", SourceType: pkg.SourceTypeLogica, Category: []string{"Sandbox"}, Supported: true},
|
||||||
|
string(pkg.SourceTypeEpic): {Display: "Epic (Sandbox)", SourceType: pkg.SourceTypeEpic, Category: []string{"Sandbox"}, Supported: true},
|
||||||
|
string(pkg.SourceTypeCerner): {Display: "Cerner (Sandbox)", SourceType: pkg.SourceTypeCerner, Category: []string{"Sandbox"}, Supported: true},
|
||||||
|
|
||||||
// enabled
|
// enabled
|
||||||
string(pkg.SourceTypeAetna): {Display: "Aetna", SourceType: pkg.SourceTypeAetna, Category: []string{"Insurance"}, Supported: true},
|
string(pkg.SourceTypeAetna): {Display: "Aetna", SourceType: pkg.SourceTypeAetna, Category: []string{"Insurance"}, Supported: true},
|
||||||
|
|
|
@ -154,7 +154,7 @@ func RawRequestSource(c *gin.Context) {
|
||||||
|
|
||||||
foundSource, err := databaseRepo.GetSource(c, c.Param("sourceId"))
|
foundSource, err := databaseRepo.GetSource(c, c.Param("sourceId"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorln("An error occurred while finding source credential", err)
|
logger.Errorf("An error occurred while finding source credential: %v", err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -167,14 +167,14 @@ func RawRequestSource(c *gin.Context) {
|
||||||
|
|
||||||
client, updatedSource, err := hub.NewClient(foundSource.SourceType, c, nil, logger, *foundSource)
|
client, updatedSource, err := hub.NewClient(foundSource.SourceType, c, nil, logger, *foundSource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Could not initialize source client", err)
|
logger.Errorf("Could not initialize source client %v", err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if updatedSource != nil {
|
if updatedSource != nil {
|
||||||
err := databaseRepo.CreateSource(c, updatedSource)
|
err := databaseRepo.CreateSource(c, updatedSource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorln("An error occurred while updating source credential", err)
|
logger.Errorf("An error occurred while updating source credential %v", err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ func RawRequestSource(c *gin.Context) {
|
||||||
var resp map[string]interface{}
|
var resp map[string]interface{}
|
||||||
err = client.GetRequest(strings.TrimSuffix(c.Param("path"), "/"), &resp)
|
err = client.GetRequest(strings.TrimSuffix(c.Param("path"), "/"), &resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Error making raw request", err)
|
logger.Errorf("Error making raw request, %v", err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div *ngFor="let sourceData of availableSourceList" (click)="connect($event, sourceData['source_type'])" class="col-sm-3 mg-b-20 px-3">
|
<div *ngFor="let sourceData of availableSourceList" (click)="connect($event, sourceData['source_type'])" class="col-sm-3 mg-b-20 px-3">
|
||||||
<div class="card h-100 d-flex align-items-center justify-content-center p-3 rounded-0 cursor-pointer">
|
<div class="card h-100 d-flex align-items-center justify-content-center p-3 rounded-0 cursor-pointer" [ngClass]="{'card-disable': !sourceData.enabled}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<img [src]="'assets/sources/'+sourceData['source_type']+'.png'" [alt]="metadataSources[sourceData['source_type']].display" class="img-fluid">
|
<img [src]="'assets/sources/'+sourceData['source_type']+'.png'" [alt]="metadataSources[sourceData['source_type']].display" class="img-fluid">
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ export class MedicalSourcesComponent implements OnInit {
|
||||||
let isConnected = false
|
let isConnected = false
|
||||||
for(const connectedSource of sourceList){
|
for(const connectedSource of sourceList){
|
||||||
if(connectedSource.source_type == sourceType){
|
if(connectedSource.source_type == sourceType){
|
||||||
this.connectedSourceList.push({"source_type": sourceType, "display": this.metadataSources[sourceType]["display"]})
|
this.connectedSourceList.push({"source_type": sourceType, "display": this.metadataSources[sourceType]["display"], "enabled": this.metadataSources[sourceType]["enabled"]})
|
||||||
isConnected = true
|
isConnected = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class MedicalSourcesComponent implements OnInit {
|
||||||
|
|
||||||
if(!isConnected){
|
if(!isConnected){
|
||||||
//this source has not been found in the connected list, lets add it to the available list.
|
//this source has not been found in the connected list, lets add it to the available list.
|
||||||
this.availableSourceList.push({"source_type": sourceType, "display": this.metadataSources[sourceType]["display"]})
|
this.availableSourceList.push({"source_type": sourceType, "display": this.metadataSources[sourceType]["display"], "enabled": this.metadataSources[sourceType]["enabled"]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 121 KiB |
|
@ -4,6 +4,18 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//disable card
|
||||||
|
|
||||||
|
.card-disable {
|
||||||
|
-webkit-filter: grayscale(100%);
|
||||||
|
filter: grayscale(100%);
|
||||||
|
background-color: lightgrey !important;
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* You can add global styles to this file, and also import other style files */
|
/* You can add global styles to this file, and also import other style files */
|
||||||
/*
|
/*
|
||||||
* Azia v1.0.0 (https://www.bootstrapdash.com/demo/azia/v1.0/)
|
* Azia v1.0.0 (https://www.bootstrapdash.com/demo/azia/v1.0/)
|
||||||
|
|