Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.3 #121

Merged
merged 69 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
f112362
bump version
nivemaham Jun 18, 2018
2b2ab27
add id to sourceTypeDTO
nivemaham Jun 20, 2018
fa22042
add id to sourceTypeDTO and test
nivemaham Jun 20, 2018
48a093a
Merge pull request #101 from RADAR-base/release-0.2.1
yatharthranjan Jun 20, 2018
367676f
add id to sourceDataDTO and sourceDTO
nivemaham Jun 20, 2018
3742542
Merge branch 'dev' into add-sourcetype-id
nivemaham Jun 20, 2018
c8ef2b0
Merge pull request #103 from RADAR-base/add-sourcetype-id
nivemaham Jun 21, 2018
e74c729
Add sourceTypeId to subjectDTO
yatharthranjan Jun 21, 2018
2a04684
Merge pull request #105 from RADAR-base/add_source_type_id_subject
yatharthranjan Jun 21, 2018
644e110
Ensure that all queries are sorted.
blootsvoets Jun 25, 2018
79cab57
Merge pull request #109 from RADAR-base/fixSorting
blootsvoets Jun 25, 2018
8a74523
Fixed sort keys
blootsvoets Jun 26, 2018
78188af
Remove unused imports
blootsvoets Jun 26, 2018
d559ec2
Added Javadoc and updated SourceMonitor code
blootsvoets Jun 26, 2018
3956b9b
Remove defunct comment
blootsvoets Jun 26, 2018
9933c6a
Merge branch 'dev' into fixSorting
blootsvoets Jun 26, 2018
3c3e392
Merge pull request #111 from RADAR-base/fixSorting
blootsvoets Jun 26, 2018
4cc0b57
Fix `OutOfMemory` exception in MongoDB by controlling maximum output …
nivemaham Jun 26, 2018
ba8ae20
Fix Nullpointer on request param
nivemaham Jun 26, 2018
79f018f
Fix test cases and increment in Days
nivemaham Jun 27, 2018
c09d532
Implemented QueryParamRefiner to reduce complexity and code duplication
nivemaham Jun 27, 2018
c867093
Fix bug in QueryParamsRefiner
nivemaham Jun 28, 2018
99bd0db
Optimized imports
nivemaham Jun 28, 2018
aaf1d15
Again ...
nivemaham Jun 28, 2018
57094a3
Merge pull request #112 from RADAR-base/control-maximum-records-in-query
nivemaham Jun 28, 2018
fca534b
Injectable time scale parser
blootsvoets Jul 2, 2018
691d04f
Tested TimeScaleParser
blootsvoets Jul 2, 2018
f290ecb
Test bad requests
blootsvoets Jul 2, 2018
b509ab5
Moved TimeScale to separate class
blootsvoets Jul 2, 2018
d4b831d
Removed interfering Inject
blootsvoets Jul 2, 2018
5120cbd
Codacy fixes
blootsvoets Jul 2, 2018
537fdaa
Pass TimeScale instead of TimeFrame/TimeWindow combo
blootsvoets Jul 2, 2018
56b05e5
Moved time-related utility functions to TimeScale
blootsvoets Jul 2, 2018
4f39db0
Codacy fixes
blootsvoets Jul 2, 2018
978d918
Fixed import order
blootsvoets Jul 2, 2018
3cf3d4b
Set maximum number of windows to 1000 and updated docs
blootsvoets Jul 2, 2018
04fc832
Moved pair function to RadarConverter
blootsvoets Jul 2, 2018
4cc151b
Codacy fixes
blootsvoets Jul 2, 2018
780be1a
Use correct maxNumberOfWindows variable
blootsvoets Jul 2, 2018
48c61ee
Merge pull request #115 from RADAR-base/timeInjectable
blootsvoets Jul 2, 2018
0f6b5f5
add humanReadableProjectName
nivemaham Jul 10, 2018
3107ef8
update to new radar-auth version
nivemaham Jul 17, 2018
ec1b5a4
changes for radar-auth 0.4.0 and test with MP 0.4.0
nivemaham Jul 18, 2018
c70f75f
update keystore
nivemaham Jul 18, 2018
47248a3
update project attributes
nivemaham Jul 18, 2018
a5fe9a2
Merge pull request #117 from RADAR-base/readable-project-name
nivemaham Jul 18, 2018
fe12d3c
update jersey version
nivemaham Jul 18, 2018
eebca7f
Merge branch 'dev' into questionnaire-completion-log
nivemaham Jul 19, 2018
4be9019
package restructuring
nivemaham Jul 19, 2018
7d0adbe
add questionnairecompletionlogwrapper
nivemaham Jul 19, 2018
25ea873
rename application to applicationstatus
nivemaham Jul 19, 2018
5846fad
add monitordata
nivemaham Jul 20, 2018
dc60303
codacy fix
nivemaham Jul 20, 2018
63bc969
fix test
nivemaham Jul 20, 2018
5f9256e
integrate questionnaire completion log with monitor endpoint
nivemaham Jul 20, 2018
519efe0
add test case to get questionnaire-completion-log values
nivemaham Jul 23, 2018
344c9e9
correct javadoc
nivemaham Jul 23, 2018
a7c94a1
Bug fixes
blootsvoets Jul 26, 2018
8f52987
Functional syntax improvement
blootsvoets Jul 26, 2018
19adc33
extend from header
nivemaham Jul 26, 2018
aabab6c
modify constructors
nivemaham Jul 26, 2018
c38c6e0
change checkSourceAssignedToSubject check to throw exception and keep…
nivemaham Jul 26, 2018
28a260c
Merge pull request #118 from RADAR-base/questionnaire-completion-log
nivemaham Jul 26, 2018
0fdd923
prepare release
nivemaham Sep 12, 2018
90a1570
upgrade to MP 0.5.0
nivemaham Sep 12, 2018
c9ba264
upgrade gradle version
nivemaham Sep 12, 2018
1a4e332
allow creating tokenValidtor using default-config and load public-key…
nivemaham Sep 12, 2018
59ca3e6
add radar-is.yml and env variable.
nivemaham Sep 12, 2018
a4b1c77
Merge pull request #122 from RADAR-base/read-publickey-from-config-file
nivemaham Sep 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To run the application do:
- `/usr/share/conf/radar/rest-api`
- `/usr/local/conf/radar/rest-api`
- run `./gradlew build`
- Run the `radar-restapi-0.2.1.jar` located at `build/libs/`
- Run the `radar-restapi-0.3.jar` located at `build/libs/`

