Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat/relativeURI
Browse files Browse the repository at this point in the history
  • Loading branch information
wayfarer3130 committed Jun 21, 2024
2 parents b1dc099 + e81c2fd commit 475f9ea
Show file tree
Hide file tree
Showing 19 changed files with 10,146 additions and 3,490 deletions.
66 changes: 0 additions & 66 deletions .circleci/config.yml

This file was deleted.

22 changes: 11 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
"extends": "airbnb-base",
//"plugins": ["prettier"],
"rules": {
"import/extensions": { "js": "always" }, // Better for native ES Module usage
"no-console": 0, // We can remove this later
"no-underscore-dangle": 0,
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]
},
"env": {
"browser": 1
}
root: true,
extends: ['airbnb-base', 'prettier'],
rules: {
'import/extensions': "always", // Better for native ES Module usage
'no-console': 0, // We can remove this later
'no-underscore-dangle': 0,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
},
env: {
browser: 1,
},
};
37 changes: 37 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish package to NPM

on:
push:
branches:
- master

jobs:
publish-package:
runs-on: ubuntu-20.04
environment: publish

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install packages
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build

- name: Run tests
run: npm run test

- name: Semantic release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run tests

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install packages
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build

- name: Run tests
run: npm run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ yarn.lock

# docker files created by the docker containers for testing
tmp

types/*
!types/types.d.ts
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ For further details please refer to [PS3.18 of the DICOM standard](http://dicom.

## Goal

**This is work-in-progress and should not be used in clinical practice.**
**This is work-in-progress and should not be used in clinical practice. Use at your own risk.**

The main motivation for this project is:
The main motivations for this project is:
* Support for storing, quering, retrieving DICOM objects over the web using RESTful services STOW-RS, QIDO-RS and WADO-RS, respectively
* Building a lightweight library to facilitate integration into web applications

Expand Down Expand Up @@ -49,10 +49,51 @@ client.searchForStudies().then(studies => {
});
```

## Configuration Options
The API can be configured with a number of custom configuration options to control the requests. These are:
* url to retrieve from for the base requests
* singlepart, either true or a set of parts from `bulkdata,image,video` to request as single part responses
* headers to add to the retrieve
* `XMLHttpRequest` can be passed to `storeInstances` as a property of the `options` parameter. When present, instead of creating a new `XMLHttpRequest` instance, the passed instance is used instead. One use of this would be to track the progress of a DICOM store and/or cancel it.

An example use of `XMLHttpRequest` being passed into the store is shown in the js snippet below
as an example of where the upload's percentage progress is output to the console.

```js
const url = 'http://localhost:8080/dicomweb';
const client = new DICOMwebClient.api.DICOMwebClient({url});

// an ArrayBuffer of the DICOM object/file
const dataSet = ... ;

// A custom HTTP request
const request = new XMLHttpRequest();

// A callback that outputs the percentage complete to the console.
const progressCallback = evt => {
if (!evt.lengthComputable) {
// Progress computation is not possible.
return;
}

const percentComplete = Math.round((100 * evt.loaded) / evt.total);
console.log("storeInstances is " + percentComplete + "%");
};

// Add the progress callback as a listener to the request upload object.
request.upload.addEventListener('progress', progressCallback);

const storeInstancesOptions = {
dataSets,
request,
}
client.storeInstances(storeInstancesOptions).then( () => console.log("storeInstances completed successfully.") );

```

## For maintainers

Use `semantic` commit messages to generate releases and change log entries: [Semantic Release: How does it work?](https://semantic-release.gitbook.io/semantic-release/#how-does-it-work)
Use `semantic` commit messages to generate releases and change log entries: [Semantic Release: How does it work?](https://semantic-release.gitbook.io/semantic-release/#how-does-it-work). Github actions are used to trigger building and uploading new npm packages.

## Citation

Expand Down
31 changes: 9 additions & 22 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
// Karma configuration
// Generated on Wed Sep 19 2018 21:13:00 GMT+0200 (CEST)
process.env.CHROME_BIN = require('puppeteer').executablePath()
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'build/dicomweb-client.js',
{ pattern: 'testData/*', included: false, served: true },
'test/*.js'
'test/*.js',
],


// list of files / patterns to exclude
exclude: [
],

exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},

preprocessors: {},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Chrome_without_security'], // You may use 'ChromeCanary', 'Chromium' or any other supported browser
Expand All @@ -64,12 +51,12 @@ module.exports = function(config) {
customLaunchers: {
Chrome_without_security: {
base: 'Chrome',
flags: ['--disable-web-security']
flags: ['--disable-web-security'],
},

ChromeHeadless_without_security: {
base: 'ChromeHeadless',
flags: ['--disable-web-security']
flags: ['--disable-web-security'],
},
},

Expand All @@ -79,6 +66,6 @@ module.exports = function(config) {

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
concurrency: Infinity,
});
};
Loading

0 comments on commit 475f9ea

Please sign in to comment.