FHIR / FHIR/GoFSH

Error: Could not process ValueSet at node_modules/kbv.basis/KBV_VS_Base_Diagnosis_SNOMED_CT.json: Maximum call stack size exceeded

Đang mở
#283 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
40
Fork
7
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I tried running

```
npm install gofsh
npm --registry https://packages.simplifier.net install kbv.basis@1.3.0
node node_modules/.bin/gofsh node_modules/kbv.basis/ --out gofish_output --dependency de.basisprofil.r4@1.3.2
```

This produces an error
```
...
info Processed 10 of 40 ValueSets...
error Could not process ValueSet at node_modules/kbv.basis/KBV_VS_Base_Diagnosis_SNOMED_CT.json: Maximum call stack size exceeded
info Processed 15 of 40 ValueSets...
...
```

Turns out the problem lies in this line

https://github.com/FHIR/GoFSH/blob/9895cdcba8f90ef2357d6cbfefb386bc4773d4ef/src/processor/ValueSetProcessor.ts#L44-L47

The size of an array that can be destructured into an argument list is limited by JavaScript. In my case the array has 466433 elements. Try it yourself in a node REPL.

```
[].push(...Array.from({ length: 400_000 }))
```

You will get a `RangeError: Maximum call stack size exceeded` because it cannot handle a function call with 400k arguments. Fortunately the fix for this is straight forward by not using Array.push:

```ts
const newRules: ExportableValueSet['rules'] = [
...CaretValueRuleExtractor.processResource(input, fisher, input.resourceType, config)
];
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.