To let this service query a Kubernetes cluster, the cluster needs a role, serviceaccount and rolebinding to grant permission to query the cluster. These resources are created with the following files:
- Service account YAML file: Creates the service account which will be used by the pods. This service account uses the
image-pull-secret. - Role YAML file: Creates role with permission to list services.
- Role Binding YAML file: Binds the role to the service account
To apply them:
kubectl apply -f kubernetes/base/001_focusing-manager-service-account.yaml
kubectl apply -f kubernetes/base/002_focusing-manager-role.yaml
kubectl apply -f kubernetes/base/003_focusing-manager-role-binding.yamlThe service needs the following environment variables:
1. FHIR ENDPOINTS
These URLs may point to the same FHIR server.
FHIR_EPI_URL: URL to the FHIR ePI server endpoint, required for ePI id focusing flows.FHIR_IPS_URL: URL to the FHIR IPS server endpoint, required for IPS id focusing flows.PROFILE_URL: Optional URL to the FHIR server where profile (Persona Vector) is stored.
2. Service Discovery
ENVIRONMENT: Deployment environment (productionfor kubernetes orstandalonefor Docker)FOCUSING_LABEL_SELECTOR: The focusing label selector. Kubernetes cluster (or Docker) will filter the services with this label selector. (defaults toeu.gravitate-health.fosps.focusing=True)PREPROCESSING_LABEL_SELECTOR: The preprocessing label selector. Kubernetes cluster (or Docker) will filter the services with this label selector. (defaults toeu.gravitate-health.fosps.preprocessing=True)PREPROCESSING_EXTERNAL_ENDPOINTS: Optional comma-separated list of external preprocessing service base URLs- Example:
http://preprocessor1.example.com:8080,http://preprocessor2.example.com:9090 - Note: Do not include the
/preprocesspath
- Example:
PREPROCESSING_TIMEOUT: Optional timeout in milliseconds for preprocessing service calls (defaults to20000- 20 seconds)- Example:
30000for 30 seconds - Preprocessing services can take significant time to process ePIs with semantic annotations
- Example:
3. Kubernetes Dev
Optional In production, the service uses the service account to query the cluster. Outside the cluster this is not possible. To develop this service outside the cluster, set the the following enviornment variables (or create a .env file) so the kubernetes client can connect to the cluster:
ENVIRONMENT: "dev"CLUSTER_NAME: Cluster nameCLUSTER_SERVER: Cluster URLCLUSTER_CADATA: CA data of the clusterUSER_NAME: UserUSER_TOKEN: User tokenCONTEXT_NAME: Context name
To deploy the service, create the service, deployment and virtual service:
kubectl apply -f kubernetes-yaml/004_focusing-manager-service.yaml
kubectl apply -f kubernetes-yaml/005_focusing-manager-deployment.yaml
kubectl apply -f kubernetes-yaml/006_focusing-manager_vs.ymlAnd try querying the focusing manager:
curl --location 'https://fosps.gravitatehealth.eu/focusing'The service can be executed listening for changes under the src directory with:
npm run devThis service uses the Kubernetes javascript client to query the kubernetes cluster
This service has 4 ways of focusing ePIs, depending on which parameters you use:
- PI ID + Patient Identifier: Fetch both from servers
- ePI ID + IPS JSON: Provide IPS in request body
- ePI JSON + Patient Identifier: Provide ePI, fetch IPS
- ePI JSON + IPS JSON: Provide both in request body
Optional query parameters:
lenses: Comma-separated list of lens names (omit to use all), available lenses can be found byGET /focusing/lensespreprocessors: Comma-separated list of preprocessor names (omit to use all), available preprocessor can be found byGET /focusing/preprocessing
Example:
curl 'https://fosps.gravitatehealth.eu/focusing/focus/epi123?patientIdentifier=patient456&lenses=lens1,lens2'
In case you find a problem or you need extra help, please use the issues tab to report the issue.
To contribute, fork this repository and send a pull request with the changes squashed.
This project is distributed under the terms of the Apache License, Version 2.0 (AL2). The license applies to this file and other files in the GitHub repository hosting this file.
Copyright 2022 Universidad Politécnica de Madrid
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- Guillermo Mejías (@gmej)
- Alejandro Alonso (@aalonsolopez)
- Alejandro Medrano (@amedranogil)