Skip to content

Add URL parameter support for automatic codelist loading #115

@milanwiedemann

Description

@milanwiedemann

Enable the Shiny app to accept URL parameters (e.g., ?codelist=opensafely/anxiety-disorders/6aef605a) to automatically load codelists when the app starts, improving integration with OpenCodelists.org and user experience.

Currently, users must manually copy-paste codelist slugs into the app. Direct linking from http://opencodelists.org/ would imporove the workflow and make the tool more accessible for researchers exploring code usage patterns of codelists.

Proposed Implementation

  • URL parameter parsing: Use parseQueryString() to extract codelist parameter from URL
  • Automatic text input population: Update codelist_slug text input using updateTextInput()
  • Programmatic button trigger: Automatically trigger the "Load codelist" action button

Technical approach

  • Parse URL parameters in server.R using session$clientData$url_search
  • Check for codelist parameter on app initialisation
  • If present, populate the text input and simulate button click
  • Handle error cases gracefully (invalid codelist slugs, network issues)

Future enhancements

  • Support multiple parameters (dataset, date_range)
  • Validation of codelist compatibility with selected dataset

Acceptance Criteria

  • App accepts ?codelist= URL parameter
  • Codelist automatically loads on app startup when parameter present
  • Error handling for invalid codelist slugs
  • Maintains existing functionality when no parameters provided
  • Documentation updated with URL parameter usage examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions