Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorva64 committed Oct 23, 2024
2 parents 41f9b57 + 03d1680 commit aebd4be
Show file tree
Hide file tree
Showing 30 changed files with 870 additions and 39 deletions.
66 changes: 66 additions & 0 deletions cloud/backend/alert-management/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Service-analyse-haut-niveau

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>.

## Running the application in dev mode

You can run your application in dev mode that enables live coding using:

```shell script
./mvnw compile quarkus:dev
```

> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>.
## Packaging and running the application

The application can be packaged using:

```shell script
./mvnw package
```

It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.

The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.

If you want to build an _über-jar_, execute the following command:

```shell script
./mvnw package -Dquarkus.package.jar.type=uber-jar
```

The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.

## Creating a native executable

You can create a native executable using:

```shell script
./mvnw package -Dnative
```

Or, if you don't have GraalVM installed, you can run the native executable build in a container using:

```shell script
./mvnw package -Dnative -Dquarkus.native.container-build=true
```

You can then execute your native executable with: `./target/Service-analyse-haut-niveau-1.0.0-SNAPSHOT-runner`

If you want to learn more about building native executables, please consult <https://quarkus.io/guides/maven-tooling>.

## Related Guides

- REST ([guide](https://quarkus.io/guides/rest)): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it.

## Provided Code

### REST

Easily start your REST Web Services

[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources)
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public List<Alert> createAlertFromManager(Map<String, Object> alertData) throws
createdAlerts.add(alertEntity);
}

return createdAlerts; // Retourner la liste des alertes créées
return createdAlerts;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ quarkus.swagger-ui.path=/swagger-ui
quarkus.smallrye-openapi.enable=true
quarkus.smallrye-openapi.format=yaml
quarkus.smallrye-openapi.store-schema-directory=target/generated/
quarkus.http.port=${PORT:8082}
quarkus.http.port=${PORT:8086 }

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ quarkus.oidc.application-type=web-app
# Docker build properties
quarkus.container-image.registry=ghcr.io

# Quarkus swagger UI
quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.path=/swagger-ui
quarkus.smallrye-openapi.enable=true
quarkus.smallrye-openapi.format=yaml
quarkus.smallrye-openapi.store-schema-directory=target/generated/

quarkus.http.port=${PORT:8084}
quarkus.metric.enabled=true

Expand Down
2 changes: 1 addition & 1 deletion cloud/config/alertmanager/alertmanager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ route:
receivers:
- name: 'webhook_receiver'
webhook_configs:
- url: 'http://host.docker.internal:8082/alert/receiveAlert'
- url: 'http://host.docker.internal:8086/alert/receiveAlert'

2 changes: 1 addition & 1 deletion cloud/config/read/rules/acceleration_alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ groups:
labels:
severity: "WARNING"
type: "acceleration"
gatewayId: "example-gateway-id"
gatewayId: "6718fcc16adfca0b7f8f6a67"
value: "{{ $value }}"
annotations:
summary: "High Acceleration Alert"
Expand Down
2 changes: 1 addition & 1 deletion cloud/config/read/rules/glucose_alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ groups:
labels:
severity: "WARNING"
type: "glucose"
gatewayId: "example-gateway-id"
gatewayId: "e6718fcc16adfca0b7f8f6a67"
value: "{{ $value }}"
annotations:
summary: "Low Glucose Alert"
Expand Down
2 changes: 1 addition & 1 deletion cloud/config/read/rules/heartrate_alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ groups:
labels:
severity: "WARNING"
type: "heartrate"
gatewayId: "example-gateway-id"
gatewayId: "e6718fcc16adfca0b7f8f6a67"
value: "{{ $value }}"

annotations:
Expand Down
2 changes: 1 addition & 1 deletion cloud/config/read/rules/temperature_alerts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ groups:
labels:
severity: "WARNING"
type: "temperature"
gatewayId: "example-gateway-id"
gatewayId: "6718fcc16adfca0b7f8f6a67"
value: "{{ $value }}"

annotations:
Expand Down
24 changes: 24 additions & 0 deletions cloud/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:lts AS build

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

# Production stage
FROM nginx:stable-bookworm

# Install envsubst
RUN apt-get update && apt-get install -y gettext-base && rm -rf /var/lib/apt/lists/*

COPY --from=build /app/dist /usr/share/nginx/html

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

EXPOSE 80

ENTRYPOINT ["/docker-entrypoint.sh"]
18 changes: 18 additions & 0 deletions cloud/frontend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/env bash

# List of environment variables to include
include_vars=("ALERT_MANAGEMENT_BASE_URL" "PATIENT_MANAGEMENT_BASE_URL" "ANALYSE_HAUT_NIVEAU_MANAGEMENT_BASE_URL")

# Convert specified environment variables to JSON format
{
echo "{"
for var in "${include_vars[@]}"; do
if [ -n "${!var}" ]; then
echo "\"$var\":\"${!var}\","
fi
done
echo "}" | sed 's/,}/}/'
} > /usr/share/nginx/html/env

# Start Nginx
nginx -g "daemon off;"
13 changes: 12 additions & 1 deletion cloud/frontend/src/clients/alert-management/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ import type { Configuration } from './configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';

export const BASE_PATH = "http://localhost:8082".replace(/\/+$/, "");
export let BASE_PATH = "http://localhost:8082".replace(/\/+$/, "");

fetch("/env").then(
(response) => {
response.json().then((data) => {
BASE_PATH = data.ALERT_MANAGEMENT_BASE_URL.replace(/\/+$/, "");
});
},
(error) => {
console.error("Failed to fetch /env: ", error);
}
);

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
openapi: 3.0.3
info:
title: analyse-haut-niveau-management API
version: 1.0.0-SNAPSHOT
servers:
- url: http://localhost:8084
description: Auto generated value
- url: http://0.0.0.0:8084
description: Auto generated value
paths:
/metrics/kpis:
get:
tags:
- Metrics Resource
parameters:
- name: end
in: query
schema:
type: string
- name: start
in: query
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/JsonObject"
components:
schemas:
JsonObject:
type: array
items:
type: object
properties:
key:
type: string
value: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.gitignore
.npmignore
.openapi-generator-ignore
api.ts
api/metrics-resource-api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
models/index.ts
models/json-object-inner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.9.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
/**
* analyse-haut-niveau-management API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0-SNAPSHOT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



export * from './api/metrics-resource-api';

Loading

0 comments on commit aebd4be

Please sign in to comment.