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 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c05a217
ATL-29 API Support for R Shiny Apps
wivern Dec 22, 2023
78987ce
ATL-29 API Support for R Shiny Apps
wivern Dec 22, 2023
a92a76e
ATL-29 API Support for R Shiny Apps
wivern Jan 9, 2024
84e3886
Migrations
Feb 29, 2024
e61fd7f
Posit API Client updates
Feb 29, 2024
69adde2
Add data files to manifest before publishing
Mar 27, 2024
678e5c4
Handling the disabled security case
alex-odysseus Apr 7, 2024
3c138d2
Adding missing placeholders for Posit Connect and API key
alex-odysseus Apr 7, 2024
25b700d
Adds default value for shiny properties
May 16, 2024
2fc8edf
ATL-46: Changed filenaming
May 17, 2024
3e9fa5f
[ATL-48] Implemented Incidence Rates Analysis Shiny app publishing
oleg-odysseus May 31, 2024
dda1459
ATL-46: File name changed
Jun 6, 2024
174420a
[IncidenceRate App] Datasource to be read from text file
oleg-odysseus Jun 10, 2024
6d8c927
[ATL-53] Added datasource export via file to the data folder for the …
oleg-odysseus Jun 18, 2024
62e29d3
[ATL-49] Implemented Cohort Characterizations Shiny App Publishing
oleg-odysseus Jun 5, 2024
89fad5a
Added SourceKey to Shiny apps Titles
oleg-odysseus Jun 27, 2024
cbe86cd
[ATL-50] Introduced Cohort Pathway Shiny app download and publishing
oleg-odysseus Jun 26, 2024
266dd10
Explicitly using the dot instead of the underscore as there were issu…
alex-odysseus Jul 1, 2024
1ced688
Unified Shiny apps names
oleg-odysseus Jul 1, 2024
c001113
[ATL-48] Fixed issue with Incidence Rates app publishing for a No Rec…
oleg-odysseus Jul 12, 2024
fe0665c
[ATL-50] Changed interface of the Cohort Pathways Shiny app to contai…
oleg-odysseus Aug 22, 2024
053f0d5
Added a configurable timeout for OkHttp client (posit shiny apps publ…
oleg-odysseus Aug 23, 2024
cf6449e
Changed MessageFormat to String.format for shiny app names to avoid l…
oleg-odysseus Aug 12, 2024
9c9e2c0
Unified naming of generation versions for all shiny apps
oleg-odysseus Aug 29, 2024
6bb99a2
Added Content-Disposition header to CORS Filter to allow propagating …
oleg-odysseus Aug 30, 2024
4800b2f
Added 'analysis_name' to app.properties for Cohort Characterization S…
oleg-odysseus Sep 5, 2024
08cb9ee
Added design JSON and chart data JSON files to Cohort Pathways Shiny app
oleg-odysseus Sep 18, 2024
d810efb
Fix for eliminating statefulness between Shiny apps generation calls
oleg-odysseus Sep 20, 2024
e45af1e
Added parameters required for the Shiny Apps introduction pages
oleg-odysseus Sep 16, 2024
bd5f2a0
Exteacted common constants into a separate enum, changed datasource i…
oleg-odysseus Oct 11, 2024
fc3af38
Added atlas_link to Pathways Shiny App Properties
oleg-odysseus Nov 19, 2024
9a0cc1f
Combining migration scripts
alex-odysseus Dec 10, 2024
911d864
Extracted posit-related DTOs, refactoring
oleg-odysseus Mar 10, 2025
aef2ae8
Implemented Shiny Apps Tagging with existing tags, predefined by Posi…
oleg-odysseus Mar 10, 2025
d04951a
Fixed compilation issues after rebase
oleg-odysseus Mar 12, 2025
16249de
Added support for multi-line Author Notes (Analysis descriptions) in …
oleg-odysseus Feb 19, 2025
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 @@ -302,6 +302,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>
Expand Down Expand Up @@ -1256,6 +1259,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>
Expand Down Expand Up @@ -1909,5 +1921,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 @@ -90,9 +90,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
6 changes: 6 additions & 0 deletions src/main/java/org/ohdsi/webapi/JerseyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand All @@ -47,6 +48,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 @@ -94,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