Skip to content

Commit

Permalink
Prepared material for hackathon
Browse files Browse the repository at this point in the history
  • Loading branch information
gmej committed May 12, 2023
1 parent 83dcd15 commit 379beb2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Gravitate Health Preprocessing service test
# Gravitate Health Preprocessing service example

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

---
## Table of contents

- [Gravitate Health Preprocessing service test](#gravitate-health-preprocessing-service-test)
- [Gravitate Health Preprocessing service example](#gravitate-health-preprocessing-service-example)
- [Table of contents](#table-of-contents)
- [Introduction](#introduction)
- [Hackaton Considerations](#hackaton-considerations)
Expand All @@ -27,24 +27,27 @@ This service does not need to be published to the internet, so no gateway config

---
## Hackaton Considerations
This repository serves as an example of a preprocessor service. It is written in typescript and executes an example semantic annotation.
In this example, the preprocessing is done in the `src/controllers/preprocessing.ts` file, in the `preprocess` function.
This repository serves as an skeleton for a preprocessor service. It is written in typescript and executes an example semantic annotation, adding a simple tag. The preprocessor must add semmantic annotation to the package leaflet sections of the ePI. No other field in the ePI can be edited.

The hackathon participants may write the preprocessor in the way that best suits for them. The only thing that is mandatory is that the preprocessor API complies with the [OpenApi Specification](./openapi.yaml) within this repository.
In this example, the preprocessing is done in the [src/controllers/preprocessing.ts](./src/controllers/preprocessing.ts) file, in the `addSemmanticAnnotation` function.

The hackathon participants may write the preprocessor in the way that best suits for them. The only thing that is mandatory is that the preprocessor API complies with the [OpenApi Specification](./openapi.yaml) within this repository. Also, the service must listen for HTTP connections on port 3000.

Participants must provide the image name of the preprocessor to the Hackathon organizers and deployment is automatized.

Participants must fork this proyect into their personal github account.

The way the preprocessor is deployed is via a docker image. The current Github Workflow named `docker-image` builds an image with the syntax `ghcr.io/GITHUB_USERNAME/REPOSITORY_NAME`, and publishes it to the repository. The name of this image must be provided to the Hackaton organizers so they can deploy a service running the developed preprocessing service to be tested within the infrastructure.
The way the preprocessor is deployed in the infrascturcure is done with a Github action, which is included in the repository. The action can be found at [.github/workflows/docker-image.yml](./.github/workflows/docker-image.yml), and it builds a Docker image with the syntax `ghcr.io/GITHUB_USERNAME/REPOSITORY_NAME`, and then publishes it to ghcr.io (Github container Registry). The name of this image must be provided to the Hackaton organizers so they can deploy a service running the developed preprocessing service to be tested within the infrastructure. Participants are advised not to edit this Github Action, but if they wanted, they must tag the latest version of the image as `latest`.

The name of the preprocessor will be presented in the Hackathon frontend as team-N_preprocessor
Once the preprocessor is deployed to the infrastructure, the name of the preprocessor will be presented in the Hackathon frontend as `preprocessing-teamN`, being `N` the name of the team.

---
## Kubernetes Deployment

1. Create the following resources:
```bash
kubectl apply -f kubernetes-yaml/001_preprocessing-service-test-service.yaml
kubectl apply -f kubernetes-yaml/002_preprocessing-service-test-deployment.yaml
kubectl apply -f kubernetes-yaml/001_preprocessing-service-example-service.yaml
kubectl apply -f kubernetes-yaml/002_preprocessing-service-example-deployment.yaml
```

In order to be discovered by the focusing manager, the service.yaml needs to include the following selector in the `spec` field:
Expand All @@ -58,7 +61,7 @@ metadata:
---
## Usage
Service will be accessible internally from the kubernetes cluster with the url `http://preprocessing-service-test.default.svc.cluster.local:3000/preprocess`
Service will be accessible internally from the kubernetes cluster with the url `http://preprocessing-service-example.default.svc.cluster.local:3000/preprocess`

---
## Known issues and limitations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
apiVersion: v1
kind: Service
metadata:
name: preprocessing-service-test
name: preprocessing-service-example
labels:
name: preprocessing-service-test
name: preprocessing-service-example
eu.gravitate-health.fosps.preprocessing: "true"
spec:
selector:
app: preprocessing-service-test
app: preprocessing-service-example
ports:
- protocol: TCP
port: 3000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: preprocessing-service-test
name: preprocessing-service-example

spec:
replicas: 1
selector:
matchLabels:
app: preprocessing-service-test
app: preprocessing-service-example
template:
metadata:
labels:
app: preprocessing-service-test
app: preprocessing-service-example
spec:
containers:
- name: preprocessing-service-test
image: gravitate-registry.cr.de-fra.ionos.com/preprocessing-service-test:latest
- name: preprocessing-service-example
image: gravitate-registry.cr.de-fra.ionos.com/preprocessing-service-example:latest
imagePullPolicy: Always
env:
- name: ENVIRONMENT
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "preprocessing-service",
"name": "preprocessing-service-example",
"version": "1.0.0",
"description": "Gravitate-Health Preprocessing Service Test",
"description": "Gravitate-Health Preprocessing Service Example",
"main": "build/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -11,14 +11,14 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/Gravitate-Health/preprocessing-service-test.git"
"url": "git+https://github.com/Gravitate-Health/preprocessing-service-example.git"
},
"author": "Guillermo Mejías ([email protected])",
"license": "ISC",
"bugs": {
"url": "https://github.com/Gravitate-Health/preprocessing-service-test/issues"
"url": "https://github.com/Gravitate-Health/preprocessing-service-example/issues"
},
"homepage": "https://github.com/Gravitate-Health/preprocessing-service-test#readme",
"homepage": "https://github.com/Gravitate-Health/preprocessing-service-example#readme",
"devDependencies": {
"@types/express": "^4.17.17",
"@types/node": "^18.16.1",
Expand Down

0 comments on commit 379beb2

Please sign in to comment.