@gefyra/diffyr6-cli 1.0.1 → 1.0.3
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/README.md +18 -2
- package/package.json +1 -1
- package/src/cli.js +4 -2
- package/src/compare-terminology.js +1004 -0
- package/src/config.js +9 -3
- package/src/index.js +131 -8
- package/src/utils/zip.js +112 -0
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ An automated toolkit for comparing FHIR profiles across different versions, anal
|
|
|
8
8
|
- 🔄 **FSH Generation** - Converts FHIR resources to FSH using GoFSH
|
|
9
9
|
- ⬆️ **Profile Upgrade Pipeline** - Automatically upgrades profiles between FHIR versions using SUSHI
|
|
10
10
|
- 📊 **Profile Comparison** - Compares profile versions using the HL7 FHIR Validator
|
|
11
|
+
- 🎯 **Terminology Binding Analysis** - Compares terminology bindings between versions and checks ValueSet content from local package cache
|
|
11
12
|
- 📝 **Rule-Based Difference Analysis** - Applies customizable rules to classify and score structural changes
|
|
12
13
|
- 🎯 **Impact Scoring** - Calculates complexity scores based on breaking changes and migration risks
|
|
13
14
|
- 🚨 **Removed Resource Detection** - Identifies profiles based on resource types removed in newer FHIR versions
|
|
@@ -68,7 +69,8 @@ This creates a `migration-config.json` file with default settings.
|
|
|
68
69
|
"rulesConfigPath": null,
|
|
69
70
|
"validatorJarPath": null,
|
|
70
71
|
"workdir": null,
|
|
71
|
-
"compareMode": "incremental"
|
|
72
|
+
"compareMode": "incremental",
|
|
73
|
+
"exportZip": true
|
|
72
74
|
}
|
|
73
75
|
```
|
|
74
76
|
|
|
@@ -159,12 +161,13 @@ console.log('Findings:', result.findingsCount);
|
|
|
159
161
|
| `validatorJarPath` | string | `null` | Path to validator_cli.jar (auto-downloads latest from GitHub if null) |
|
|
160
162
|
| `workdir` | string | `null` | Working directory (uses current dir if null) |
|
|
161
163
|
| `compareMode` | string | `"incremental"` | Comparison mode: `"incremental"` or `"full"` |
|
|
164
|
+
| `exportZip` | boolean | `true` | Create a ZIP export containing compare HTML, markdown report, and run config |
|
|
162
165
|
|
|
163
166
|
**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
167
|
|
|
165
168
|
## Pipeline Steps
|
|
166
169
|
|
|
167
|
-
The comparison pipeline consists of
|
|
170
|
+
The comparison pipeline consists of 5 steps:
|
|
168
171
|
|
|
169
172
|
### 1. GoFSH (Optional)
|
|
170
173
|
|
|
@@ -193,6 +196,19 @@ Applies rules to the comparison HTML files and generates a markdown report with:
|
|
|
193
196
|
- Impact score based on breaking changes
|
|
194
197
|
- Timestamped filename (e.g., `comparison-report-20260123-143052.md`)
|
|
195
198
|
|
|
199
|
+
### 5. Terminology Binding Analysis
|
|
200
|
+
|
|
201
|
+
Compares terminology bindings between R4 and R6 profiles:
|
|
202
|
+
1. Runs `sushi -s` in both Resources and ResourcesR6 directories to generate snapshots
|
|
203
|
+
2. Compares `element[].binding.strength` and `valueSet` between R4 and R6 profiles
|
|
204
|
+
3. For ValueSets with version notation (pipe `|`), loads and compares content from local FHIR package cache:
|
|
205
|
+
- R4: `%USERPROFILE%\.fhir\packages\hl7.fhir.r4.core#4.0.1\package`
|
|
206
|
+
- R6: `%USERPROFILE%\.fhir\packages\hl7.fhir.r6.core#6.0.0-ballot3\package`
|
|
207
|
+
4. Generates a `terminology-report-<timestamp>.md` with all binding differences
|
|
208
|
+
5. Includes the report in the ZIP export
|
|
209
|
+
|
|
210
|
+
**Note:** This step continues even if it fails, to ensure the main migration completes.
|
|
211
|
+
|
|
196
212
|
## Compare Modes
|
|
197
213
|
|
|
198
214
|
### Incremental Mode (Default)
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -4,9 +4,11 @@ import { runMigration } from './index.js';
|
|
|
4
4
|
import { loadConfig, createExampleConfig } from './config.js';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
+
import { createRequire } from 'module';
|
|
7
8
|
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = path.dirname(__filename);
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
10
12
|
|
|
11
13
|
async function main() {
|
|
12
14
|
const args = process.argv.slice(2);
|
|
@@ -19,8 +21,8 @@ async function main() {
|
|
|
19
21
|
|
|
20
22
|
// Handle --version
|
|
21
23
|
if (args.includes('--version') || args.includes('-v')) {
|
|
22
|
-
const pkg =
|
|
23
|
-
console.log(pkg.
|
|
24
|
+
const pkg = require('../package.json');
|
|
25
|
+
console.log(pkg.version);
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
28
|
|