Thank you for considering contributing to MockData! This package is part of the recodeflow ecosystem and benefits from community input.
- R (>= 4.2.0)
- RStudio or another R IDE (recommended)
- Git
- Package development tools:
install.packages(c("devtools", "testthat", "roxygen2"))
- Fork and clone the repository:
git clone https://github.com/your-username/MockData.git
cd MockData-
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()- Create a new branch for your work:
git checkout -b feature/your-feature-name-
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
- 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
- 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)
Follow Canadian Government Digital Standards:
- Format:
type: brief description - Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringstyle: 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).
# Run all tests
devtools::test()
# Run specific test file
testthat::test_file("tests/testthat/test-mockdata.R")
# Run with coverage
covr::package_coverage()- Place tests in
tests/testthat/test-mockdata.R - Use descriptive test names:
test_that("parse_range_notation handles closed intervals", { ... }) - Test edge cases and error conditions
- Aim for high code coverage
- Use existing metadata in
inst/extdata/for tests - If adding new test data, document its purpose
- Keep test data small and focused
Before submitting, run the validation tools:
# Validate metadata quality
Rscript mockdata-tools/validate-metadata.R
# Test coverage across cycles
Rscript mockdata-tools/test-all-cycles.R- 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
- More survey examples: Add metadata from other recodeflow projects
- Validation improvements: Enhance metadata quality checks
- Documentation: Expand README, add pkgdown site
- Distribution options: Add more probability distributions for continuous variables
- Correlation structure: Generate correlated variables
- Time series: Support for longitudinal data
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
- 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)
- Be respectful and inclusive
- Focus on constructive feedback
- Prioritize technical accuracy over personal preferences
- Give credit where credit is due
- Harassment or discriminatory language
- Personal attacks or trolling
- Sharing private information without permission
By contributing to MockData, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to MockData and the recodeflow ecosystem!