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

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

alex-odysseus
Copy link
Contributor

@alex-odysseus alex-odysseus commented Sep 26, 2024

Addressing #2349

By default the feature is not enabled

There was a new profile added 'webapi-shiny' so that while building an application it should be specified together with a set property 'shiny.app.directory' pointing to a checked out directory on the build server with the Shiny applications source code (a new OHDSI repository to be created @chrisknoll @anthonysena)

mvn clean package -s WebAPIConfig/settings.xml -P webapi-postgresql,webapi-shiny -D shiny.app.directory=D:\\webapi\\checkout

The following properties to be specified in settings.xml:

<shiny.connect.url>url-to-your-posit-connect-server</shiny.connect.url>
<shiny.connect.api.key>api-key-to-connect-to-posit-connect-server</shiny.connect.api.key>
<!-- A URL to your ATLAS to navigate back to published artifacts from the Shiny applications -->
<shiny.atlas.url>http://localhost:8080/atlas</shiny.atlas.url>
<!-- A URL to the source code repository with Shiny applications (to be created) to navigate to from the Shiny applications -->
<shiny.repo.link>https://github.com/OHDSI/atlasshinyexport-repository-to-be-created</shiny.repo.link>
<shiny.output.directory>a-directory-on-the-build-server-into-which-shiny-application-placeholder-archives-are-built</shiny.output.directory>
<!-- A timeout to connect to Posit Connect Server -->
<shiny.connect.okhttp.timeout.seconds>10</shiny.connect.okhttp.timeout.seconds>

A specific Spring profile is activated
<spring.profiles.active>default,shiny</spring.profiles.active>

wivern and others added 29 commits December 22, 2023 17:08
…es while configuring application Docker container with an --env-file
…ishing connect/read/write timeout, no changes/limits to the call timeout), Improved shiny apps code design, eliminated duplicate logic, implemented properties propagation into R apps using a single file app.properties
<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

return dto;
}
@Override
public PathwayPopulationResultsDTO getGenerationResults(Long generationId) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Being extracted from PathwayController

dataConsumers.getAppProperties().accept("atlas_link", String.format("%s/#/cc/characterizations/%s", atlasUrl, cohortCharacterization.getId()));
dataConsumers.getAppProperties().accept("analysis_name", cohortCharacterization.getName());

generationResults.getReports()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For Cohort Characterization Shiny application report listings export CSV interface has been chosen

import java.util.stream.Collectors;
import java.util.stream.Stream;

public abstract class CommonShinyPackagingService {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A Javadoc to be added

}
}

public final TemporaryFile packageApp(Integer generationId, String sourceKey, PackagingStrategy packaging) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As Shiny applications template archives shouldn't have data and a manifest file should be extended properly with new file entries and signatures an application package creation takes place on the fly so that a 'data' folder is populated with analysis execution results

CommonFileUtils.unzipFiles(templateArchive, path.toFile());
Path manifestPath = path.resolve("manifest.json");
if (!Files.exists(manifestPath)) {
throw new PositConnectClientException("manifest.json is not found in the Shiny Application");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A malformed or missing manifest.json will result in an error while publishing an application to Posit Connect

@anthonysena
Copy link
Collaborator

Notes from demo today on ATLAS WG Call:

  • The configuration of WebAPI controls the ability to show/hide the "Shiny App" button on the Atlas UI. The UI then allows for download/publish but if there is no Posit Connect server, we might want to be able to download only which will require a work-around configuration for now.
  • Shiny reports are designed for a single analysis (i.e. Pathways) on a single data source (i.e. SynPuf). In the future there may be the ability to have multiple data sources included.

@anthonysena
Copy link
Collaborator

@alex-odysseus I've set up the https://github.com/OHDSI/webapi-shiny to hold the Shiny application templates your team has developed.

@anthonysena
Copy link
Collaborator

Converting this to a draft since the necessary Shiny resources are not yet posted to https://github.com/OHDSI/webapi-shiny

@anthonysena anthonysena marked this pull request as draft November 26, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend Posit Connect Shiny applications with Analysis Execution Results from WebAPI
4 participants