diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..95bd014
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,45 @@
+name: build
+on:
+ push:
+ branches:
+ - "**"
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Checkout github repo
+ uses: actions/checkout@v4
+ - name: Set up JDK 11
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+ - name: Build with maven
+ run: >
+ ./mvnw clean install
+ - name: Upload the artifact
+ if: github.ref == 'refs/heads/main'
+ uses: actions/upload-artifact@v2
+ with:
+ name: query-executor
+
+ sonar:
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Checkout github repo
+ uses: actions/checkout@v4
+ - name: Set up JDK 17
+ uses: actions/setup-java@v1
+ with:
+ java-version: 17
+ - name: Run sonarcloud analysis
+ run: >
+ ./mvnw verify sonar:sonar
+ -Dsonar.sources=src/main/scala
+ -Dsonar.tests=src/test/scala
+ -Dsonar.scala.coverage.reportPaths=target/scoverage.xml
+ -Dsonar.host.url=https://sonarcloud.io
+ -Dsonar.organization=aphp
+ -Dsonar.projectKey=aphp_Cohort360-QueryExecutor
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml
new file mode 100644
index 0000000..b0ea8dc
--- /dev/null
+++ b/.github/workflows/commitlint.yml
@@ -0,0 +1,27 @@
+name: commitlint
+
+on:
+ pull_request:
+ branches:
+ - 'main'
+
+jobs:
+ commit-lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Install commit-lint
+ run: |
+ npm install --force conventional-changelog-conventionalcommits @commitlint/config-conventional commitlint@latest
+ - name: Validate current commit (last commit) with commitlint
+ if: github.event_name == 'push'
+ run: npx commitlint --from HEAD~1 --to HEAD --verbose
+ - name: Validate PR commits with commitlint
+ if: github.event_name == 'pull_request'
+ run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
+ - name: Validate PR title with commitlint
+ if: github.event_name == 'pull_request'
+ run: |
+ echo "${{github.event.pull_request.title}}" | npx commitlint
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..5d31e87
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,49 @@
+name: Publish Docker Image
+
+on:
+ workflow_run:
+ workflows: [ "build" ]
+ types:
+ - completed
+
+jobs:
+ build-and-publish:
+ if: github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Set up JDK 11
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+
+ - name: Extract version from pom.xml
+ id: extract_version
+ run: |
+ VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
+
+ - name: Download artifact
+ uses: actions/download-artifact@v3
+ with:
+ name: query-executor
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v2
+
+ - name: Login to DockerHub
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build and push Docker image
+ uses: docker/build-push-action@v4
+ with:
+ file: ./Dockerfile
+ push: true
+ tags: "${{ secrets.DOCKER_USERNAME }}/c360-query-executor:${{ env.VERSION }}"
\ No newline at end of file
diff --git a/README.md b/README.md
index 7f5b75c..59b40e5 100755
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
# COHORT REQUESTER / SPARK JOB SERVER
+[![Actions Status](https://github.com/aphp/Cohort360-QueryExecutor/workflows/build/badge.svg)](https://github.com/aphp/Cohort360-QueryExecutor/actions)
+[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=aphp_Cohort360-QueryExecutor&metric=coverage)](https://sonarcloud.io/component_measures?id=aphp_Cohort360-QueryExecutor&metric=coverage)
+[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=aphp_Cohort360-QueryExecutor&metric=alert_status)](https://sonarcloud.io/dashboard?id=aphp_Cohort360-QueryExecutor)
+
The Cohort Requester is a spark application server for querying FHIR data with a set of criteria and return a count or list of patients that match the criteria.
## Quick Start
diff --git a/pom.xml b/pom.xml
index a2791d2..61d567e 100755
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
SNAPSHOT
3.6.2
1.4.11
- 0.8.8
+ 0.8.12
diff --git a/src/main/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolver.scala b/src/main/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolver.scala
index 79bd305..e382520 100644
--- a/src/main/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolver.scala
+++ b/src/main/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolver.scala
@@ -142,7 +142,7 @@ class RestFhirResolver(fhirClient: RestFhirClient) extends ResourceResolver {
val results: Bundle =
fhirClient.getBundle(
resourceType,
- addSourcePopulationConstraint(sourcePopulation, f"_id=${chunk.mkString(",")}"),
+ addSourcePopulationConstraint(sourcePopulation, f"_id=${chunk.sorted.mkString(",")}"),
getSubsetElementsFilter(resourceQueryColumns.map(c => c.fhirPath))
)
getAllPagesOfResource(results, resourceQueryColumns)
diff --git a/src/test/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolverTest.scala b/src/test/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolverTest.scala
index 04c0157..229aa68 100644
--- a/src/test/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolverTest.scala
+++ b/src/test/scala/fr/aphp/id/eds/requester/query/resolver/rest/RestFhirResolverTest.scala
@@ -130,7 +130,7 @@ class RestFhirResolverTest extends AnyFunSuiteLike with DatasetComparer {
restFhirClient,
"/resolver/restfhir/testCases/withPatientJoinResource/bundle.patient.json",
FhirResource.PATIENT,
- "_id=1900536,1566947&_list=1,2,3,4,5,6,7,8,9,10",
+ "_id=1566947,1900536&_list=1,2,3,4,5,6,7,8,9,10",
List("birthDate", "id")
)
},