dicom-curate 0.13.0 → 0.14.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/README.md CHANGED
@@ -78,6 +78,76 @@ const options: OrganizeOptions = {
78
78
  }
79
79
  ```
80
80
 
81
+ It is also possible to save curated files to an HTTP endpoint. Provide a base URL, optionally with additional
82
+ HTTP headers, and files will be uploaded using a PUT request.
83
+
84
+ ```ts
85
+ const options: OrganizeOptions = {
86
+ inputType: 'path',
87
+ inputDirectory, // input folder directory path, e.g. "/home/user/files"
88
+ outputEndpoint: {
89
+ url: 'http://example.com/base-url',
90
+ headers: {
91
+ Authorization: 'Bearer xxx',
92
+ },
93
+ },
94
+ curationSpec, // DICOM curation specification
95
+ columnMapping, // csv file handle to add csv-based mapping
96
+ }
97
+ ```
98
+
99
+ The same can be done on the input as well:
100
+
101
+ ```ts
102
+ const options: OrganizeOptions = {
103
+ inputType: 'http',
104
+ inputUrls: ['http://example.com/file1.dcm', 'http://example.com/file2.dcm'],
105
+ headers: {
106
+ Authorization: 'Bearer xxx',
107
+ },
108
+ // other options
109
+ }
110
+ ```
111
+
112
+ This library can now automatically skip writing (or uploading) mapped files if the provided
113
+ "previous" input file attributes match the record you pass in the `fileInfoIndex` property:
114
+
115
+ ```ts
116
+ const options: OrganizeOptions = {
117
+ // other options are skipped
118
+ fileInfoIndex: {
119
+ // Last observed file size + mtime are provided for this file
120
+ // The file will be skipped if these attributes haven't changed
121
+ 'input_file1.dcm': {
122
+ // File size when this input was last processed
123
+ size: 123456,
124
+ // Last modification time of the file when it was last processed
125
+ mtime: '2025-11-12T17:56:13.419Z',
126
+ },
127
+ // Last observed hash is provided for this input file.
128
+ // The hash algorithm used is determined by hashMethod.
129
+ // If the input file has the same hash as specified here, it will be skipped as unchanged.
130
+ 'input_file2.dcm': {
131
+ preMappedHash: 'd8e8fca2dc0f896fd7cb4cb0031ba249',
132
+ },
133
+ // The postMappedHash is the hash of the processed file.
134
+ // It is possible to provide the postMappedHash either under the input file path
135
+ // or under the output file path.
136
+ // In either case, if only postMappedHash is provided for a file, the file has to be
137
+ // processed first and only then can it be determined as unchanged and not written or uploaded,
138
+ // so the optimization is not as great as when some of the above properties are provided.
139
+ //
140
+ // To avoid collisions with input file names, key representing output (post-mapped) file names
141
+ // need to be prefixed with OUTPUT_FILE_PREFIX.
142
+ [OUTPUT_FILE_PREFIX + 'output_file3.dcm']: {
143
+ // post-mapped hash
144
+ postMappedHash: '126a8a51b9d1bbd07fddc65819a542c3',
145
+ },
146
+ },
147
+ hashMethod: 'md5',
148
+ }
149
+ ```
150
+
81
151
  You can also call `curateOne` directly and receive a promise with the mapped blob:
82
152
 
83
153
  ```ts