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

Packaging/publication services and analysis execution results data providers for Shiny applications #2399

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
47271f0
ATL-29 API Support for R Shiny Apps
wivern Dec 22, 2023
34bab7d
ATL-29 API Support for R Shiny Apps
wivern Dec 22, 2023
e44462a
ATL-29 API Support for R Shiny Apps
wivern Jan 9, 2024
9a714bd
Migrations
Feb 29, 2024
3246472
Posit API Client updates
Feb 29, 2024
6c0d9a6
Add data files to manifest before publishing
Mar 27, 2024
f5e31b4
Handling the disabled security case
alex-odysseus Apr 7, 2024
2ac1eb2
Adding missing placeholders for Posit Connect and API key
alex-odysseus Apr 7, 2024
57b2cb9
Adds default value for shiny properties
May 16, 2024
9e761fd
ATL-46: Changed filenaming
May 17, 2024
5968034
[ATL-48] Implemented Incidence Rates Analysis Shiny app publishing
oleg-odysseus May 31, 2024
fbdc8db
ATL-46: File name changed
Jun 6, 2024
d41dbd3
[IncidenceRate App] Datasource to be read from text file
oleg-odysseus Jun 10, 2024
535294e
[ATL-53] Added datasource export via file to the data folder for the …
oleg-odysseus Jun 18, 2024
8e9d15e
[ATL-49] Implemented Cohort Characterizations Shiny App Publishing
oleg-odysseus Jun 5, 2024
88c417c
Added SourceKey to Shiny apps Titles
oleg-odysseus Jun 27, 2024
a763994
[ATL-50] Introduced Cohort Pathway Shiny app download and publishing
oleg-odysseus Jun 26, 2024
1b444a4
Explicitly using the dot instead of the underscore as there were issu…
alex-odysseus Jul 1, 2024
2ae926e
Unified Shiny apps names
oleg-odysseus Jul 1, 2024
760403c
[ATL-48] Fixed issue with Incidence Rates app publishing for a No Rec…
oleg-odysseus Jul 12, 2024
d99a1e2
[ATL-50] Changed interface of the Cohort Pathways Shiny app to contai…
oleg-odysseus Aug 22, 2024
16ca514
Added a configurable timeout for OkHttp client (posit shiny apps publ…
oleg-odysseus Aug 23, 2024
e6e972e
Changed MessageFormat to String.format for shiny app names to avoid l…
oleg-odysseus Aug 12, 2024
532fd1d
Unified naming of generation versions for all shiny apps
oleg-odysseus Aug 29, 2024
63c9d33
Added Content-Disposition header to CORS Filter to allow propagating …
oleg-odysseus Aug 30, 2024
364bcce
Added 'analysis_name' to app.properties for Cohort Characterization S…
oleg-odysseus Sep 5, 2024
6d91240
Added design JSON and chart data JSON files to Cohort Pathways Shiny app
oleg-odysseus Sep 18, 2024
35fe824
Fix for eliminating statefulness between Shiny apps generation calls
oleg-odysseus Sep 20, 2024
85266d5
Merge remote-tracking branch 'remotes/upstream/master' into ATL-29
alex-odysseus Sep 24, 2024
4309e66
Added parameters required for the Shiny Apps introduction pages
oleg-odysseus Sep 16, 2024
c94aa0c
Exteacted common constants into a separate enum, changed datasource i…
oleg-odysseus Oct 11, 2024
807603a
Added atlas_link to Pathways Shiny App Properties
oleg-odysseus Nov 19, 2024
75cdbd6
Combining migration scripts
alex-odysseus Dec 10, 2024
b5dda3e
Fixed merge conflicts
oleg-odysseus Dec 27, 2024
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
114 changes: 114 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
<audit.trail.enabled>false</audit.trail.enabled>
<audit.trail.log.file>/tmp/atlas/audit/audit.log</audit.trail.log.file>
<audit.trail.log.extraFile>/tmp/atlas/audit/audit-extra.log</audit.trail.log.extraFile>

<!-- Shiny -->
<shiny.enabled>false</shiny.enabled>
</properties>
<build>
<finalName>WebAPI</finalName>
Expand Down Expand Up @@ -1230,6 +1233,15 @@
<version>2.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down Expand Up @@ -1868,5 +1880,107 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>webapi-shiny</id>
<properties>
<shiny.enabled>true</shiny.enabled>
<shiny.atlas.url>http://localhost/Atlas</shiny.atlas.url>
<shiny.output.directory>src/main/resources/shiny</shiny.output.directory>
<shiny.app.directory></shiny.app.directory>
<spring.profiles.active>default,shiny</spring.profiles.active>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<filesets>
<fileset>
<directory>${shiny.output.directory}</directory>
<includes>
<include>shiny-cohortCounts.zip</include>
<include>shiny-incidenceRates.zip</include>
<include>shiny-cohortCharacterizations.zip</include>
</includes>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should clean 'shiny-cohortPathways.zip' as well

</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>build-cohortCounts-archive</id>
<goals>
<goal>single</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archiveBaseDirectory>${shiny.app.directory}</archiveBaseDirectory>
<outputDirectory>${shiny.output.directory}</outputDirectory>
<descriptors>
<descriptor>src/main/assembly/shiny-cohortCounts.xml</descriptor>
</descriptors>
<finalName>shiny-cohortCounts</finalName>
</configuration>
</execution>
<execution>
<id>build-incidenceRates-archive</id>
<goals>
<goal>single</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archiveBaseDirectory>${shiny.app.directory}</archiveBaseDirectory>
<outputDirectory>${shiny.output.directory}</outputDirectory>
<descriptors>
<descriptor>src/main/assembly/shiny-incidenceRates.xml</descriptor>
</descriptors>
<finalName>shiny-incidenceRates</finalName>
</configuration>
</execution>
<execution>
<id>build-cohortCharacterizations-archive</id>
<goals>
<goal>single</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archiveBaseDirectory>${shiny.app.directory}</archiveBaseDirectory>
<outputDirectory>${shiny.output.directory}</outputDirectory>
<descriptors>
<descriptor>src/main/assembly/shiny-cohortCharacterizations.xml</descriptor>
</descriptors>
<finalName>shiny-cohortCharacterizations</finalName>
</configuration>
</execution>
<execution>
<id>build-cohortPathways-archive</id>
<goals>
<goal>single</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<archiveBaseDirectory>${shiny.app.directory}</archiveBaseDirectory>
<outputDirectory>${shiny.output.directory}</outputDirectory>
<descriptors>
<descriptor>src/main/assembly/shiny-cohortPathways.xml</descriptor>
</descriptors>
<finalName>shiny-cohortPathways</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
18 changes: 18 additions & 0 deletions src/main/assembly/shiny-cohortCharacterizations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>shiny-cohortCharacterizations</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./apps/cohortCharacterization</directory>
<excludes>
<exclude>data/**</exclude>
</excludes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
18 changes: 18 additions & 0 deletions src/main/assembly/shiny-cohortCounts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>shiny-cohortCounts</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./apps/cohortCounts</directory>
<excludes>
<exclude>data/**</exclude>
</excludes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
18 changes: 18 additions & 0 deletions src/main/assembly/shiny-cohortPathways.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>shiny-incidenceRates</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./apps/cohortPathways</directory>
<excludes>
<exclude>data/**</exclude>
</excludes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
18 changes: 18 additions & 0 deletions src/main/assembly/shiny-incidenceRates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
<id>shiny-incidenceRates</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./apps/IncidenceRate</directory>
<excludes>
<exclude>data/**</exclude>
</excludes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
4 changes: 4 additions & 0 deletions src/main/java/org/ohdsi/webapi/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ interface Variables {
}

interface Headers {
String ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers";
String AUTH_PROVIDER = "x-auth-provider";
String USER_LANGAUGE = "User-Language";
String ACTION_LOCATION = "action-location";
String BEARER = "Bearer";
String X_AUTH_ERROR = "x-auth-error";
String CONTENT_DISPOSITION = "Content-Disposition";
}

interface SecurityProviders {
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/ohdsi/webapi/JerseyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@
import org.ohdsi.webapi.service.IRAnalysisResource;
import org.ohdsi.webapi.service.JobService;
import org.ohdsi.webapi.service.PersonService;
import org.ohdsi.webapi.service.ShinyService;
import org.ohdsi.webapi.service.SqlRenderService;
import org.ohdsi.webapi.service.TherapyPathResultsService;
import org.ohdsi.webapi.service.UserService;
import org.ohdsi.webapi.service.VocabularyService;
import org.ohdsi.webapi.shiny.ShinyController;
import org.ohdsi.webapi.source.SourceController;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.inject.Singleton;
import javax.ws.rs.ext.RuntimeDelegate;
import java.util.List;

/**
*
Expand All @@ -46,6 +49,8 @@ public class JerseyConfig extends ResourceConfig implements InitializingBean {

@Value("${jersey.resources.root.package}")
private String rootPackage;
@Value("${shiny.enabled:false}")
private Boolean shinyEnabled;

public JerseyConfig() {
RuntimeDelegate.setInstance(new org.glassfish.jersey.internal.RuntimeDelegateImpl());
Expand Down Expand Up @@ -92,5 +97,8 @@ protected void configure() {
.in(Singleton.class);
}
});
if (shinyEnabled) {
register(ShinyController.class);
}
}
}
33 changes: 1 addition & 32 deletions src/main/java/org/ohdsi/webapi/pathway/PathwayController.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,38 +431,7 @@ public String getGenerationDesign(
public PathwayPopulationResultsDTO getGenerationResults(
@PathParam("generationId") final Long generationId
) {

PathwayAnalysisResult resultingPathways = pathwayService.getResultingPathways(generationId);

List<PathwayCodeDTO> eventCodeDtos = resultingPathways.getCodes()
.stream()
.map(entry -> {
PathwayCodeDTO dto = new PathwayCodeDTO();
dto.setCode(entry.getCode());
dto.setName(entry.getName());
dto.setIsCombo(entry.isCombo());
return dto;
})
.collect(Collectors.toList());

List<TargetCohortPathwaysDTO> pathwayDtos = resultingPathways.getCohortPathwaysList()
.stream()
.map(cohortResults -> {
if (cohortResults.getPathwaysCounts() == null) {
return null;
}

List<PathwayPopulationEventDTO> eventDTOs = cohortResults.getPathwaysCounts()
.entrySet()
.stream()
.map(entry -> new PathwayPopulationEventDTO(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
return new TargetCohortPathwaysDTO(cohortResults.getCohortId(), cohortResults.getTargetCohortCount(), cohortResults.getTotalPathwaysCount(), eventDTOs);
})
.filter(Objects::nonNull)
.collect(Collectors.toList());

return new PathwayPopulationResultsDTO(eventCodeDtos, pathwayDtos);
return pathwayService.getGenerationResults(generationId);
}

private PathwayAnalysisDTO reloadAndConvert(Integer id) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/ohdsi/webapi/pathway/PathwayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.ohdsi.webapi.pathway.domain.PathwayAnalysisEntity;
import org.ohdsi.webapi.pathway.domain.PathwayAnalysisGenerationEntity;
import org.ohdsi.webapi.pathway.dto.PathwayAnalysisDTO;
import org.ohdsi.webapi.pathway.dto.PathwayPopulationResultsDTO;
import org.ohdsi.webapi.pathway.dto.PathwayVersionFullDTO;
import org.ohdsi.webapi.pathway.dto.internal.PathwayAnalysisResult;
import org.ohdsi.webapi.shiro.annotations.PathwayAnalysisGenerationId;
Expand Down Expand Up @@ -69,4 +70,8 @@ public interface PathwayService extends HasTags<Integer> {
PathwayVersion saveVersion(int id);

List<PathwayAnalysisDTO> listByTags(TagNameListRequestDTO requestDTO);

PathwayAnalysisDTO getByGenerationId(Integer id);

PathwayPopulationResultsDTO getGenerationResults(Long generationId);
}
Loading
Loading