Skip to content

Commit

Permalink
- Add field to federated query
Browse files Browse the repository at this point in the history
- Add field to federated query
- Add it in agg search resource
- Also add some documentation about code formatting
  • Loading branch information
Luke Sikina authored and Luke-Sikina committed Jan 17, 2024
1 parent a379b00 commit 6de3f3b
Show file tree
Hide file tree
Showing 8 changed files with 495 additions and 461 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is the git repository for version 2+ of the PIC-SURE API.
* Java 11
* Before contributing code, please set up our git hook:
`cp code-formatting/pre-commit.sh .git/hooks/pre-commit`
* To skip formatting on a block of code, wrap in `spotless:off`, `spotless:on` comments

## Build
The build consists of the following top level maven modules:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="picsure">
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Context/>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<Context/>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>JAX-RS Simple Service</display-name>
<description>JAX-RS Simple Service</description>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>webapp/WEB-INF/beans.xml</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -6,117 +6,132 @@
import java.util.Map;
import java.util.UUID;

// spotless:off
@Schema(name = "QueryRequest", description = "Object containing credentials map under 'resourceCredentials' and query" +
" object under 'query'. The query object expectedResultType can be on of the following " +
"\"COUNT\", \"CROSS_COUNT\", \"INFO_COLUMN_LISTING\", \"OBSERVATION_COUNT\", \"OBSERVATION_CROSS_COUNT\", \"DATAFRAME\". ",
example = "{\n" +
" \"resourceUUID\": \"<RESOURCE UUID>\",\n" +
" \"query\": {\n" +
" \"categoryFilters\": {\n" +
" \"\\\\demographics\\\\SEX\\\\\": [\n" +
" \"female\",\n" +
" \"male\"\n" +
" ]\n" +
" },\n" +
" \"numericFilters\": {\n" +
" \"\\\\demographics\\\\AGE\\\\\": {\n" +
" \"min\": \"0\",\n" +
" \"max\": \"85\"\n" +
" }\n" +
" },\n" +
" \"requiredFields\": [],\n" +
" \"anyRecordOf\": [\n" +
" \"\\\\demographics\\\\RACE\\\\\"\n" +
" ],\n" +
" \"variantInfoFilters\": [\n" +
" {\n" +
" \"categoryVariantInfoFilters\": {},\n" +
" \"numericVariantInfoFilters\": {}\n" +
" }\n" +
" ],\n" +
" \"expectedResultType\": \"DATAFRAME\",\n" +
" \"fields\": []\n" +
" }\n" +
"}")
" object under 'query'. The query object expectedResultType can be on of the following " +
"\"COUNT\", \"CROSS_COUNT\", \"INFO_COLUMN_LISTING\", \"OBSERVATION_COUNT\", \"OBSERVATION_CROSS_COUNT\", \"DATAFRAME\". ",
example = "{\n" +
" \"resourceUUID\": \"<RESOURCE UUID>\",\n" +
" \"query\": {\n" +
" \"categoryFilters\": {\n" +
" \"\\\\demographics\\\\SEX\\\\\": [\n" +
" \"female\",\n" +
" \"male\"\n" +
" ]\n" +
" },\n" +
" \"numericFilters\": {\n" +
" \"\\\\demographics\\\\AGE\\\\\": {\n" +
" \"min\": \"0\",\n" +
" \"max\": \"85\"\n" +
" }\n" +
" },\n" +
" \"requiredFields\": [],\n" +
" \"anyRecordOf\": [\n" +
" \"\\\\demographics\\\\RACE\\\\\"\n" +
" ],\n" +
" \"variantInfoFilters\": [\n" +
" {\n" +
" \"categoryVariantInfoFilters\": {},\n" +
" \"numericVariantInfoFilters\": {}\n" +
" }\n" +
" ],\n" +
" \"expectedResultType\": \"DATAFRAME\",\n" +
" \"fields\": []\n" +
" }\n" +
"}")

//spotless:on