By default, log messages are redirected to the `STDOUT`.

Expand Down
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ plugins {
}

group 'org.radarcns'
version '0.2.1'
version '0.3'

targetCompatibility = '1.8'
sourceCompatibility = '1.8'

ext.grizzly = '2.4.3'
ext.jersey = '2.26'
ext.jersey = '2.27'
ext.junitVersion = '4.12'
ext.hamcrestVersion = '1.3'
ext.logback = '1.2.2'
ext.mongodb = '3.6.0'
ext.radarCommons = '0.7'
ext.swagger = '2.0.0-rc4'
ext.tomcat = '8.0.47'
ext.radarAuthVersion = '0.3.3-SNAPSHOT'
ext.managmentPortalClientVersion = '0.3.4'
ext.radarAuthVersion = '0.5.0'
ext.wireMockVersion = '2.5.1'
ext.jacksonVersion = '2.9.3'
ext.mockitoVersion = '2.2.29'
Expand Down Expand Up @@ -76,3 +75,8 @@ if (!hasProperty('profile')) {
}

apply from: "gradle/profile.${profile}.gradle"


wrapper {
gradleVersion '4.9'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
10 changes: 5 additions & 5 deletions src/endToEndTest/java/org/radarcns/EndToEndTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
import org.radarcns.domain.restapi.dataset.Dataset;
import org.radarcns.domain.restapi.format.Acceleration;
import org.radarcns.domain.restapi.format.Quartiles;
import org.radarcns.domain.restapi.header.DataSetHeader;
import org.radarcns.domain.restapi.header.DescriptiveStatistic;
import org.radarcns.domain.restapi.header.Header;
import org.radarcns.integration.util.ApiClient;
import org.radarcns.integration.util.ExpectedDataSetFactory;
import org.radarcns.integration.util.Utility;
Expand Down Expand Up @@ -258,10 +258,10 @@ private static Map<MockDataConfig, Dataset> getReceivedMessage(

Dataset dataset = Utility.cloneDataset(expectedCount.get(config));

Header updatedHeader = dataset.getHeader();
updatedHeader.setDescriptiveStatistic(DescriptiveStatistic.RECEIVED_MESSAGES);
updatedHeader.setUnit("PERCENTAGE");
dataset.setHeader(updatedHeader);
DataSetHeader updatedHeader = (DataSetHeader) dataset.getHeader()
.descriptiveStatistic(DescriptiveStatistic.RECEIVED_MESSAGES)
.unit("PERCENTAGE");
dataset.header(updatedHeader);

for (DataItem item : dataset.getDataset()) {
if (item.getValue() instanceof Double) {
Expand Down
4 changes: 3 additions & 1 deletion src/integrationTest/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ services:
- simplestack
ports:
- "8080:8080"
environment:
RADAR_IS_CONFIG_LOCATION: /volumes/radar/radar-is.yml
volumes:
- ./volumes/radar:/usr/local/conf/radar/rest-api
- ../test/resources/org/radarcns/status/hdfs/bins.csv:/var/lib/hdfs/output/bins.csv
Expand All @@ -40,7 +42,7 @@ services:
# Management Portal #
#---------------------------------------------------------------------------#
managementportal-app:
image: radarcns/management-portal:0.3.3
image: radarbase/management-portal:0.5.0
networks:
- default
- simplestack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
import org.radarcns.domain.restapi.dataset.Dataset;
import org.radarcns.domain.restapi.format.Acceleration;
import org.radarcns.domain.restapi.format.Quartiles;
import org.radarcns.domain.restapi.header.DataSetHeader;
import org.radarcns.domain.restapi.header.DescriptiveStatistic;
import org.radarcns.domain.restapi.header.Header;
import org.radarcns.domain.restapi.header.TimeFrame;
import org.radarcns.mock.model.ExpectedValue;
import org.radarcns.stream.collector.DoubleArrayCollector;
import org.radarcns.stream.collector.DoubleValueCollector;
import org.radarcns.util.RadarConverter;
import org.radarcns.util.TimeScale;

/**
* Produces {@link Dataset} and {@link org.bson.Document} for {@link ExpectedValue}.
Expand All @@ -57,8 +58,8 @@ public Dataset getDataset(ExpectedValue expectedValue, String projectName, Strin
String sourceId, String sourceType, String sensorType, DescriptiveStatistic statistic,
TimeWindow timeWindow) {

Header header = getHeader(expectedValue, projectName, subjectId, sourceId, sourceType,
sensorType, statistic, timeWindow);
DataSetHeader header = getHeader(expectedValue, projectName, subjectId, sourceId,
sourceType, sensorType, statistic, timeWindow);

return new Dataset(header, getItem(expectedValue, header));
}
Expand All @@ -75,11 +76,11 @@ public Dataset getDataset(ExpectedValue expectedValue, String projectName, Strin
* @param timeWindow time interval between two consecutive samples
* @return {@link Header} for a {@link Dataset}
*/
public Header getHeader(ExpectedValue expectedValue, String projectName, String subjectId,
String sourceId, String sourceType, String sensorType, DescriptiveStatistic statistic,
TimeWindow timeWindow) {
return new Header(projectName, subjectId, sourceId, sourceType, sensorType, statistic,
null, timeWindow, null,
public DataSetHeader getHeader(ExpectedValue expectedValue, String projectName,
String subjectId, String sourceId, String sourceType, String sensorType,
DescriptiveStatistic statistic, TimeWindow timeWindow) {
return new DataSetHeader(projectName, subjectId, sourceId, sourceType, sensorType,
statistic, null, timeWindow, null,
getEffectiveTimeFrame(expectedValue, timeWindow));
}

Expand All @@ -97,7 +98,7 @@ public TimeFrame getEffectiveTimeFrame(ExpectedValue<?> expectedValue, TimeWindo
return new TimeFrame(
Instant.ofEpochMilli(windows.get(0)),
Instant.ofEpochMilli(windows.get(windows.size() - 1))
.plus(RadarConverter.getDuration(timeWindow)));
.plus(TimeScale.getDuration(timeWindow)));
}


Expand All @@ -108,7 +109,7 @@ public TimeFrame getEffectiveTimeFrame(ExpectedValue<?> expectedValue, TimeWindo
* @return {@code List<Item>} for a {@link Dataset}
* @see DataItem
**/
public List<DataItem> getItem(ExpectedValue<?> expectedValue, Header header) {
public List<DataItem> getItem(ExpectedValue<?> expectedValue, DataSetHeader header) {

if (expectedValue.getSeries().isEmpty()) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.radarcns.mongo.util.MongoHelper.Stat;
import org.radarcns.stream.collector.DoubleArrayCollector;
import org.radarcns.stream.collector.DoubleValueCollector;
import org.radarcns.util.RadarConverter;
import org.radarcns.util.TimeScale;

/**
* It computes the expected Documents for a test case i.e. {@link ExpectedValue}.
Expand Down Expand Up @@ -120,7 +120,7 @@ private List<Document> getDocumentsBySingle(ExpectedValue<?> expectedValue,
DoubleValueCollector doubleValueCollector = (DoubleValueCollector) expectedValue
.getSeries().get(timestamp);
Instant start = Instant.ofEpochMilli(timestamp);
Instant end = start.plus(RadarConverter.getDuration(timeWindow));
Instant end = start.plus(TimeScale.getDuration(timeWindow));
list.add(buildDocument(expectedValue.getLastKey().getProjectId(),
expectedValue.getLastKey().getUserId(),
expectedValue.getLastKey().getSourceId(), start, end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

package org.radarcns.integration.util;

import static org.radarcns.mongo.data.monitor.ApplicationStatusRecordCounter.RECORD_COLLECTION;
import static org.radarcns.mongo.data.monitor.ApplicationStatusServerStatus.STATUS_COLLECTION;
import static org.radarcns.mongo.data.monitor.ApplicationStatusUpTime.UPTIME_COLLECTION;
import static java.time.temporal.ChronoUnit.SECONDS;
import static org.radarcns.mongo.data.monitor.application.ApplicationStatusRecordCounter.RECORD_COLLECTION;
import static org.radarcns.mongo.data.monitor.application.ApplicationStatusServerStatus.STATUS_COLLECTION;
import static org.radarcns.mongo.data.monitor.application.ApplicationStatusUpTime.UPTIME_COLLECTION;
import static org.radarcns.mongo.util.MongoHelper.ID;
import static org.radarcns.mongo.util.MongoHelper.KEY;
import static org.radarcns.mongo.util.MongoHelper.PROJECT_ID;
Expand All @@ -42,7 +43,7 @@
import org.radarcns.monitor.application.ServerStatus;
import org.radarcns.stream.collector.DoubleArrayCollector;
import org.radarcns.stream.collector.DoubleValueCollector;
import org.radarcns.util.RadarConverter;
import org.radarcns.util.TimeScale;

/**
* All supported sources specifications.
Expand All @@ -59,29 +60,31 @@ public class RandomInput {
new ExpectedDataSetFactory();

private static ExpectedValue<DoubleValueCollector> randomDoubleValue(
ObservationKey key, TimeWindow timeWindow, int numberOfRecords, Instant startTime) {
ObservationKey key, TimeWindow timeWindow, int numberOfRecords, Instant endTime) {
ExpectedDoubleValue instance = new ExpectedDoubleValue();

Instant timeStamp = startTime;
Instant timeStamp = endTime.minus(
TimeScale.getSeconds(timeWindow) * numberOfRecords, SECONDS);
ThreadLocalRandom random = ThreadLocalRandom.current();
for (int i = 0; i < numberOfRecords; i++) {
instance.add(key, timeStamp.toEpochMilli(), random.nextDouble());
timeStamp = timeStamp.plus(RadarConverter.getDuration(timeWindow));
timeStamp = timeStamp.plus(TimeScale.getDuration(timeWindow));
}

return instance;
}

private static ExpectedValue<DoubleArrayCollector> randomArrayValue(ObservationKey key,
TimeWindow timeWindow, int numberOfRecords, Instant startTime) {
TimeWindow timeWindow, int numberOfRecords, Instant endTime) {
ExpectedArrayValue instance = new ExpectedArrayValue();

ThreadLocalRandom random = ThreadLocalRandom.current();
Instant timeStamp = startTime;
Instant timeStamp = endTime.minus(
TimeScale.getSeconds(timeWindow) * numberOfRecords, SECONDS);
for (int i = 0; i < numberOfRecords; i++) {
instance.add(key, timeStamp.toEpochMilli(), random.nextDouble(), random.nextDouble(),
random.nextDouble());
timeStamp = timeStamp.plus(RadarConverter.getDuration(timeWindow));
timeStamp = timeStamp.plus(TimeScale.getDuration(timeWindow));
}

return instance;
Expand All @@ -94,7 +97,7 @@ private static ExpectedValue<DoubleArrayCollector> randomArrayValue(ObservationK
@SuppressWarnings("PMD.ExcessiveParameterList")
public static Map<String, Object> getDatasetAndDocumentsRandom(String project, String user,
String source, String sourceType, String sourceDataName, DescriptiveStatistic stat,
TimeWindow timeWindow, int samples, boolean singleWindow, Instant startTime) {
TimeWindow timeWindow, int samples, boolean singleWindow, Instant endTime) {
ObservationKey key = new ObservationKey(project, user, source);

int numberOfRecords = samples;
Expand All @@ -104,7 +107,7 @@ public static Map<String, Object> getDatasetAndDocumentsRandom(String project, S

if (SUPPORTED_SOURCE_TYPE.equals(sourceType)) {
return getBoth(key, sourceType, sourceDataName, stat,
timeWindow, numberOfRecords, startTime);
timeWindow, numberOfRecords, endTime);
}

throw new UnsupportedOperationException(sourceType + " is not"
Expand All @@ -114,14 +117,14 @@ public static Map<String, Object> getDatasetAndDocumentsRandom(String project, S
@SuppressWarnings("PMD.ExcessiveParameterList")
private static Map<String, Object> getBoth(ObservationKey key,
String sourceType, String sourceDataName, DescriptiveStatistic stat,
TimeWindow timeWindow, int numberOfRecords, Instant startTime) {
TimeWindow timeWindow, int numberOfRecords, Instant endTime) {
ExpectedValue<?> expectedValue;
switch (sourceDataName) {
case "EMPATICA_E4_v1_ACCELEROMETER":
expectedValue = randomArrayValue(key, timeWindow, numberOfRecords, startTime);
expectedValue = randomArrayValue(key, timeWindow, numberOfRecords, endTime);
break;
default:
expectedValue = randomDoubleValue(key, timeWindow, numberOfRecords, startTime);
expectedValue = randomDoubleValue(key, timeWindow, numberOfRecords, endTime);
break;
}

Expand All @@ -136,6 +139,28 @@ private static Map<String, Object> getBoth(ObservationKey key,
return map;
}

/**
* Generates and returns a randomly generated
* {@link org.radarcns.domain.restapi.monitor.QuestionnaireCompletionStatus} mock data
* sent by RADAR-CNS aRMT.
**/
public static Document getRandomQuestionnaireCompletionLog(String project,
String user, String source) {

ThreadLocalRandom random = ThreadLocalRandom.current();

double timestamp = random.nextDouble();
double completionPercentage = random.nextDouble(0d,100d);
String name = "PHQ8";
Document completionDoc = new Document()
.append("time", timestamp)
.append("name", name)
.append("completionPercentage", completionPercentage);

return buildDocumentWithObservationKey(project, user, source, completionDoc);

}

/**
* Generates and returns a randomly generated {@code ApplicationStatus} mocking data sent by
* RADAR-CNS pRMT.
Expand Down Expand Up @@ -181,9 +206,12 @@ public static Map<String, Document> getRandomApplicationStatus(String project, S
.append("recordsUnsent", recordsUnsent);

Map<String, Document> documents = new HashMap<>();
documents.put(STATUS_COLLECTION, buildAppStatusDocument(project, user, source, statusDoc));
documents.put(RECORD_COLLECTION, buildAppStatusDocument(project, user, source, recordsDoc));
documents.put(UPTIME_COLLECTION, buildAppStatusDocument(project, user, source, uptimeDoc));
documents.put(STATUS_COLLECTION,
buildDocumentWithObservationKey(project, user, source, statusDoc));
documents.put(RECORD_COLLECTION,
buildDocumentWithObservationKey(project, user, source, recordsDoc));
documents.put(UPTIME_COLLECTION,
buildDocumentWithObservationKey(project, user, source, uptimeDoc));
return documents;
}

Expand All @@ -194,7 +222,7 @@ private static Document buildKeyDocument(String projectName, String subjectId,
.append(SOURCE_ID, sourceId);
}

private static Document buildAppStatusDocument(String projectName, String subjectId,
private static Document buildDocumentWithObservationKey(String projectName, String subjectId,
String sourceId,
Document value) {
return new Document().append(ID, "{"
Expand Down
Loading