Skip to content

Commit

Permalink
feat: search instances in a study by study uid API
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Aug 10, 2023
1 parent 76e02e0 commit 2f066aa
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 6 deletions.
47 changes: 47 additions & 0 deletions api-sql/dicom-web/controller/QIDO-RS/queryStudies-Instances.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const {
SqlQidoRsService: QidoRsService
} = require("./service/QIDO-RS.service");
const { ApiLogger } = require("@root/utils/logs/api-logger");
const { Controller } = require("@root/api/controller.class");

class QueryInstancesOfStudiesController extends Controller {
constructor(req, res) {
super(req, res);
}

async mainProcess() {
let apiLogger = new ApiLogger(this.request, "QIDO-RS");

apiLogger.addTokenValue();
apiLogger.logger.info(`Query instances in study, Study UID: ${this.request.params.studyUID}`);

try {

let qidoRsService = new QidoRsService(this.request, this.response, "instance");

await qidoRsService.getAndResponseDicomJson();
} catch (e) {
let errorStr = JSON.stringify(e, Object.getOwnPropertyNames(e));
apiLogger.logger.error(errorStr);

this.response.writeHead(500, {
"Content-Type": "application/dicom+json"
});
this.response.end(JSON.stringify({
code: 500,
message: "Server error occurred"
}));
}
}
}

/**
*
* @param {import('express').Request} req
* @param {import('express').Response} res
*/
module.exports = async function (req, res) {
let controller = new QueryInstancesOfStudiesController(req, res);

await controller.doPipeline();
};
12 changes: 6 additions & 6 deletions api-sql/dicom-web/qido-rs.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ router.get("/studies", validateParams(queryValidation, "query", {
* - $ref: "#/components/schemas/SeriesRequiredMatchingAttributes"
* - $ref: "#/components/schemas/InstanceRequiredMatchingAttributes"
*/
// router.get(
// "/studies/:studyUID/instances", validateParams(queryValidation, "query", {
// allowUnknown: true
// }),
// require("./controller/QIDO-RS/queryStudies-Instances")
// );
router.get(
"/studies/:studyUID/instances", validateParams(queryValidation, "query", {
allowUnknown: true
}),
require("./controller/QIDO-RS/queryStudies-Instances")
);

/**
* @openapi
Expand Down

0 comments on commit 2f066aa

Please sign in to comment.