dicom-curate 0.26.2 → 0.27.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/dist/esm/applyMappingsWorker.js +31 -29
- package/dist/esm/collectMappings.js +3 -3
- package/dist/esm/config/dicom/tagConversion.js +1 -1
- package/dist/esm/config/sampleCompositeSpecification.js +1 -1
- package/dist/esm/curateDict.js +3 -3
- package/dist/esm/curateOne.js +31 -29
- package/dist/esm/deidentifyPS315E.js +3 -3
- package/dist/esm/hash.js +1 -1
- package/dist/esm/index.js +68 -33
- package/dist/esm/mappingWorkerPool.js +30 -4
- package/dist/esm/s3Client.js +1 -1
- package/dist/esm/scanDirectoryWorker.js +37 -3
- package/dist/types/mappingWorkerPool.d.ts +11 -1
- package/dist/types/scanDirectoryWorker.d.ts +2 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/umd/dicom-curate.umd.js +195 -74
- package/dist/umd/dicom-curate.umd.js.map +1 -1
- package/dist/umd/dicom-curate.umd.min.js +7 -7
- package/dist/umd/dicom-curate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -77997,7 +77997,7 @@ function isPrivateTag(tagId) {
|
|
|
77997
77997
|
return false;
|
|
77998
77998
|
}
|
|
77999
77999
|
function convertKeywordToTagId(keyword) {
|
|
78000
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
78000
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
78001
78001
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
78002
78002
|
}
|
|
78003
78003
|
function convertKeywordPathToTagIdPath(keywordPath) {
|
|
@@ -78856,7 +78856,7 @@ function getCid7050Codes(options) {
|
|
|
78856
78856
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
78857
78857
|
var nameMap = dcmjs2.data.DicomMetaDictionary.nameMap;
|
|
78858
78858
|
function getVr(keyword) {
|
|
78859
|
-
const element = nameMap[keyword]
|
|
78859
|
+
const element = nameMap[keyword] ?? nameMap[`RETIRED_${keyword}`];
|
|
78860
78860
|
return element?.vr;
|
|
78861
78861
|
}
|
|
78862
78862
|
function temporalVr(vr) {
|
|
@@ -78928,7 +78928,7 @@ function deidentifyPS315E({
|
|
|
78928
78928
|
}
|
|
78929
78929
|
}
|
|
78930
78930
|
}
|
|
78931
|
-
return current2[tagName]
|
|
78931
|
+
return current2[tagName] ?? null;
|
|
78932
78932
|
}
|
|
78933
78933
|
const {
|
|
78934
78934
|
cleanDescriptorsOption,
|
|
@@ -79695,9 +79695,9 @@ async function hash(buffer, hashMethod) {
|
|
|
79695
79695
|
case "crc32":
|
|
79696
79696
|
return crc32Hex(buffer);
|
|
79697
79697
|
case "md5":
|
|
79698
|
+
default:
|
|
79698
79699
|
return md5Hex(buffer);
|
|
79699
79700
|
case "crc64":
|
|
79700
|
-
default:
|
|
79701
79701
|
return crc64Hex(buffer);
|
|
79702
79702
|
}
|
|
79703
79703
|
}
|
|
@@ -79772,7 +79772,7 @@ async function loadS3Client() {
|
|
|
79772
79772
|
const { createRequire } = await import("module");
|
|
79773
79773
|
const req = createRequire(import.meta.url);
|
|
79774
79774
|
const mod = req("@aws-sdk/client-s3");
|
|
79775
|
-
cachedS3Client = mod?.default
|
|
79775
|
+
cachedS3Client = mod?.default ?? mod;
|
|
79776
79776
|
} else {
|
|
79777
79777
|
cachedS3Client = await Promise.resolve().then(() => __toESM(require_dist_cjs71(), 1));
|
|
79778
79778
|
}
|
|
@@ -79811,7 +79811,7 @@ async function curateOne({
|
|
|
79811
79811
|
);
|
|
79812
79812
|
}
|
|
79813
79813
|
file = await resp.blob();
|
|
79814
|
-
const lastModifiedHeader = resp.headers.get("last-modified")
|
|
79814
|
+
const lastModifiedHeader = resp.headers.get("last-modified");
|
|
79815
79815
|
if (lastModifiedHeader) {
|
|
79816
79816
|
mtime = new Date(lastModifiedHeader).toISOString();
|
|
79817
79817
|
}
|
|
@@ -79877,14 +79877,14 @@ async function curateOne({
|
|
|
79877
79877
|
} catch (e4) {
|
|
79878
79878
|
}
|
|
79879
79879
|
}
|
|
79880
|
-
|
|
79880
|
+
let fileArrayBuffer = await file.arrayBuffer();
|
|
79881
79881
|
let preMappedHash;
|
|
79882
79882
|
let postMappedHash;
|
|
79883
79883
|
const postMappedHashHeader = "x-source-file-hash";
|
|
79884
79884
|
let canSkip = false;
|
|
79885
79885
|
if (previousSourceFileInfo?.preMappedHash !== void 0) {
|
|
79886
79886
|
try {
|
|
79887
|
-
preMappedHash = await hash(fileArrayBuffer, hashMethod
|
|
79887
|
+
preMappedHash = await hash(fileArrayBuffer, hashMethod ?? "md5");
|
|
79888
79888
|
} catch (e4) {
|
|
79889
79889
|
console.warn(`Failed to compute preMappedHash for ${fileInfo.name}`, e4);
|
|
79890
79890
|
}
|
|
@@ -79989,7 +79989,7 @@ async function curateOne({
|
|
|
79989
79989
|
}
|
|
79990
79990
|
if (!preMappedHash) {
|
|
79991
79991
|
try {
|
|
79992
|
-
preMappedHash = await hash(fileArrayBuffer, hashMethod
|
|
79992
|
+
preMappedHash = await hash(fileArrayBuffer, hashMethod ?? "md5");
|
|
79993
79993
|
} catch (e4) {
|
|
79994
79994
|
console.warn(`Failed to compute preMappedHash for ${fileInfo.name}`, e4);
|
|
79995
79995
|
}
|
|
@@ -80000,7 +80000,8 @@ async function curateOne({
|
|
|
80000
80000
|
const modifiedArrayBuffer = mappedDicomData.write({
|
|
80001
80001
|
allowInvalidVRLength: true
|
|
80002
80002
|
});
|
|
80003
|
-
postMappedHash = await hash(modifiedArrayBuffer, hashMethod
|
|
80003
|
+
postMappedHash = await hash(modifiedArrayBuffer, hashMethod ?? "md5");
|
|
80004
|
+
fileArrayBuffer = null;
|
|
80004
80005
|
const previousPostMappedHash = previousMappedFileInfo ? previousMappedFileInfo(clonedMapResults.outputFilePath)?.postMappedHash : void 0;
|
|
80005
80006
|
if (previousPostMappedHash !== void 0 && previousPostMappedHash === postMappedHash) {
|
|
80006
80007
|
return noMapResult(clonedMapResults.outputFilePath);
|
|
@@ -80032,26 +80033,23 @@ async function curateOne({
|
|
|
80032
80033
|
}
|
|
80033
80034
|
const fullFilePath = path.join(fullDirPath, fileName);
|
|
80034
80035
|
await fs.writeFile(fullFilePath, new DataView(modifiedArrayBuffer));
|
|
80035
|
-
} else {
|
|
80036
|
+
} else if (!outputTarget?.http && !outputTarget?.s3) {
|
|
80036
80037
|
clonedMapResults.mappedBlob = new Blob([modifiedArrayBuffer], {
|
|
80037
80038
|
type: "application/octet-stream"
|
|
80038
80039
|
});
|
|
80039
80040
|
}
|
|
80040
|
-
clonedMapResults.mappedBlob = new Blob([modifiedArrayBuffer], {
|
|
80041
|
-
type: "application/octet-stream"
|
|
80042
|
-
});
|
|
80043
80041
|
if (outputTarget?.http) {
|
|
80044
80042
|
try {
|
|
80045
80043
|
const key = clonedMapResults.outputFilePath.split("/").map(encodeURIComponent).join("/");
|
|
80046
80044
|
const uploadUrl = `${outputTarget.http.url}/${key}`;
|
|
80047
80045
|
const headers = {
|
|
80048
|
-
"Content-Type":
|
|
80046
|
+
"Content-Type": "application/octet-stream",
|
|
80049
80047
|
"X-File-Name": fileName,
|
|
80050
|
-
"X-File-Type":
|
|
80048
|
+
"X-File-Type": "application/octet-stream",
|
|
80051
80049
|
"X-File-Size": String(modifiedArrayBuffer.byteLength),
|
|
80052
|
-
"X-Source-File-Size": String(clonedMapResults.fileInfo?.size
|
|
80053
|
-
"X-Source-File-Modified-Time": mtime
|
|
80054
|
-
"X-Source-File-Hash": preMappedHash
|
|
80050
|
+
"X-Source-File-Size": String(clonedMapResults.fileInfo?.size ?? ""),
|
|
80051
|
+
"X-Source-File-Modified-Time": mtime ?? "",
|
|
80052
|
+
"X-Source-File-Hash": preMappedHash ?? ""
|
|
80055
80053
|
};
|
|
80056
80054
|
if (outputTarget.http.headers) {
|
|
80057
80055
|
Object.assign(headers, outputTarget.http.headers);
|
|
@@ -80061,25 +80059,27 @@ async function curateOne({
|
|
|
80061
80059
|
const resp = await fetchWithRetry(uploadUrl, {
|
|
80062
80060
|
method: "PUT",
|
|
80063
80061
|
headers,
|
|
80064
|
-
body:
|
|
80062
|
+
body: new Blob([modifiedArrayBuffer], {
|
|
80063
|
+
type: "application/octet-stream"
|
|
80064
|
+
})
|
|
80065
80065
|
});
|
|
80066
80066
|
if (!resp.ok) {
|
|
80067
80067
|
console.error(
|
|
80068
80068
|
`Upload failed for ${uploadUrl}: ${resp.status} ${resp.statusText}`
|
|
80069
80069
|
);
|
|
80070
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
80070
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
80071
80071
|
clonedMapResults.errors.push(
|
|
80072
80072
|
`Upload failed: ${resp.status} ${resp.statusText}`
|
|
80073
80073
|
);
|
|
80074
80074
|
} else {
|
|
80075
|
-
clonedMapResults.outputUpload = clonedMapResults.outputUpload
|
|
80075
|
+
clonedMapResults.outputUpload = clonedMapResults.outputUpload ?? {
|
|
80076
80076
|
url: uploadUrl,
|
|
80077
80077
|
status: resp.status
|
|
80078
80078
|
};
|
|
80079
80079
|
}
|
|
80080
80080
|
} catch (e4) {
|
|
80081
80081
|
console.error("Upload error", e4);
|
|
80082
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
80082
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
80083
80083
|
clonedMapResults.errors.push(
|
|
80084
80084
|
`Upload error: ${e4 instanceof Error ? e4.message : String(e4)}`
|
|
80085
80085
|
);
|
|
@@ -80099,12 +80099,14 @@ async function curateOne({
|
|
|
80099
80099
|
new s32.PutObjectCommand({
|
|
80100
80100
|
Bucket: outputTarget.s3.bucketName,
|
|
80101
80101
|
Key: key,
|
|
80102
|
-
|
|
80103
|
-
|
|
80102
|
+
// Use the ArrayBuffer directly — going through Blob.arrayBuffer()
|
|
80103
|
+
// would create yet another copy of the data in memory.
|
|
80104
|
+
Body: new Uint8Array(modifiedArrayBuffer),
|
|
80105
|
+
ContentType: "application/octet-stream",
|
|
80104
80106
|
Metadata: {
|
|
80105
|
-
"source-file-size": String(clonedMapResults.fileInfo?.size
|
|
80106
|
-
"source-file-modified-time": mtime
|
|
80107
|
-
"source-file-hash": preMappedHash
|
|
80107
|
+
"source-file-size": String(clonedMapResults.fileInfo?.size ?? ""),
|
|
80108
|
+
"source-file-modified-time": mtime ?? "",
|
|
80109
|
+
"source-file-hash": preMappedHash ?? "",
|
|
80108
80110
|
...postMappedHash ? { "source-file-post-mapped-hash": postMappedHash } : {}
|
|
80109
80111
|
}
|
|
80110
80112
|
})
|
|
@@ -80116,7 +80118,7 @@ async function curateOne({
|
|
|
80116
80118
|
};
|
|
80117
80119
|
} catch (e4) {
|
|
80118
80120
|
console.error("S3 Upload error", e4);
|
|
80119
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
80121
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
80120
80122
|
clonedMapResults.errors.push(
|
|
80121
80123
|
`S3 Upload error: ${e4 instanceof Error ? e4.message : String(e4)}`
|
|
80122
80124
|
);
|
|
@@ -34005,7 +34005,7 @@ function isPrivateTag(tagId) {
|
|
|
34005
34005
|
return false;
|
|
34006
34006
|
}
|
|
34007
34007
|
function convertKeywordToTagId(keyword) {
|
|
34008
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
34008
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
34009
34009
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
34010
34010
|
}
|
|
34011
34011
|
|
|
@@ -34850,7 +34850,7 @@ function getCid7050Codes(options) {
|
|
|
34850
34850
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
34851
34851
|
var nameMap = dcmjs2.data.DicomMetaDictionary.nameMap;
|
|
34852
34852
|
function getVr(keyword) {
|
|
34853
|
-
const element = nameMap[keyword]
|
|
34853
|
+
const element = nameMap[keyword] ?? nameMap[`RETIRED_${keyword}`];
|
|
34854
34854
|
return element?.vr;
|
|
34855
34855
|
}
|
|
34856
34856
|
function temporalVr(vr) {
|
|
@@ -34922,7 +34922,7 @@ function deidentifyPS315E({
|
|
|
34922
34922
|
}
|
|
34923
34923
|
}
|
|
34924
34924
|
}
|
|
34925
|
-
return current[tagName]
|
|
34925
|
+
return current[tagName] ?? null;
|
|
34926
34926
|
}
|
|
34927
34927
|
const {
|
|
34928
34928
|
cleanDescriptorsOption,
|
|
@@ -17966,7 +17966,7 @@ function isPrivateTag(tagId) {
|
|
|
17966
17966
|
return false;
|
|
17967
17967
|
}
|
|
17968
17968
|
function convertKeywordToTagId(keyword) {
|
|
17969
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
17969
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
17970
17970
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
17971
17971
|
}
|
|
17972
17972
|
function convertKeywordPathToTagIdPath(keywordPath) {
|
|
@@ -97,7 +97,7 @@ function composedSpec() {
|
|
|
97
97
|
ctxIn.hostProps.activityProviderName,
|
|
98
98
|
ctxIn.centerSubjectId(parser),
|
|
99
99
|
ctxIn.timepointName(parser),
|
|
100
|
-
ctxIn.scanName(parser) + "=" + parser.getDicom("SeriesNumber")
|
|
100
|
+
ctxIn.scanName(parser) + "=" + (parser.getDicom("SeriesNumber") ?? "UNKNOWN"),
|
|
101
101
|
parser.getFilePathComp(parser.FILEBASENAME) + ".dcm"
|
|
102
102
|
];
|
|
103
103
|
},
|
package/dist/esm/curateDict.js
CHANGED
|
@@ -34008,7 +34008,7 @@ function isPrivateTag(tagId) {
|
|
|
34008
34008
|
return false;
|
|
34009
34009
|
}
|
|
34010
34010
|
function convertKeywordToTagId(keyword) {
|
|
34011
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
34011
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
34012
34012
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
34013
34013
|
}
|
|
34014
34014
|
function convertKeywordPathToTagIdPath(keywordPath) {
|
|
@@ -34867,7 +34867,7 @@ function getCid7050Codes(options) {
|
|
|
34867
34867
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
34868
34868
|
var nameMap = dcmjs2.data.DicomMetaDictionary.nameMap;
|
|
34869
34869
|
function getVr(keyword) {
|
|
34870
|
-
const element = nameMap[keyword]
|
|
34870
|
+
const element = nameMap[keyword] ?? nameMap[`RETIRED_${keyword}`];
|
|
34871
34871
|
return element?.vr;
|
|
34872
34872
|
}
|
|
34873
34873
|
function temporalVr(vr) {
|
|
@@ -34939,7 +34939,7 @@ function deidentifyPS315E({
|
|
|
34939
34939
|
}
|
|
34940
34940
|
}
|
|
34941
34941
|
}
|
|
34942
|
-
return current[tagName]
|
|
34942
|
+
return current[tagName] ?? null;
|
|
34943
34943
|
}
|
|
34944
34944
|
const {
|
|
34945
34945
|
cleanDescriptorsOption,
|
package/dist/esm/curateOne.js
CHANGED
|
@@ -71706,7 +71706,7 @@ function isPrivateTag(tagId) {
|
|
|
71706
71706
|
return false;
|
|
71707
71707
|
}
|
|
71708
71708
|
function convertKeywordToTagId(keyword) {
|
|
71709
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
71709
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
71710
71710
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
71711
71711
|
}
|
|
71712
71712
|
function convertKeywordPathToTagIdPath(keywordPath) {
|
|
@@ -72565,7 +72565,7 @@ function getCid7050Codes(options) {
|
|
|
72565
72565
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
72566
72566
|
var nameMap = dcmjs2.data.DicomMetaDictionary.nameMap;
|
|
72567
72567
|
function getVr(keyword) {
|
|
72568
|
-
const element = nameMap[keyword]
|
|
72568
|
+
const element = nameMap[keyword] ?? nameMap[`RETIRED_${keyword}`];
|
|
72569
72569
|
return element?.vr;
|
|
72570
72570
|
}
|
|
72571
72571
|
function temporalVr(vr) {
|
|
@@ -72637,7 +72637,7 @@ function deidentifyPS315E({
|
|
|
72637
72637
|
}
|
|
72638
72638
|
}
|
|
72639
72639
|
}
|
|
72640
|
-
return current[tagName]
|
|
72640
|
+
return current[tagName] ?? null;
|
|
72641
72641
|
}
|
|
72642
72642
|
const {
|
|
72643
72643
|
cleanDescriptorsOption,
|
|
@@ -73404,9 +73404,9 @@ async function hash(buffer, hashMethod) {
|
|
|
73404
73404
|
case "crc32":
|
|
73405
73405
|
return crc32Hex(buffer);
|
|
73406
73406
|
case "md5":
|
|
73407
|
+
default:
|
|
73407
73408
|
return md5Hex(buffer);
|
|
73408
73409
|
case "crc64":
|
|
73409
|
-
default:
|
|
73410
73410
|
return crc64Hex(buffer);
|
|
73411
73411
|
}
|
|
73412
73412
|
}
|
|
@@ -73481,7 +73481,7 @@ async function loadS3Client() {
|
|
|
73481
73481
|
const { createRequire } = await import("module");
|
|
73482
73482
|
const req = createRequire(import.meta.url);
|
|
73483
73483
|
const mod = req("@aws-sdk/client-s3");
|
|
73484
|
-
cachedS3Client = mod?.default
|
|
73484
|
+
cachedS3Client = mod?.default ?? mod;
|
|
73485
73485
|
} else {
|
|
73486
73486
|
cachedS3Client = await Promise.resolve().then(() => __toESM(require_dist_cjs71(), 1));
|
|
73487
73487
|
}
|
|
@@ -73520,7 +73520,7 @@ async function curateOne({
|
|
|
73520
73520
|
);
|
|
73521
73521
|
}
|
|
73522
73522
|
file = await resp.blob();
|
|
73523
|
-
const lastModifiedHeader = resp.headers.get("last-modified")
|
|
73523
|
+
const lastModifiedHeader = resp.headers.get("last-modified");
|
|
73524
73524
|
if (lastModifiedHeader) {
|
|
73525
73525
|
mtime = new Date(lastModifiedHeader).toISOString();
|
|
73526
73526
|
}
|
|
@@ -73586,14 +73586,14 @@ async function curateOne({
|
|
|
73586
73586
|
} catch (e4) {
|
|
73587
73587
|
}
|
|
73588
73588
|
}
|
|
73589
|
-
|
|
73589
|
+
let fileArrayBuffer = await file.arrayBuffer();
|
|
73590
73590
|
let preMappedHash;
|
|
73591
73591
|
let postMappedHash;
|
|
73592
73592
|
const postMappedHashHeader = "x-source-file-hash";
|
|
73593
73593
|
let canSkip = false;
|
|
73594
73594
|
if (previousSourceFileInfo?.preMappedHash !== void 0) {
|
|
73595
73595
|
try {
|
|
73596
|
-
preMappedHash = await hash(fileArrayBuffer, hashMethod
|
|
73596
|
+
preMappedHash = await hash(fileArrayBuffer, hashMethod ?? "md5");
|
|
73597
73597
|
} catch (e4) {
|
|
73598
73598
|
console.warn(`Failed to compute preMappedHash for ${fileInfo.name}`, e4);
|
|
73599
73599
|
}
|
|
@@ -73698,7 +73698,7 @@ async function curateOne({
|
|
|
73698
73698
|
}
|
|
73699
73699
|
if (!preMappedHash) {
|
|
73700
73700
|
try {
|
|
73701
|
-
preMappedHash = await hash(fileArrayBuffer, hashMethod
|
|
73701
|
+
preMappedHash = await hash(fileArrayBuffer, hashMethod ?? "md5");
|
|
73702
73702
|
} catch (e4) {
|
|
73703
73703
|
console.warn(`Failed to compute preMappedHash for ${fileInfo.name}`, e4);
|
|
73704
73704
|
}
|
|
@@ -73709,7 +73709,8 @@ async function curateOne({
|
|
|
73709
73709
|
const modifiedArrayBuffer = mappedDicomData.write({
|
|
73710
73710
|
allowInvalidVRLength: true
|
|
73711
73711
|
});
|
|
73712
|
-
postMappedHash = await hash(modifiedArrayBuffer, hashMethod
|
|
73712
|
+
postMappedHash = await hash(modifiedArrayBuffer, hashMethod ?? "md5");
|
|
73713
|
+
fileArrayBuffer = null;
|
|
73713
73714
|
const previousPostMappedHash = previousMappedFileInfo ? previousMappedFileInfo(clonedMapResults.outputFilePath)?.postMappedHash : void 0;
|
|
73714
73715
|
if (previousPostMappedHash !== void 0 && previousPostMappedHash === postMappedHash) {
|
|
73715
73716
|
return noMapResult(clonedMapResults.outputFilePath);
|
|
@@ -73741,26 +73742,23 @@ async function curateOne({
|
|
|
73741
73742
|
}
|
|
73742
73743
|
const fullFilePath = path.join(fullDirPath, fileName);
|
|
73743
73744
|
await fs.writeFile(fullFilePath, new DataView(modifiedArrayBuffer));
|
|
73744
|
-
} else {
|
|
73745
|
+
} else if (!outputTarget?.http && !outputTarget?.s3) {
|
|
73745
73746
|
clonedMapResults.mappedBlob = new Blob([modifiedArrayBuffer], {
|
|
73746
73747
|
type: "application/octet-stream"
|
|
73747
73748
|
});
|
|
73748
73749
|
}
|
|
73749
|
-
clonedMapResults.mappedBlob = new Blob([modifiedArrayBuffer], {
|
|
73750
|
-
type: "application/octet-stream"
|
|
73751
|
-
});
|
|
73752
73750
|
if (outputTarget?.http) {
|
|
73753
73751
|
try {
|
|
73754
73752
|
const key = clonedMapResults.outputFilePath.split("/").map(encodeURIComponent).join("/");
|
|
73755
73753
|
const uploadUrl = `${outputTarget.http.url}/${key}`;
|
|
73756
73754
|
const headers = {
|
|
73757
|
-
"Content-Type":
|
|
73755
|
+
"Content-Type": "application/octet-stream",
|
|
73758
73756
|
"X-File-Name": fileName,
|
|
73759
|
-
"X-File-Type":
|
|
73757
|
+
"X-File-Type": "application/octet-stream",
|
|
73760
73758
|
"X-File-Size": String(modifiedArrayBuffer.byteLength),
|
|
73761
|
-
"X-Source-File-Size": String(clonedMapResults.fileInfo?.size
|
|
73762
|
-
"X-Source-File-Modified-Time": mtime
|
|
73763
|
-
"X-Source-File-Hash": preMappedHash
|
|
73759
|
+
"X-Source-File-Size": String(clonedMapResults.fileInfo?.size ?? ""),
|
|
73760
|
+
"X-Source-File-Modified-Time": mtime ?? "",
|
|
73761
|
+
"X-Source-File-Hash": preMappedHash ?? ""
|
|
73764
73762
|
};
|
|
73765
73763
|
if (outputTarget.http.headers) {
|
|
73766
73764
|
Object.assign(headers, outputTarget.http.headers);
|
|
@@ -73770,25 +73768,27 @@ async function curateOne({
|
|
|
73770
73768
|
const resp = await fetchWithRetry(uploadUrl, {
|
|
73771
73769
|
method: "PUT",
|
|
73772
73770
|
headers,
|
|
73773
|
-
body:
|
|
73771
|
+
body: new Blob([modifiedArrayBuffer], {
|
|
73772
|
+
type: "application/octet-stream"
|
|
73773
|
+
})
|
|
73774
73774
|
});
|
|
73775
73775
|
if (!resp.ok) {
|
|
73776
73776
|
console.error(
|
|
73777
73777
|
`Upload failed for ${uploadUrl}: ${resp.status} ${resp.statusText}`
|
|
73778
73778
|
);
|
|
73779
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
73779
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
73780
73780
|
clonedMapResults.errors.push(
|
|
73781
73781
|
`Upload failed: ${resp.status} ${resp.statusText}`
|
|
73782
73782
|
);
|
|
73783
73783
|
} else {
|
|
73784
|
-
clonedMapResults.outputUpload = clonedMapResults.outputUpload
|
|
73784
|
+
clonedMapResults.outputUpload = clonedMapResults.outputUpload ?? {
|
|
73785
73785
|
url: uploadUrl,
|
|
73786
73786
|
status: resp.status
|
|
73787
73787
|
};
|
|
73788
73788
|
}
|
|
73789
73789
|
} catch (e4) {
|
|
73790
73790
|
console.error("Upload error", e4);
|
|
73791
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
73791
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
73792
73792
|
clonedMapResults.errors.push(
|
|
73793
73793
|
`Upload error: ${e4 instanceof Error ? e4.message : String(e4)}`
|
|
73794
73794
|
);
|
|
@@ -73808,12 +73808,14 @@ async function curateOne({
|
|
|
73808
73808
|
new s32.PutObjectCommand({
|
|
73809
73809
|
Bucket: outputTarget.s3.bucketName,
|
|
73810
73810
|
Key: key,
|
|
73811
|
-
|
|
73812
|
-
|
|
73811
|
+
// Use the ArrayBuffer directly — going through Blob.arrayBuffer()
|
|
73812
|
+
// would create yet another copy of the data in memory.
|
|
73813
|
+
Body: new Uint8Array(modifiedArrayBuffer),
|
|
73814
|
+
ContentType: "application/octet-stream",
|
|
73813
73815
|
Metadata: {
|
|
73814
|
-
"source-file-size": String(clonedMapResults.fileInfo?.size
|
|
73815
|
-
"source-file-modified-time": mtime
|
|
73816
|
-
"source-file-hash": preMappedHash
|
|
73816
|
+
"source-file-size": String(clonedMapResults.fileInfo?.size ?? ""),
|
|
73817
|
+
"source-file-modified-time": mtime ?? "",
|
|
73818
|
+
"source-file-hash": preMappedHash ?? "",
|
|
73817
73819
|
...postMappedHash ? { "source-file-post-mapped-hash": postMappedHash } : {}
|
|
73818
73820
|
}
|
|
73819
73821
|
})
|
|
@@ -73825,7 +73827,7 @@ async function curateOne({
|
|
|
73825
73827
|
};
|
|
73826
73828
|
} catch (e4) {
|
|
73827
73829
|
console.error("S3 Upload error", e4);
|
|
73828
|
-
clonedMapResults.errors = clonedMapResults.errors
|
|
73830
|
+
clonedMapResults.errors = clonedMapResults.errors ?? [];
|
|
73829
73831
|
clonedMapResults.errors.push(
|
|
73830
73832
|
`S3 Upload error: ${e4 instanceof Error ? e4.message : String(e4)}`
|
|
73831
73833
|
);
|
|
@@ -33999,7 +33999,7 @@ function isPrivateTag(tagId) {
|
|
|
33999
33999
|
return false;
|
|
34000
34000
|
}
|
|
34001
34001
|
function convertKeywordToTagId(keyword) {
|
|
34002
|
-
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag
|
|
34002
|
+
const tagId = isPrivateTag(keyword) ? keyword : dcmjs.data.DicomMetaDictionary.nameMap[keyword]?.tag ?? keyword;
|
|
34003
34003
|
return tagId.replace(/[(),]/g, "").toLowerCase();
|
|
34004
34004
|
}
|
|
34005
34005
|
|
|
@@ -34844,7 +34844,7 @@ function getCid7050Codes(options) {
|
|
|
34844
34844
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
34845
34845
|
var nameMap = dcmjs2.data.DicomMetaDictionary.nameMap;
|
|
34846
34846
|
function getVr(keyword) {
|
|
34847
|
-
const element = nameMap[keyword]
|
|
34847
|
+
const element = nameMap[keyword] ?? nameMap[`RETIRED_${keyword}`];
|
|
34848
34848
|
return element?.vr;
|
|
34849
34849
|
}
|
|
34850
34850
|
function temporalVr(vr) {
|
|
@@ -34916,7 +34916,7 @@ function deidentifyPS315E({
|
|
|
34916
34916
|
}
|
|
34917
34917
|
}
|
|
34918
34918
|
}
|
|
34919
|
-
return current[tagName]
|
|
34919
|
+
return current[tagName] ?? null;
|
|
34920
34920
|
}
|
|
34921
34921
|
const {
|
|
34922
34922
|
cleanDescriptorsOption,
|
package/dist/esm/hash.js
CHANGED