@gefyra/diffyr6-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +447 -0
- package/config/README.md +27 -0
- package/config/default-rules.json +135 -0
- package/config/resources-r4-not-in-r6.json +42 -0
- package/package.json +54 -0
- package/src/cli.js +93 -0
- package/src/compare-profiles.js +386 -0
- package/src/config.js +147 -0
- package/src/generate-fsh.js +457 -0
- package/src/index.js +394 -0
- package/src/rules-engine.js +642 -0
- package/src/upgrade-sushi.js +553 -0
- package/src/utils/fs.js +38 -0
- package/src/utils/html.js +28 -0
- package/src/utils/process.js +101 -0
- package/src/utils/removed-resources.js +135 -0
- package/src/utils/sushi-log.js +46 -0
- package/src/utils/validator.js +103 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jonas SchΓΆn (Gefyra GmbH)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
# DiffyR6 - FHIR Profile Comparison & Analysis CLI
|
|
2
|
+
|
|
3
|
+
An automated toolkit for comparing FHIR profiles across different versions, analyzing structural differences, and generating comprehensive impact reports with rule-based evaluation.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- π¦ **Automated Package Download** - Downloads FHIR packages from the official registry
|
|
8
|
+
- π **FSH Generation** - Converts FHIR resources to FSH using GoFSH
|
|
9
|
+
- β¬οΈ **Profile Upgrade Pipeline** - Automatically upgrades profiles between FHIR versions using SUSHI
|
|
10
|
+
- π **Profile Comparison** - Compares profile versions using the HL7 FHIR Validator
|
|
11
|
+
- π **Rule-Based Difference Analysis** - Applies customizable rules to classify and score structural changes
|
|
12
|
+
- π― **Impact Scoring** - Calculates complexity scores based on breaking changes and migration risks
|
|
13
|
+
- π¨ **Removed Resource Detection** - Identifies profiles based on resource types removed in newer FHIR versions
|
|
14
|
+
- π **Markdown Reports** - Generates detailed comparison reports with timestamps and findings categorization
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### From GitHub Registry
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @gefyra/diffyr6-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### From Source
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git clone https://github.com/Gefyra/DiffyR6-Cli.git
|
|
28
|
+
cd DiffyR6-Cli
|
|
29
|
+
npm install
|
|
30
|
+
npm link
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
- **Node.js** 18.0.0 or higher
|
|
36
|
+
- **npm** for package management
|
|
37
|
+
- **Java** (for HL7 FHIR Validator)
|
|
38
|
+
- **tar** available on PATH (for extracting FHIR packages)
|
|
39
|
+
|
|
40
|
+
### Required Peer Dependencies
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install gofsh fsh-sushi
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
### 1. Create a Configuration File
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
fhir-r6-migrate --init
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This creates a `migration-config.json` file with default settings.
|
|
55
|
+
|
|
56
|
+
### 2. Edit the Configuration
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"configVersion": "1.0.0",
|
|
61
|
+
"packageId": "de.basisprofil.r4",
|
|
62
|
+
"packageVersion": "1.5.0",
|
|
63
|
+
"enableGoFSH": true,
|
|
64
|
+
"resourcesDir": "Resources",
|
|
65
|
+
"resourcesR6Dir": "ResourcesR6",
|
|
66
|
+
"compareDir": "compare",
|
|
67
|
+
"outputDir": "output",
|
|
68
|
+
"rulesConfigPath": null,
|
|
69
|
+
"validatorJarPath": null,
|
|
70
|
+
"workdir": null,
|
|
71
|
+
"compareMode": "incremental"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 3. Run the Migration
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
fhir-r6-migrate
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or with a custom config:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
fhir-r6-migrate --config my-config.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
### CLI Usage
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Run with default config
|
|
93
|
+
fhir-r6-migrate
|
|
94
|
+
|
|
95
|
+
# Run with custom config
|
|
96
|
+
fhir-r6-migrate --config path/to/config.json
|
|
97
|
+
|
|
98
|
+
# Create example config
|
|
99
|
+
fhir-r6-migrate --init
|
|
100
|
+
|
|
101
|
+
# Show version
|
|
102
|
+
fhir-r6-migrate --version
|
|
103
|
+
|
|
104
|
+
# Show help
|
|
105
|
+
fhir-r6-migrate --help
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Programmatic Usage
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
import { runMigration } from '@gefyra/fhir-r6-migration-runner';
|
|
112
|
+
import { loadConfig } from '@gefyra/fhir-r6-migration-runner/config';
|
|
113
|
+
|
|
114
|
+
// Load config from file
|
|
115
|
+
const config = await loadConfig('./migration-config.json');
|
|
116
|
+
|
|
117
|
+
// Or create config programmatically
|
|
118
|
+
const config = {
|
|
119
|
+
configVersion: '1.0.0',
|
|
120
|
+
packageId: 'de.basisprofil.r4',
|
|
121
|
+
packageVersion: '1.5.0',
|
|
122
|
+
enableGoFSH: true,
|
|
123
|
+
resourcesDir: 'Resources',
|
|
124
|
+
resourcesR6Dir: 'ResourcesR6',
|
|
125
|
+
compareDir: 'compare',
|
|
126
|
+
outputDir: 'output',
|
|
127
|
+
compareMode: 'incremental',
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Run migration
|
|
131
|
+
const result = await runMigration(config);
|
|
132
|
+
|
|
133
|
+
console.log('Migration complete!');
|
|
134
|
+
console.log('Report:', result.report);
|
|
135
|
+
console.log('Score:', result.score);
|
|
136
|
+
console.log('Findings:', result.findingsCount);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Configuration Reference
|
|
140
|
+
|
|
141
|
+
### Required Fields
|
|
142
|
+
|
|
143
|
+
| Field | Type | Description |
|
|
144
|
+
|-------|------|-------------|
|
|
145
|
+
| `configVersion` | string | Config schema version (must be "1.0.0") |
|
|
146
|
+
| `packageId` | string | FHIR package ID (required if `enableGoFSH` is true) |
|
|
147
|
+
| `resourcesDir` | string | Directory for baseline/source version resources |
|
|
148
|
+
| `resourcesR6Dir` | string | Directory for target/comparison version resources |
|
|
149
|
+
| `compareDir` | string | Directory for comparison HTML files |
|
|
150
|
+
| `outputDir` | string | Directory for generated reports |
|
|
151
|
+
|
|
152
|
+
### Optional Fields
|
|
153
|
+
|
|
154
|
+
| Field | Type | Default | Description |
|
|
155
|
+
|-------|------|---------|-------------|
|
|
156
|
+
| `packageVersion` | string | `"current"` | FHIR package version |
|
|
157
|
+
| `enableGoFSH` | boolean | `true` | Enable GoFSH package download & FSH generation |
|
|
158
|
+
| `rulesConfigPath` | string | `null` | Path to custom rules config (uses default if null) |
|
|
159
|
+
| `validatorJarPath` | string | `null` | Path to validator_cli.jar (auto-downloads latest from GitHub if null) |
|
|
160
|
+
| `workdir` | string | `null` | Working directory (uses current dir if null) |
|
|
161
|
+
| `compareMode` | string | `"incremental"` | Comparison mode: `"incremental"` or `"full"` |
|
|
162
|
+
|
|
163
|
+
**Auto-download feature:** When `validatorJarPath` is `null`, the HL7 FHIR Validator will be automatically downloaded from a [stable GitHub release](https://github.com/hapifhir/org.hl7.fhir.core/releases/download/6.7.10/validator_cli.jar) to `<workdir>/validator_cli.jar`. This download only happens once - subsequent runs will reuse the existing JAR file.
|
|
164
|
+
|
|
165
|
+
## Pipeline Steps
|
|
166
|
+
|
|
167
|
+
The comparison pipeline consists of 4 steps:
|
|
168
|
+
|
|
169
|
+
### 1. GoFSH (Optional)
|
|
170
|
+
|
|
171
|
+
Downloads the specified FHIR package and converts it to FSH using GoFSH for the baseline version.
|
|
172
|
+
|
|
173
|
+
**Skipped if:** `resourcesDir/sushi-config.yaml` already exists
|
|
174
|
+
|
|
175
|
+
### 2. Profile Upgrade
|
|
176
|
+
|
|
177
|
+
Runs SUSHI to upgrade profiles to the target FHIR version, applying automatic fixes for common issues.
|
|
178
|
+
|
|
179
|
+
**Skipped if:** `resourcesR6Dir/sushi-config.yaml` already exists
|
|
180
|
+
|
|
181
|
+
### 3. Profile Comparison
|
|
182
|
+
|
|
183
|
+
Uses the HL7 FHIR Validator to compare baseline and target profile versions, generating HTML comparison files showing structural differences.
|
|
184
|
+
|
|
185
|
+
**Incremental mode:** Only compares profiles with missing HTML files
|
|
186
|
+
**Full mode:** Compares all profiles, overwriting existing files
|
|
187
|
+
|
|
188
|
+
### 4. Report Generation
|
|
189
|
+
|
|
190
|
+
Applies rules to the comparison HTML files and generates a markdown report with:
|
|
191
|
+
- Removed resource detection (profiles based on deprecated resource types)
|
|
192
|
+
- Detailed findings grouped by profile and category
|
|
193
|
+
- Impact score based on breaking changes
|
|
194
|
+
- Timestamped filename (e.g., `comparison-report-20260123-143052.md`)
|
|
195
|
+
|
|
196
|
+
## Compare Modes
|
|
197
|
+
|
|
198
|
+
### Incremental Mode (Default)
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"compareMode": "incremental"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- Only compares profiles that don't have existing HTML files
|
|
207
|
+
- Faster for incremental updates
|
|
208
|
+
- Preserves existing comparisons
|
|
209
|
+
|
|
210
|
+
### Full Mode
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"compareMode": "full"
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- Compares all profiles, overwriting existing files
|
|
219
|
+
- Useful for clean rebuilds
|
|
220
|
+
- Ensures all comparisons are up-to-date
|
|
221
|
+
|
|
222
|
+
## Custom Rules
|
|
223
|
+
|
|
224
|
+
The package includes a default set of rules for common migration issues. You can customize or extend these rules:
|
|
225
|
+
|
|
226
|
+
### Using Custom Rules
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"rulesConfigPath": "./my-rules.json"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Rules Configuration Format
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"title": "Custom Analysis Rules",
|
|
239
|
+
"tables": [
|
|
240
|
+
{
|
|
241
|
+
"sectionHeading": "Structure",
|
|
242
|
+
"rules": [
|
|
243
|
+
{
|
|
244
|
+
"name": "Element removed in target version",
|
|
245
|
+
"description": "An element from the baseline version no longer exists in the target",
|
|
246
|
+
"rank": 50,
|
|
247
|
+
"value": 2,
|
|
248
|
+
"conditions": [
|
|
249
|
+
{
|
|
250
|
+
"column": "Comments",
|
|
251
|
+
"operator": "equals",
|
|
252
|
+
"value": "Removed this element"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"template": "The element {{Name}} exists in baseline but was removed in target."
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Rule Properties
|
|
264
|
+
|
|
265
|
+
- **name**: Rule category name (groups findings in the report)
|
|
266
|
+
- **description**: Detailed explanation of the difference
|
|
267
|
+
- **rank**: Sorting order in the report (lower = higher priority)
|
|
268
|
+
- **value**: Score contribution (higher = more significant change)
|
|
269
|
+
- **conditions**: Array of conditions that must ALL match
|
|
270
|
+
- **template**: Output text with variable substitution (`{{variableName}}`)
|
|
271
|
+
|
|
272
|
+
### Condition Operators
|
|
273
|
+
|
|
274
|
+
- `equals`: Exact match (case-insensitive by default)
|
|
275
|
+
- `contains`: Substring match (case-insensitive by default)
|
|
276
|
+
- `!equals` / `notequals`: Not equal
|
|
277
|
+
|
|
278
|
+
### Available Variables
|
|
279
|
+
|
|
280
|
+
- Column aliases (e.g., `{{Name}}`, `{{Comments}}`)
|
|
281
|
+
- Index-based columns (e.g., `{{col1}}`, `{{col2}}`)
|
|
282
|
+
- Context variables: `{{file}}`, `{{section}}`, `{{profile}}`
|
|
283
|
+
|
|
284
|
+
## Impact Score
|
|
285
|
+
|
|
286
|
+
The impact score is calculated by summing the `value` field from all rule matches across all differences found.
|
|
287
|
+
|
|
288
|
+
**Interpretation:**
|
|
289
|
+
- **0-50**: Low impact - minor differences, straightforward adaptation
|
|
290
|
+
- **51-150**: Medium impact - moderate structural changes requiring attention
|
|
291
|
+
- **151+**: High impact - significant breaking changes and redesign needed
|
|
292
|
+
|
|
293
|
+
## Output
|
|
294
|
+
|
|
295
|
+
### Report Format
|
|
296
|
+
|
|
297
|
+
```markdown
|
|
298
|
+
# FHIR Profile Comparison Report
|
|
299
|
+
|
|
300
|
+
**Generated:** 2026-01-23T14:30:52.000Z
|
|
301
|
+
**Total Findings:** 42
|
|
302
|
+
**Impact Score:** 135
|
|
303
|
+
**Resources Removed:** 0
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## β οΈ Resources Removed in Target Version
|
|
308
|
+
|
|
309
|
+
β
**No profiles found that are based on resource types removed in target version.**
|
|
310
|
+
|
|
311
|
+
Your baseline profiles do not use any deprecated resource types.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## PatientProfile
|
|
316
|
+
|
|
317
|
+
**Score:** 25 | **Findings:** 8
|
|
318
|
+
|
|
319
|
+
### Element removed in target version
|
|
320
|
+
|
|
321
|
+
*An element from baseline version no longer exists in target...*
|
|
322
|
+
|
|
323
|
+
- Element identifier exists in baseline but removed in target. *(Score: 15)*
|
|
324
|
+
- Element photo exists in baseline but removed in target. *(Score: 15)*
|
|
325
|
+
|
|
326
|
+
### Change in cardinality
|
|
327
|
+
|
|
328
|
+
*The cardinality of an element has changed...*
|
|
329
|
+
|
|
330
|
+
- For element name, the cardinality changed: cardinalities differ (0..* vs 1..*) *(Score: 5)*
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
**Final Impact Score:** 135
|
|
335
|
+
|
|
336
|
+
*Lower scores indicate fewer structural changes.*
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Configuration Versioning
|
|
340
|
+
|
|
341
|
+
The package uses semantic versioning for configuration schemas.
|
|
342
|
+
|
|
343
|
+
**Current version:** `1.0.0`
|
|
344
|
+
|
|
345
|
+
### Version Compatibility
|
|
346
|
+
|
|
347
|
+
- **Major version** must match exactly
|
|
348
|
+
- **Minor/patch versions** are backwards compatible
|
|
349
|
+
|
|
350
|
+
If you receive a config version error:
|
|
351
|
+
1. Update the package: `npm update @gefyra/fhir-r6-migration-runner`
|
|
352
|
+
2. Or update your config's `configVersion` field
|
|
353
|
+
|
|
354
|
+
## Troubleshooting
|
|
355
|
+
|
|
356
|
+
### Error: "Missing configVersion field"
|
|
357
|
+
|
|
358
|
+
Add `"configVersion": "1.0.0"` to your config file.
|
|
359
|
+
|
|
360
|
+
### Error: "Incompatible config version"
|
|
361
|
+
|
|
362
|
+
Update the package or adjust your config to match the expected major version.
|
|
363
|
+
|
|
364
|
+
### GoFSH not found
|
|
365
|
+
|
|
366
|
+
Ensure `gofsh` is installed:
|
|
367
|
+
```bash
|
|
368
|
+
npm install gofsh
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Or specify a custom path in your environment:
|
|
372
|
+
```bash
|
|
373
|
+
export GOFSH_BIN=/path/to/gofsh
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Validator JAR download fails
|
|
377
|
+
|
|
378
|
+
Download manually and specify the path:
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"validatorJarPath": "/path/to/validator_cli.jar"
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Development
|
|
386
|
+
|
|
387
|
+
### Project Structure
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
DiffyR6-Cli/
|
|
391
|
+
βββ src/
|
|
392
|
+
β βββ index.js # Main pipeline logic
|
|
393
|
+
β βββ cli.js # CLI entry point
|
|
394
|
+
β βββ config.js # Configuration loading & validation
|
|
395
|
+
β βββ rules-engine.js # Rule evaluation engine
|
|
396
|
+
β βββ generate-fsh.js # GoFSH package download & FSH generation
|
|
397
|
+
β βββ upgrade-sushi.js # SUSHI profile upgrade with auto-fixes
|
|
398
|
+
β βββ compare-profiles.js # HL7 Validator profile comparison
|
|
399
|
+
β βββ utils/
|
|
400
|
+
β βββ fs.js # Filesystem utilities
|
|
401
|
+
β βββ process.js # Process spawning utilities
|
|
402
|
+
β βββ sushi-log.js # SUSHI log parsing
|
|
403
|
+
β βββ html.js # HTML parsing utilities
|
|
404
|
+
β βββ validator.js # Validator JAR auto-download
|
|
405
|
+
β βββ removed-resources.js # Removed resource detection
|
|
406
|
+
βββ config/
|
|
407
|
+
β βββ default-rules.json # Default analysis rules
|
|
408
|
+
β βββ resources-r4-not-in-r6.json # List of removed resource types
|
|
409
|
+
βββ package.json
|
|
410
|
+
βββ README.md
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Building
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
npm run build
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Testing
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
npm test
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
*Note: Tests are not yet implemented*
|
|
426
|
+
|
|
427
|
+
## Contributing
|
|
428
|
+
|
|
429
|
+
Contributions are welcome! Please open an issue or pull request on GitHub.
|
|
430
|
+
|
|
431
|
+
## License
|
|
432
|
+
|
|
433
|
+
MIT
|
|
434
|
+
|
|
435
|
+
## Author
|
|
436
|
+
|
|
437
|
+
Jonas SchΓΆn (Gefyra GmbH)
|
|
438
|
+
- Email: js@gefyra.de
|
|
439
|
+
- GitHub: [@Gefyra](https://github.com/Gefyra)
|
|
440
|
+
|
|
441
|
+
## Links
|
|
442
|
+
|
|
443
|
+
- [GitHub Repository](https://github.com/Gefyra/fhir-r6-migration-runner)
|
|
444
|
+
- [npm Package](https://www.npmjs.com/package/@gefyra/fhir-r6-migration-runner)
|
|
445
|
+
- [FHIR R6 Specification](https://hl7.org/fhir/R6/)
|
|
446
|
+
- [GoFSH](https://github.com/FHIR/GoFSH)
|
|
447
|
+
- [SUSHI](https://github.com/FHIR/sushi)
|
package/config/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Example Configuration
|
|
2
|
+
|
|
3
|
+
This directory contains example configuration files for the FHIR R4 to R6 Migration Runner.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `default-rules.json` - Default rule set for migration analysis (used automatically if no custom rules specified)
|
|
8
|
+
|
|
9
|
+
## Creating Custom Rules
|
|
10
|
+
|
|
11
|
+
Copy `default-rules.json` and modify it for your needs:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp config/default-rules.json my-custom-rules.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then reference it in your migration config:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"rulesConfigPath": "./my-custom-rules.json"
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Rule Configuration Structure
|
|
26
|
+
|
|
27
|
+
See README.md for detailed information about rule configuration format and available options.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Structure Differences",
|
|
3
|
+
"output": "migration-report.md",
|
|
4
|
+
"tables": [
|
|
5
|
+
{
|
|
6
|
+
"directory": "compare",
|
|
7
|
+
"sectionHeading": "Structure",
|
|
8
|
+
"rules": [
|
|
9
|
+
{
|
|
10
|
+
"name": "Element with Must-Support removed in R6",
|
|
11
|
+
"description": "An element marked as Must-Support in R4 has been removed in R6. This requires special attention during migration, as systems supporting this element need to be adapted.",
|
|
12
|
+
"rank": 1,
|
|
13
|
+
"value": 15,
|
|
14
|
+
"conditions": [
|
|
15
|
+
{
|
|
16
|
+
"column": "Comments",
|
|
17
|
+
"operator": "equals",
|
|
18
|
+
"value": "Removed this element"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"column": "L Flags",
|
|
22
|
+
"operator": "contains",
|
|
23
|
+
"value": "This element must be supported"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"template": "Element {{Name}} exists in R4 MS, but removed in R6."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Change in cardinality for Must-Support element",
|
|
30
|
+
"description": "The cardinality of a Must-Support element has changed. This may mean that required fields become optional or vice versa.",
|
|
31
|
+
"rank": 30,
|
|
32
|
+
"value": 5,
|
|
33
|
+
"conditions": [
|
|
34
|
+
{
|
|
35
|
+
"column": "Comments",
|
|
36
|
+
"operator": "contains",
|
|
37
|
+
"value": "cardinalities differ"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"column": "L Flags",
|
|
41
|
+
"operator": "contains",
|
|
42
|
+
"value": "This element must be supported"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"template": "For element {{Name}}, the cardinality changed in R6 and it had an MS in R4: {{Comments}}"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "Element removed in R6",
|
|
49
|
+
"description": "An element from R4 no longer exists in R6. Data in this element may need to be migrated to another element or discarded.",
|
|
50
|
+
"rank": 50,
|
|
51
|
+
"value": 2,
|
|
52
|
+
"conditions": [
|
|
53
|
+
{
|
|
54
|
+
"column": "Comments",
|
|
55
|
+
"operator": "equals",
|
|
56
|
+
"value": "Removed this element"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"template": "The element {{Name}} exists in R4 but was removed in R6."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "Element added as required in R6",
|
|
63
|
+
"description": "A new required field has been added in R6. Values for this element must be provided during migration.",
|
|
64
|
+
"rank": 20,
|
|
65
|
+
"value": 15,
|
|
66
|
+
"conditions": [
|
|
67
|
+
{
|
|
68
|
+
"column": "Comments",
|
|
69
|
+
"operator": "equals",
|
|
70
|
+
"value": "Added this element"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"column": "L Card",
|
|
74
|
+
"operator": "contains",
|
|
75
|
+
"value": "1.."
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"template": "The element {{Name}} was added as required in R6."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "Element added in R6",
|
|
82
|
+
"description": "A new optional element has been added in R6. This is usually unproblematic and offers new possibilities for data modeling.",
|
|
83
|
+
"rank": 60,
|
|
84
|
+
"value": 2,
|
|
85
|
+
"conditions": [
|
|
86
|
+
{
|
|
87
|
+
"column": "Comments",
|
|
88
|
+
"operator": "equals",
|
|
89
|
+
"value": "Added this element"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"template": "The element {{Name}} was added in R6."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "Change in cardinality",
|
|
96
|
+
"description": "The cardinality of an element has changed. Check whether this affects your implementation.",
|
|
97
|
+
"rank": 40,
|
|
98
|
+
"value": 5,
|
|
99
|
+
"conditions": [
|
|
100
|
+
{
|
|
101
|
+
"column": "Comments",
|
|
102
|
+
"operator": "contains",
|
|
103
|
+
"value": "cardinalities differ"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"template": "For element {{Name}}, the cardinality changed in R6: {{Comments}}"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "R5 Preadoption Extensions",
|
|
110
|
+
"description": "This profile uses R5 Preadoption Extensions that are not fully supported in R4-only contexts. Additional configuration may be needed for compatibility.",
|
|
111
|
+
"rank": 25,
|
|
112
|
+
"value": 10,
|
|
113
|
+
"conditions": [],
|
|
114
|
+
"template": "This profile uses R5 Preadoption Extensions"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "Resource Removed in R6",
|
|
118
|
+
"description": "A resource type that exists in R4 has been completely removed in R6. This requires alternative approaches in migration.",
|
|
119
|
+
"rank": 35,
|
|
120
|
+
"value": 12,
|
|
121
|
+
"conditions": [],
|
|
122
|
+
"template": "The resource was removed in R6."
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "R4 vs R6 - Comparison Error",
|
|
126
|
+
"description": "The Java Validator encountered an error when comparing this StructureDefinition. This is typically due new R6 types (like CodeableReference) not being supported during validation.",
|
|
127
|
+
"rank": 5,
|
|
128
|
+
"value": 15,
|
|
129
|
+
"conditions": [],
|
|
130
|
+
"template": "The StructureDefinition {{name}} had an error while comparing: {{message}}"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resources": [
|
|
3
|
+
"CatalogEntry",
|
|
4
|
+
"ChargeItem",
|
|
5
|
+
"ChargeItemDefinition",
|
|
6
|
+
"ClinicalImpression",
|
|
7
|
+
"DeviceUseStatement",
|
|
8
|
+
"DocumentManifest",
|
|
9
|
+
"EffectEvidenceSynthesis",
|
|
10
|
+
"GraphDefinition",
|
|
11
|
+
"ImmunizationEvaluation",
|
|
12
|
+
"ImmunizationRecommendation",
|
|
13
|
+
"Linkage",
|
|
14
|
+
"Media",
|
|
15
|
+
"MedicationKnowledge",
|
|
16
|
+
"MedicinalProduct",
|
|
17
|
+
"MedicinalProductAuthorization",
|
|
18
|
+
"MedicinalProductContraindication",
|
|
19
|
+
"MedicinalProductIndication",
|
|
20
|
+
"MedicinalProductIngredient",
|
|
21
|
+
"MedicinalProductInteraction",
|
|
22
|
+
"MedicinalProductManufactured",
|
|
23
|
+
"MedicinalProductPackaged",
|
|
24
|
+
"MedicinalProductPharmaceutical",
|
|
25
|
+
"MedicinalProductUndesirableEffect",
|
|
26
|
+
"MolecularSequence",
|
|
27
|
+
"RequestGroup",
|
|
28
|
+
"ResearchDefinition",
|
|
29
|
+
"ResearchElementDefinition",
|
|
30
|
+
"RiskEvidenceSynthesis",
|
|
31
|
+
"SubstancePolymer",
|
|
32
|
+
"SubstanceProtein",
|
|
33
|
+
"SubstanceReferenceInformation",
|
|
34
|
+
"SubstanceSourceMaterial",
|
|
35
|
+
"SubstanceSpecification",
|
|
36
|
+
"SupplyDelivery",
|
|
37
|
+
"SupplyRequest",
|
|
38
|
+
"TestReport",
|
|
39
|
+
"TestScript",
|
|
40
|
+
"VerificationResult"
|
|
41
|
+
]
|
|
42
|
+
}
|