Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ROBERT Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TousAntiCovid sources
ROBERT Server
Commits
f2dd01ac
Commit
f2dd01ac
authored
Sep 29, 2020
by
Deniro StopCovid
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cockpit-to-batch' into 'develop'
feat: Setting Robert Server Batch See merge request
!90
parents
5591f4dc
0fad823a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
96 additions
and
39 deletions
+96
-39
robert-server-batch/pom.xml
robert-server-batch/pom.xml
+14
-1
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/configuration/ScoringAlgorithmConfiguration.java
...er/batch/configuration/ScoringAlgorithmConfiguration.java
+3
-2
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/service/impl/ScoringStrategyV2ServiceImpl.java
...rver/batch/service/impl/ScoringStrategyV2ServiceImpl.java
+1
-1
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/utils/PropertyLoader.java
.../gouv/stopc/robert/server/batch/utils/PropertyLoader.java
+8
-6
robert-server-batch/src/main/resources/application-dev.properties
...erver-batch/src/main/resources/application-dev.properties
+43
-0
robert-server-batch/src/main/resources/application.properties
...rt-server-batch/src/main/resources/application.properties
+0
-25
robert-server-batch/src/main/resources/bootstrap.yml
robert-server-batch/src/main/resources/bootstrap.yml
+26
-0
robert-server-batch/src/test/java/test/fr/gouv/stopc/robertserver/batch/scoring/RSSICalibratedScoringStrategyTest.java
...rver/batch/scoring/RSSICalibratedScoringStrategyTest.java
+1
-3
robert-server-batch/src/test/resources/application.properties
...rt-server-batch/src/test/resources/application.properties
+0
-1
No files found.
robert-server-batch/pom.xml
View file @
f2dd01ac
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<licenses>
...
...
@@ -110,6 +112,17 @@
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-vault-config-consul
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-consul-config
</artifactId>
</dependency>
</dependencies>
<build>
...
...
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/configuration/ScoringAlgorithmConfiguration.java
View file @
f2dd01ac
...
...
@@ -5,13 +5,14 @@ import org.springframework.stereotype.Component;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* Configuration class of the scoring algorithm
*
*
*/
@Getter
@ToString
@Setter
@Component
@ConfigurationProperties
(
prefix
=
"robert.scoring"
)
...
...
@@ -21,7 +22,7 @@ public class ScoringAlgorithmConfiguration {
private
int
rssiMax
;
// Weighting vector for the # of packets received per window values
private
double
[]
deltas
;
private
String
[]
deltas
;
// limit power in Db below which the collected value is assumed to be zero
private
double
p0
;
...
...
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/service/impl/ScoringStrategyV2ServiceImpl.java
View file @
f2dd01ac
...
...
@@ -167,7 +167,7 @@ public class ScoringStrategyV2ServiceImpl implements ScoringStrategyService {
if
(
np
[
k
]
>
0
)
{
kmax
=
k
;
int
dd
=
Math
.
min
(
np
[
k
],
configuration
.
getDeltas
().
length
-
1
);
double
gamma
=
(
qm
[
k
]
-
configuration
.
getP0
())
/
configuration
.
getDeltas
()[
dd
]
;
double
gamma
=
(
qm
[
k
]
-
configuration
.
getP0
())
/
Double
.
parseDouble
(
configuration
.
getDeltas
()[
dd
])
;
double
vrisk
=
(
gamma
<=
0.0
)
?
0.0
:
(
gamma
>=
1
)
?
1.0
:
gamma
;
if
(
vrisk
>
0
)
{
nbcontacts
++;
...
...
robert-server-batch/src/main/java/fr/gouv/stopc/robert/server/batch/utils/PropertyLoader.java
View file @
f2dd01ac
...
...
@@ -4,8 +4,10 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Component
;
import
lombok.Getter
;
import
lombok.ToString
;
@Getter
@ToString
@Component
public
class
PropertyLoader
{
...
...
@@ -25,11 +27,11 @@ public class PropertyLoader {
private
Integer
helloMessageTimeStampTolerance
;
@Value
(
"${robert.protocol.contagious-period}"
)
private
Integer
contagiousPeriod
;
@Value
(
"${robert.scoring.scoring-algo-r0}"
)
private
Double
r0ScoringAlgorithm
;
@Value
(
"${robert.scoring.batch-mode}"
)
private
Integer
contagiousPeriod
;
@Value
(
"${robert.scoring.scoring-algo-r0}"
)
private
Double
r0ScoringAlgorithm
;
@Value
(
"${robert.scoring.batch-mode}"
)
private
String
batchMode
;
}
robert-server-batch/src/main/resources/application-dev.properties
0 → 100644
View file @
f2dd01ac
#spring.data.mongodb.authentication-database= # Authentication database name.
# Database name.
# spring.data.mongodb.database=${ROBERT_SERVER_DB_NAME:protectedRobertDB}
#spring.data.mongodb.field-naming-strategy= # Fully qualified name of the FieldNamingStrategy to use.
#spring.data.mongodb.grid-fs-database= # GridFS database name.
# spring.data.mongodb.host=${ROBERT_SERVER_DB_HOST:localhost}
# Mongo server host.
#spring.data.mongodb.password= # Login password of the mongo server.
# Mongo server port.
# spring.data.mongodb.port=${ROBERT_SERVER_DB_PORT:27017}
spring.data.mongodb.uri
=
${ROBERT_SERVER_DB_URI:mongodb
\:
//${ROBERT_SERVER_DB_HOST:localhost}
\:
${ROBERT_SERVER_DB_PORT:27017}/${ROBERT_SERVER_DB_NAME:protectedRobertDB}}
## Enable Mongo repositories.
# The hostname of the crypto server
robert.crypto.server.host
=
${ROBERT_CRYPTO_SERVER_HOST:localhost}
# The port of the crypto server
robert.crypto.server.port
=
${ROBERT_CRYPTO_SERVER_PORT:9090}
# The time start of the server
robert.server.time-start
=
${ROBERT_SERVER_TIMESTART:20200601}
# RSSI (in dB) at 1 meter used by the scoring algorithm
robert.protocol.scoring-algo-rssi
=
${ROBERT_PROTOCOL_SCORING_ALGO_RSSI:-40}
# Scoring risk threshold
robert.protocol.risk-threshold
=
${ROBERT_PROTOCOL_SCORING_THRESHOLD:0.1}
robert.scoring.deltas
=
${ROBERT_SCORING_DELTAS:39.0,27.0,23.0,21.0,20.0,15.0}
robert.scoring.rssi-max
=
${ROBERT_SCORING_RSSI_MAX:-35}
robert.scoring.p0
=
${ROBERT_SCORING_P0:-66.0}
robert.scoring.soft-max-a
=
${ROBERT_SCORING_SOFT_MAX_A:4.342}
robert.scoring.soft-max-b
=
${ROBERT_SCORING_SOFT_MAX_B:0.2}
robert.scoring.algo-version
=
${ROBERT_SCORING_ALGO_VERSION:2}
robert.scoring.scoring-algo-r0
=
${ROBERT_SCORING_R0:0.0071}
robert.scoring.batch-mode
=
${ROBERT_SCORING_BATCH_MODE:SCORE_CONTACTS_AND_COMPUTE_RISK}
robert.protocol.hello-message-timestamp-tolerance
=
${ROBERT_PROTOCOL_HELLO_TOLERANCE:180}
robert.server.country-code
=
${ROBERT_SERVER_COUNTRY_CODE:0x21}
robert.protocol.contagious-period
=
${ROBERT_PROTOCOL_CONTAGIOUS_PERIOD:14}
robert-server-batch/src/main/resources/application.properties
View file @
f2dd01ac
#spring.data.mongodb.authentication-database= # Authentication database name.
# Database name.
# spring.data.mongodb.database=${ROBERT_SERVER_DB_NAME:protectedRobertDB}
#spring.data.mongodb.field-naming-strategy= # Fully qualified name of the FieldNamingStrategy to use.
#spring.data.mongodb.grid-fs-database= # GridFS database name.
# spring.data.mongodb.host=${ROBERT_SERVER_DB_HOST:localhost}
# Mongo server host.
#spring.data.mongodb.password= # Login password of the mongo server.
# Mongo server port.
# spring.data.mongodb.port=${ROBERT_SERVER_DB_PORT:27017}
spring.data.mongodb.uri
=
${ROBERT_SERVER_DB_URI:mongodb
\:
//${ROBERT_SERVER_DB_HOST:localhost}
\:
${ROBERT_SERVER_DB_PORT:27017}/${ROBERT_SERVER_DB_NAME:protectedRobertDB}}
## Enable Mongo repositories.
# The hostname of the crypto server
...
...
@@ -21,23 +9,10 @@ robert.crypto.server.port=${ROBERT_CRYPTO_SERVER_PORT:9090}
# The time start of the server
robert.server.time-start
=
${ROBERT_SERVER_TIMESTART:20200601}
# RSSI (in dB) at 1 meter used by the scoring algorithm
robert.protocol.scoring-algo-rssi
=
${ROBERT_PROTOCOL_SCORING_ALGO_RSSI:-40}
# Scoring risk threshold
robert.protocol.risk-threshold
=
${ROBERT_PROTOCOL_SCORING_THRESHOLD:0.1}
robert.scoring.deltas
=
${ROBERT_SCORING_DELTAS:39.0,27.0,23.0,21.0,20.0,15.0}
robert.scoring.rssi-max
=
${ROBERT_SCORING_RSSI_MAX:-35}
robert.scoring.p0
=
${ROBERT_SCORING_P0:-66.0}
robert.scoring.soft-max-a
=
${ROBERT_SCORING_SOFT_MAX_A:4.342}
robert.scoring.soft-max-b
=
${ROBERT_SCORING_SOFT_MAX_B:0.2}
robert.scoring.algo-version
=
${ROBERT_SCORING_ALGO_VERSION:2}
robert.scoring.scoring-algo-r0
=
${ROBERT_SCORING_R0:0.0071}
robert.scoring.batch-mode
=
${ROBERT_SCORING_BATCH_MODE:SCORE_CONTACTS_AND_COMPUTE_RISK}
robert.protocol.hello-message-timestamp-tolerance
=
${ROBERT_PROTOCOL_HELLO_TOLERANCE:180}
robert.server.country-code
=
${ROBERT_SERVER_COUNTRY_CODE:0x21}
robert.protocol.contagious-period
=
${ROBERT_PROTOCOL_CONTAGIOUS_PERIOD:14}
robert-server-batch/src/main/resources/bootstrap.yml
0 → 100644
View file @
f2dd01ac
spring
:
application
:
name
:
robert-batch
profiles
:
active
:
${SPRING_PROFILES_ACTIVE:dev}
cloud
:
consul
:
enabled
:
${CONSUL_ENABLED:false}
host
:
${CONSUL_HOST:localhost}
port
:
${CONSUL_PORT:8500}
scheme
:
${CONSUL_SCHEME:http}
token
:
${ROBERT_SERVER_CONSUL_ACL_TOKEN:token}
config
:
enabled
:
${CONSUL_CONFIG_ENABLED:false}
watch
:
enabled
:
false
vault
:
enabled
:
${VAULT_ENABLED:false}
host
:
${VAULT_HOST:localhost}
port
:
${VAULT_PORT:8200}
token
:
${VAULT_TOKEN:token}
scheme
:
${VAULT_SCHEME:http}
robert-server-batch/src/test/java/test/fr/gouv/stopc/robertserver/batch/scoring/RSSICalibratedScoringStrategyTest.java
View file @
f2dd01ac
...
...
@@ -13,23 +13,21 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.Random
;
import
fr.gouv.stopc.robert.server.common.utils.TimeUtils
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.Mock
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.TestPropertySource
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
fr.gouv.stopc.robert.server.batch.RobertServerBatchApplication
;
import
fr.gouv.stopc.robert.server.batch.exception.RobertScoringException
;
import
fr.gouv.stopc.robert.server.batch.service.impl.ScoringStrategyServiceImpl
;
import
fr.gouv.stopc.robert.server.batch.utils.PropertyLoader
;
import
fr.gouv.stopc.robert.server.common.service.IServerConfigurationService
;
import
fr.gouv.stopc.robert.server.common.utils.TimeUtils
;
import
fr.gouv.stopc.robertserver.database.model.Contact
;
import
fr.gouv.stopc.robertserver.database.model.HelloMessageDetail
;
import
lombok.extern.slf4j.Slf4j
;
...
...
robert-server-batch/src/test/resources/application.properties
View file @
f2dd01ac
...
...
@@ -33,4 +33,3 @@ robert.scoring.batch-mode=${ROBERT_SCORING_BATCH_MODE:SCORE_CONTACTS_AND_COMPUTE
robert.server.time-start
=
20200601
robert.protocol.contagious-period
=
14
robert.protocol.hello-message-timestamp-tolerance
=
180
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment