Development Workflow Guide¶
This guide covers everything you need to know about building, testing, and viewing the Polaris FHIR Implementation Guide.
Quick Commands¶
# First time setup
npm run setup
# Build everything
npm run build
# View the docs locally
npm run server
# Then open http://localhost:8080
# Clean up build artifacts
npm run clean
# Check if your environment is ready
npm run check-env
Using the DevContainer (Recommended)¶
The easiest way to get a consistent development environment is using the DevContainer. It has everything pre-installed.
Setup DevContainer¶
- Install Prerequisites:
- Docker Desktop
- VS Code
-
Open in DevContainer:
- Open the project in VS Code
- You'll see a popup: "Folder contains a Dev Container configuration"
- Click "Reopen in Container"
-
Wait for it to build (first time takes ~5 minutes)
-
That's it! Everything is pre-installed and ready to go.
What's in the DevContainer?¶
- Node.js 18
- Java 11 (for FHIR IG Publisher)
- Python 3.10 (for MkDocs)
- Ruby 3.0
- All npm dependencies pre-installed
- Git configured
- Helpful VS Code extensions
Building the Implementation Guide¶
The Full Build Process¶
When you run npm run build, here's what happens:
- Preprocessing - Generates a combined spec document
- SUSHI - Converts your FSH files to FHIR JSON
- IG Publisher - Creates the full implementation guide
- File Operations - Organizes outputs for documentation
- MkDocs - Builds the documentation website
- Packaging - Creates downloadable artifacts
Build Outputs¶
After building, you'll find:
output/- The FHIR IG Publisher output (the actual IG)docs/fhir/- Copy of the IG for the docs sitesite/- The MkDocs documentation sitefsh-generated/- Raw SUSHI outputpolaris-fhir-spec.zip- Everything bundled up
Common Build Issues¶
"Java not found"¶
# Check Java version
java -version
# Should be 11 or higher
# On Mac:
brew install openjdk@11
# On Ubuntu/Debian:
sudo apt-get install openjdk-11-jdk
# On Windows:
# Download from https://adoptium.net/
"SUSHI errors"¶
- Check your FSH syntax
- Look for typos in profile names
- Ensure all aliases are defined
- Run
npm run sushialone to see detailed errors
"IG Publisher failed"¶
- Usually means validation errors
- Check
output/qa.htmlfor details - Look for missing references or invalid examples
Updating Documentation¶
Where Things Live¶
docs/ # MkDocs documentation
├── features/ # Feature-specific docs
│ └── [feature]/
│ ├── index.md
│ └── .nav.yml # Navigation config
├── guides/ # How-to guides
├── contributing/ # This guide!
└── fhir/ # Generated IG (don't edit)
input/pagecontent/ # FHIR IG pages
├── index.md # IG home page
├── profiles.md # Profile documentation
└── downloads.md # Download links
Adding a New Documentation Page¶
-
For general docs (MkDocs):
# Create your page echo "# My New Feature" > docs/features/my-feature/index.md # Add navigation echo "- My Feature: my-feature/" >> docs/features/.nav.yml -
For FHIR IG content:
# Create page content echo "### My Profile Details" > input/pagecontent/StructureDefinition-polaris-myprofile-intro.md
Documentation Tips¶
- Use Markdown headers (##, ###) for structure
- Include code examples
- Add links to related pages
- Keep it concise but complete
Viewing Your Work¶
Local Development Server¶
# Start the server
npm run server
# Or use the convenience scripts:
./__server # Mac/Linux
./__server.cmd # Windows
Then open: http://localhost:8080
The server auto-reloads when you change files in docs/.
What You'll See¶
- MkDocs Site: The main documentation at http://localhost:8080
- FHIR IG: Available at http://localhost:8080/fhir/
- Live Reload: Changes appear instantly (for MkDocs content)
Navigating the Built IG¶
Key pages in the FHIR IG:
/fhir/index.html- IG home page/fhir/artifacts.html- All profiles, extensions, examples/fhir/qa.html- Build errors and warnings/fhir/StructureDefinition-polaris-[type].html- Individual profiles
Testing Your Changes¶
Quick Validation¶
# Just run SUSHI (fast)
npx sushi .
# Full build (slower but complete)
npm run build
What to Check¶
- Build Success: No errors in console
- QA Report: Check
output/qa.html - Examples Validate: All green in QA report
- Links Work: Click around the generated site
- Narratives Render: Check the human-readable text
Pre-PR Checklist¶
- [ ]
npm run buildcompletes without errors - [ ] No new errors in
output/qa.html - [ ] Examples validate against profiles
- [ ] Documentation renders correctly
- [ ] Links aren't broken
Convenience Scripts¶
We have helper scripts for cross-platform compatibility:
# Mac/Linux versions
./__build # Full build
./__clean # Clean artifacts
./__server # Start dev server
# Windows versions
./__build.cmd
./__clean.cmd
./__server.cmd
These handle platform differences automatically.
Advanced Workflows¶
Building Just SUSHI¶
npx sushi .
Fast way to check FSH syntax without full IG build.
Building Just the IG¶
cd output
./_genonce.sh # Mac/Linux
./_genonce.bat # Windows
Skips SUSHI if you just changed narratives or pages.
Custom IG Publisher Settings¶
Edit ig.ini for publisher settings:
- ig - IG resource file name
- template - Template to use
- usage-stats-opt-out - Privacy setting
Debugging Build Issues¶
-
Enable verbose output:
npm run build -- --verbose -
Check intermediate files:
fsh-generated/- SUSHI output-
output/temp/- IG Publisher work files -
Run steps individually:
npx sushi . cd output && ./_genonce.sh cd .. && npm run mkdocs:build
Environment Variables¶
Proxy Settings¶
If behind a corporate proxy:
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080
export NO_PROXY=localhost,127.0.0.1
Java Memory¶
For large IGs:
export JAVA_OPTS="-Xmx4g"
Publisher Settings¶
export FHIR_PUBLISHER_OPTS="-debug"
Tips and Tricks¶
Speed Up Builds¶
- Use DevContainer - No setup time
- Incremental builds - Only build what changed
- Skip packaging - Comment out zip creation during development
- Local IG Publisher - Download once, reuse
Watch for Changes¶
While we don't have automatic FSH watching, you can:
- Use VS Code's "Run on Save" extension
- Create a simple watch script
- Use the dev server for docs (auto-reloads)
Profile Development Flow¶
- Write FSH profile
- Run
npx sushi .(quick syntax check) - Create JSON example
- Run full build
- Check QA report
- View in browser
- Iterate
Common Keyboard Shortcuts¶
In VS Code with DevContainer:
Ctrl+Shift+B- Run build taskCtrl+``- Open terminalCtrl+Shift+P- Command palette
Getting Help¶
Build Not Working?¶
- Run
npm run check-env - Check error messages carefully
- Look at
output/qa.html - Ask Shawn (shawn.vincent@well.company)
Can't Get DevContainer Working?¶
- Make sure Docker is running
- Check VS Code extensions
- Try "Rebuild Container"
- Fall back to local setup if needed
Something Else?¶
Create an issue or reach out directly. We're here to help!
Pro tip: The DevContainer is really the way to go. It just works™️