/*
* QueryRequests for vanilla GIC PIC-SURE. Includes details about the source
* of the request, the requester, and any unifying identifiers for sharing
* QueryRequests for vanilla GIC PIC-SURE. Includes details about the source of the request, the requester, and any unifying identifiers for
* sharing
*/
public class FederatedQueryRequest implements QueryRequest {

@Schema(hidden = true)
private Map<String, String> resourceCredentials = new HashMap<>();

@Schema(hidden = true)
private Object query;

@Schema(hidden = true)
private UUID resourceUUID;

@Schema(hidden = true)
private UUID commonAreaUUID;

@Schema(hidden = true)
private String institutionOfOrigin;

@Override
public Map<String, String> getResourceCredentials() {
return resourceCredentials;
}

@Override
public FederatedQueryRequest setResourceCredentials(Map<String, String> resourceCredentials) {
this.resourceCredentials = resourceCredentials;
return this;
}

@Override
public Object getQuery() {
return query;
}

@Override
public FederatedQueryRequest setQuery(Object query) {
this.query = query;
return this;
}

@Override
public UUID getResourceUUID() {
return resourceUUID;
}

@Override
public void setResourceUUID(UUID resourceUUID) {
this.resourceUUID = resourceUUID;
}

@Override
public FederatedQueryRequest copy() {
FederatedQueryRequest request = new FederatedQueryRequest();
request.setQuery(getQuery());
request.setResourceCredentials(getResourceCredentials());
request.setResourceUUID(getResourceUUID());
request.setCommonAreaUUID(getCommonAreaUUID());
request.setInstitutionOfOrigin(getInstitutionOfOrigin());

return request;
}

public UUID getCommonAreaUUID() {
return commonAreaUUID;
}

public void setCommonAreaUUID(UUID commonAreaUUID) {
this.commonAreaUUID = commonAreaUUID;
}

public String getInstitutionOfOrigin() {
return institutionOfOrigin;
}

public void setInstitutionOfOrigin(String institutionOfOrigin) {
this.institutionOfOrigin = institutionOfOrigin;
}
@Schema(hidden = true)
private Map<String, String> resourceCredentials = new HashMap<>();

@Schema(hidden = true)
private Object query;

@Schema(hidden = true)
private UUID resourceUUID;

@Schema(hidden = true)
private UUID commonAreaUUID;

@Schema(hidden = true)
private String institutionOfOrigin;

@Schema(hidden = true)
private String requesterEmail;

@Override
public Map<String, String> getResourceCredentials() {
return resourceCredentials;
}

@Override
public FederatedQueryRequest setResourceCredentials(Map<String, String> resourceCredentials) {
this.resourceCredentials = resourceCredentials;
return this;
}

@Override
public Object getQuery() {
return query;
}

@Override
public FederatedQueryRequest setQuery(Object query) {
this.query = query;
return this;
}

@Override
public UUID getResourceUUID() {
return resourceUUID;
}

@Override
public void setResourceUUID(UUID resourceUUID) {
this.resourceUUID = resourceUUID;
}

@Override
public FederatedQueryRequest copy() {
FederatedQueryRequest request = new FederatedQueryRequest();
request.setQuery(getQuery());
request.setResourceCredentials(getResourceCredentials());
request.setResourceUUID(getResourceUUID());
request.setCommonAreaUUID(getCommonAreaUUID());
request.setInstitutionOfOrigin(getInstitutionOfOrigin());
request.setRequesterEmail(getRequesterEmail());

return request;
}

public UUID getCommonAreaUUID() {
return commonAreaUUID;
}

public void setCommonAreaUUID(UUID commonAreaUUID) {
this.commonAreaUUID = commonAreaUUID;
}

public String getInstitutionOfOrigin() {
return institutionOfOrigin;
}

public void setInstitutionOfOrigin(String institutionOfOrigin) {
this.institutionOfOrigin = institutionOfOrigin;
}

public String getRequesterEmail() {
return requesterEmail;
}

public void setRequesterEmail(String requesterEmail) {
this.requesterEmail = requesterEmail;
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<version>4.26</version>
<file>code-formatting/eclipse-formatter.xml</file>
</eclipse>
<toggleOffOn />
</java>
</configuration>
</plugin>
Expand Down

0 comments on commit 6de3f3b

Please sign in to comment.