Contributing to MockData
Source:CONTRIBUTING.md
Thank you for considering contributing to MockData! This package is part of the recodeflow ecosystem and benefits from community input.
Getting Started
Prerequisites
- R (>= 4.2.0)
- RStudio or another R IDE (recommended)
- Git
- Package development tools:
install.packages(c("devtools", "testthat", "roxygen2"))
Setting Up Development Environment
- Fork and clone the repository:
- Open in RStudio:
- Double-click
MockData.Rproj - Or: File → Open Project → Select MockData.Rproj
- Double-click
- Install development dependencies:
devtools::install_dev_deps()- Load the package:
devtools::load_all()Development Workflow
Making Changes
- Create a new branch for your work:
Make your changes following the coding standards below
-
Document your changes:
- Update function documentation (roxygen2 comments)
- Add examples where appropriate
- Update NEWS.md with your changes
-
Write tests for new functionality:
- Add tests to
tests/testthat/test-mockdata.R - Ensure all tests pass:
devtools::test()
- Add tests to
Run checks:
devtools::check()Commit your changes following commit message guidelines
Push and create a pull request
Coding Standards
R Code Style
- Use 2 spaces for indentation (not tabs)
- Line length: aim for < 80 characters, max 100
- Use
<-for assignment, not= - Function names:
snake_case - Variable names:
snake_case - Constants:
SCREAMING_SNAKE_CASE
Documentation
- All exported functions must have roxygen2 documentation
- Include
@param,@return,@examples,@exporttags - Examples should be runnable (use
\dontrun{}sparingly) - Use Canadian spelling (behaviour, colour, centre)
Commit Messages
Follow Canadian Government Digital Standards: - Format: type: brief description - Types: - feat: New feature - fix: Bug fix - docs: Documentation changes - test: Adding or updating tests - refactor: Code refactoring - style: Code style changes (formatting, etc.) - chore: Maintenance tasks
Examples:
feat: add support for date variable generation
fix: handle missing NA codes in categorical variables
docs: update README with CHMS example
test: add tests for parse_range_notation edge cases
Do not credit AI tools in commit messages (as per project guidelines).
Testing
Building Documentation
Prerequisites for documentation builds
- Install Quarto: Download from https://quarto.org/docs/get-started/ or use Homebrew:
- Ensure pkgdown and roxygen2 are available:
- Configure PATH for IDE users (Positron/RStudio):
If you encounter “System command ‘quarto’ failed” errors, add Quarto to your PATH in ~/.Renviron:
PATH="/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH}"
Then restart your R session.
Building the pkgdown site
# 1. Regenerate .Rd files from roxygen comments (after editing R documentation)
roxygen2::roxygenize()
# 2. Build the pkgdown site
pkgdown::build_site()
# 3. Preview locally
browseURL("docs/index.html")Important: Always run roxygen2::roxygenize() before pkgdown::build_site() if you’ve modified roxygen documentation in R files.
Areas for Contribution
High Priority
-
Date variable support: Implement
create_date_var()for linkage testing - Data quality injection: Add functions to inject realistic data quality issues
- Performance optimization: Improve generation speed for large datasets
- Additional vignettes: Real-world use cases and workflows
Recodeflow Schema Compliance
When adding or modifying parsers:
-
Check the schema: See
inst/metadata/schemas/for authoritative definitions - Test with real metadata: Use CCHS, CHMS, or DemPoRT examples
- Document notation support: Update README if adding new notation patterns
- Coordinate with cchsflow/chmsflow: Major schema changes should be discussed
Questions or Issues?
- Package questions: Contact Juan Li (juan.li@oahpp.ca) or Doug Manuel (dmanuel@ohri.ca)
- Bug reports: Open a GitHub issue
- Feature requests: Open a GitHub issue with the “enhancement” label
- Security issues: Email maintainers directly (do not open public issue)