Skip to content

Commit

Permalink
Merge pull request #10 from bento-platform/qa/v2.3.0
Browse files Browse the repository at this point in the history
qa/v2.3.0
  • Loading branch information
brouillette authored Sep 21, 2021
2 parents 1f6e25a + b9a2fdf commit d3c00ae
Show file tree
Hide file tree
Showing 12 changed files with 387 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ clean-drs-data:
## Tests
test-api-dev: prepare-test-config
@# Run the tests
go test tests/integration/...
go test tests/integration/... -v

prepare-test-config:
@# Prepare environment variables dynamically via a JSON file
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ Generalized Response Body Structure
> }
> },
> ...
> ]
> ],
> "fileId": `string` (UUID),
> "assemblyId": `string` ("GRCh38" | "GRCh37" | "NCBI36" | "Other"),
> },
> ...
> ]
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
- bridge-net
environment:
# API
- GOHAN_DEBUG=${GOHAN_DEBUG}
- GOHAN_API_VCF_PATH=${GOHAN_API_CONTAINERIZED_VCF_PATH}

# Elasticsearch
Expand Down
1 change: 1 addition & 0 deletions etc/example.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Gohan Environment Variables

GOHAN_DEBUG=false
GOHAN_SERVICES=gateway api elasticsearch kibana drs authorization

# Host
Expand Down
1 change: 1 addition & 0 deletions etc/test.config.yml.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
debug: ${GOHAN_DEBUG}
api:
url: "${GOHAN_PUBLIC_URL}"
port: "${GOHAN_API_INTERNAL_PORT}"
Expand Down
4 changes: 4 additions & 0 deletions src/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func main() {
}

fmt.Printf("Using : \n"+

"\tDebug : %t \n\n"+

"\tVCF Directory Path : %s \n"+
"\tElasticsearch Url : %s \n"+
"\tElasticsearch Username : %s\n\n"+
Expand All @@ -43,6 +46,7 @@ func main() {

"Running on Port : %s\n",

cfg.Debug,
cfg.Api.VcfPath,
cfg.Elasticsearch.Url, cfg.Elasticsearch.Username,
cfg.Drs.Url, cfg.Drs.Username,
Expand Down
5 changes: 5 additions & 0 deletions src/api/models/config.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
package models

type Config struct {
Debug bool `yaml:"debug" envconfig:"GOHAN_DEBUG"`

Api struct {
Url string `yaml:"url" envconfig:"GOHAN_PUBLIC_URL"`
Port string `yaml:"port" envconfig:"GOHAN_API_INTERNAL_PORT"`
VcfPath string `yaml:"vcfPath" envconfig:"GOHAN_API_VCF_PATH"`
} `yaml:"api"`

Elasticsearch struct {
Url string `yaml:"url" envconfig:"GOHAN_ES_URL"`
Username string `yaml:"username" envconfig:"GOHAN_ES_USERNAME"`
Password string `yaml:"password" envconfig:"GOHAN_ES_PASSWORD"`
} `yaml:"elasticsearch"`

Drs struct {
Url string `yaml:"url" envconfig:"GOHAN_DRS_URL"`
Username string `yaml:"username" envconfig:"GOHAN_DRS_BASIC_AUTH_USERNAME"`
Password string `yaml:"password" envconfig:"GOHAN_DRS_BASIC_AUTH_PASSWORD"`
} `yaml:"drs"`

AuthX struct {
IsAuthorizationEnabled bool `yaml:"isAuthorizationEnabled" envconfig:"GOHAN_AUTHZ_ENABLED"`
OidcPublicJwksUrl string `yaml:"oidcPublicJwksUrl" envconfig:"GOHAN_PUBLIC_AUTHN_JWKS_URL"`
Expand Down
13 changes: 8 additions & 5 deletions src/api/mvc/variants.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,12 @@ func GetVariantsOverview(c echo.Context) error {

var wg sync.WaitGroup
es := c.(*contexts.GohanContext).Es7Client
cfg := c.(*contexts.GohanContext).Config

callGetBucketsByKeyword := func(key string, keyword string, _wg *sync.WaitGroup) {
defer _wg.Done()

results := esRepo.GetBucketsByKeyword(es, keyword)
results := esRepo.GetBucketsByKeyword(cfg, es, keyword)

// retrieve aggregations.items.buckets
bucketsMapped := []interface{}{}
Expand Down Expand Up @@ -311,6 +312,7 @@ func GetAllVariantIngestionRequests(c echo.Context) error {
}

func executeGetByIds(c echo.Context, ids []string, isVariantIdQuery bool) error {
cfg := c.(*contexts.GohanContext).Config

var es, chromosome, lowerBound, upperBound, reference, alternative, genotype, assemblyId = retrieveCommonElements(c)

Expand Down Expand Up @@ -365,7 +367,7 @@ func executeGetByIds(c echo.Context, ids []string, isVariantIdQuery bool) error

fmt.Printf("Executing Get-Variants for VariantId %s\n", _id)

docs = esRepo.GetDocumentsContainerVariantOrSampleIdInPositionRange(es,
docs = esRepo.GetDocumentsContainerVariantOrSampleIdInPositionRange(cfg, es,
chromosome, lowerBound, upperBound,
_id, "", // note : "" is for sampleId
reference, alternative,
Expand All @@ -377,7 +379,7 @@ func executeGetByIds(c echo.Context, ids []string, isVariantIdQuery bool) error

fmt.Printf("Executing Get-Samples for SampleId %s\n", _id)

docs = esRepo.GetDocumentsContainerVariantOrSampleIdInPositionRange(es,
docs = esRepo.GetDocumentsContainerVariantOrSampleIdInPositionRange(cfg, es,
chromosome, lowerBound, upperBound,
"", _id, // note : "" is for variantId
reference, alternative,
Expand Down Expand Up @@ -426,6 +428,7 @@ func executeGetByIds(c echo.Context, ids []string, isVariantIdQuery bool) error
}

func executeCountByIds(c echo.Context, ids []string, isVariantIdQuery bool) error {
cfg := c.(*contexts.GohanContext).Config

var es, chromosome, lowerBound, upperBound, reference, alternative, genotype, assemblyId = retrieveCommonElements(c)

Expand All @@ -448,7 +451,7 @@ func executeCountByIds(c echo.Context, ids []string, isVariantIdQuery bool) erro

fmt.Printf("Executing Count-Variants for VariantId %s\n", _id)

docs = esRepo.CountDocumentsContainerVariantOrSampleIdInPositionRange(es,
docs = esRepo.CountDocumentsContainerVariantOrSampleIdInPositionRange(cfg, es,
chromosome, lowerBound, upperBound,
_id, "", // note : "" is for sampleId
reference, alternative, genotype, assemblyId)
Expand All @@ -458,7 +461,7 @@ func executeCountByIds(c echo.Context, ids []string, isVariantIdQuery bool) erro

fmt.Printf("Executing Count-Samples for SampleId %s\n", _id)

docs = esRepo.CountDocumentsContainerVariantOrSampleIdInPositionRange(es,
docs = esRepo.CountDocumentsContainerVariantOrSampleIdInPositionRange(cfg, es,
chromosome, lowerBound, upperBound,
"", _id, // note : "" is for variantId
reference, alternative, genotype, assemblyId)
Expand Down
Loading

0 comments on commit d3c00ae

Please sign in to comment.