Skip to content

Commit

Permalink
Merge pull request #163 from GenomicDataInfrastructure/main
Browse files Browse the repository at this point in the history
chore: promote main changes
  • Loading branch information
brunopacheco1 authored Nov 29, 2024
2 parents a4ba47f + a37325f commit dbf5596
Show file tree
Hide file tree
Showing 56 changed files with 1,705 additions and 1,669 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
load: true

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: "${{ steps.tag.outputs.last_tag }}"
format: "table"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: "${{ steps.tag.outputs.last_tag }}"
format: "table"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v4
- uses: fsfe/reuse-action@v4
- uses: fsfe/reuse-action@v5
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ nb-configuration.xml
# Plugin directory
/.quarkus/cli/plugins/
__pycache__/
venv/
venv/
infra/config/.env.secrets
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
FROM registry.access.redhat.com/ubi9-minimal:9.4-1227.1726694542
FROM registry.access.redhat.com/ubi9-minimal:9.5-1731604394
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
Expand Down
101 changes: 83 additions & 18 deletions _http/beacon.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,93 @@
#
# SPDX-License-Identifier: Apache-2.0


## Ontology
POST https://beacon-network-backend-demo.ega-archive.org/beacon-network/v2.0.0/individuals
Content-Type: application/json

{
"meta": {
"apiVersion": "2.0"
},
"query": {
"filters": [
{
"id": "ICD10:J40",
"scope": "individual"
}
],
"requestParameters": [],
"includeResultsetResponses": "HIT",
"pagination": {
"skip": 0,
"limit": 1
},
"testMode": false,
"requestedGranularity": "record"
}
}


### Alphanumeric
POST https://beacon-network-backend-demo.ega-archive.org/beacon-network/v2.0.0/individuals
Content-Type: application/json

{
"meta": {
"apiVersion": "2.0"
},
"query": {
"filters": [
{
"id": "PATO:0000011",
"operator": ">",
"value": "P30Y",
"scope": "individual"
}
],
"requestParameters": [],
"includeResultsetResponses": "HIT",
"pagination": {
"skip": 0,
"limit": 1
},
"testMode": false,
"requestedGranularity": "record"
}
}


### Variants
POST https://beacon-network-backend-demo.ega-archive.org/beacon-network/v2.0.0/individuals
Content-Type: application/json

{
"meta":{
"apiVersion":"2.0"
},
"query":{
"filters":[
{
"id":"UBERON:0005352",
"scope": "individual"
}
],
"includeResultsetResponses":"HIT",
"pagination":{
"skip":0,
"limit":0
},
"testMode":false,
"requestedGranularity":"count"
}
"$schema":"beaconRequestBody.json",
"meta": {
"apiVersion": "2.0",
"requestedSchemas": [
{
"entityType": "genomicVariation",
"schema:": "https://raw.githubusercontent.com/ga4gh-beacon/beacon-v2/main/models/json/beacon-v2-default-model/genomicVariations/defaultSchema.json"
}
]
},
"query": {
"requestParameters": {
"g_variant": {
"referenceName": "NC_000017.11",
"start": [7577120],
"referenceBases": "G",
"alternateBases": "A"
}
}
},
"requestedGranularity": "record",
"pagination": {
"skip": 0,
"limit": 10
}
}

###
Expand Down
18 changes: 18 additions & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
SPDX-FileCopyrightText: 2024 PNED G.I.E.
SPDX-License-Identifier: CC-BY-4.0
-->
## To Run the application locally

* Create a new file named .env.secrets in infra/config by copying .env.secrets.template and updating the secret values
* To build and start the docker image using your local changes Run the script

```bash
./start.sh
```
* To stop the application run the below script

```bash
./stop.sh
```
15 changes: 15 additions & 0 deletions infra/config/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
# Common Quarkus
QUARKUS_OIDC_AUTH_SERVER_URL=https://id.portal.dev.gdi.lu/realms/gdi
QUARKUS_OIDC_CLIENT_ID=gdi
QUARKUS_LOG_LEVEL=DEBUG
QUARKUS_OTEL_METRICS_ENABLED=false


# Dataset Discovery Service
QUARKUS_REST_CLIENT_CKAN_YAML_URL=https://catalogue.portal.dev.gdi.lu/
QUARKUS_REST_CLIENT_BEACON_YAML_URL=https://beacon-network-backend-demo.ega-archive.org/beacon-network
QUARKUS_REST_CLIENT_KEYCLOAK_YAML_URL=https://id.portal.dev.gdi.lu/realms/gdi
QUARKUS_REST_CLIENT_KEYCLOAK_YAML_BEACON_IDP_ALIAS=LSAAI
4 changes: 4 additions & 0 deletions infra/config/.env.secrets.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
QUARKUS_OIDC_CREDENTIALS_SECRET= if you do not have one ask your colleagues to share this with you
18 changes: 18 additions & 0 deletions infra/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

services:
dataset-discovery-service:
container_name: dds
image: local/dds:latest
build:
context: ../
restart: unless-stopped
ports:
- "8080:8080"
env_file:
- ./config/.env
- ./config/.env.secrets
healthcheck:
test: ["CMD", "curl", "-o", "/dev/null", "http://localhost:8080/q/health"]
24 changes: 24 additions & 0 deletions infra/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
#!/bin/bash

cd ../

# Run Maven build
echo "Building the application ..."

if ! mvn clean package -Dnative -Dquarkus.native.container-build=true; then
echo "Maven build failed. Please check the output for errors."
exit 1
fi

echo "Maven build completed successfully."

echo "Building application docker image"
docker build -t local/dds .

echo "Docker image build completed successfully."

echo "Starting application"
docker-compose -f ./infra/docker-compose.yml up
6 changes: 6 additions & 0 deletions infra/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
#!/bin/bash

docker-compose down
19 changes: 16 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
<assertj.version>3.26.3</assertj.version>
<checkstyle-maven-plugin.version>3.3.1</checkstyle-maven-plugin.version>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<lombok.version>1.18.34</lombok.version>
<lombok.version>1.18.36</lombok.version>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-openapi-generator.version>2.5.0</quarkus-openapi-generator.version>
<quarkus-openapi-generator.version>2.6.0-lts</quarkus-openapi-generator.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.16.1</quarkus.platform.version>
<quarkus.platform.version>3.17.2</quarkus.platform.version>
<skipITs>true</skipITs>
<surefire.version>3.5.2</surefire.version>
<quarkus-wiremock.version>1.4.0</quarkus-wiremock.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -138,6 +139,17 @@
<artifactId>quarkus-jacoco</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -172,6 +184,7 @@
<configuration>
<compilerArgs>
<arg>-parameters</arg>
<arg>-Amapstruct.unmappedTargetPolicy=ERROR</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toMap;
import static org.apache.commons.lang3.ObjectUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@ApplicationScoped
Expand All @@ -47,7 +48,8 @@ public Map<String, Integer> collect(DatasetSearchQuery query, String accessToken

var beaconQuery = BeaconIndividualsRequestMapper.from(query);

if (beaconAuthorization == null || beaconQuery.getQuery().getFilters().isEmpty()) {
if (beaconAuthorization == null || (isEmpty(beaconQuery.getQuery().getFilters()) &&
isEmpty(beaconQuery.getQuery().getRequestParameters()))) {
return null;
}

Expand Down
Loading

0 comments on commit dbf5596

Please sign in to comment.