Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/imanabu/dcmWebMwlTes…
Browse files Browse the repository at this point in the history
…tGen into development

# Conflicts:
#	.gitignore
#	README.md
#	routes/api.ts
#	services/Utils.js
  • Loading branch information
imanabu committed Jul 23, 2021
2 parents 8549e58 + 3e7982f commit 9c0d9ea
Show file tree
Hide file tree
Showing 8 changed files with 346 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ package-lock.json
client/Main.js
model/*.js
services/*.js
services/Utils.js
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

289 changes: 289 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,31 @@
## Modality Worklist Test Generator and QIDO Server System

Manabu Tokunaga, GitHub: imanabu
Version 0.0.8
Version 0.0.9
Release Date: 2021-07-23

## New Features and Changes

### 0.0.9

* Security Update
* Compiler compatilibity updates for TypeScript 3.9.6

### 0.0.8

* Addressed compilation error with TS 3.9.6
* Addressed NPM security issues
* Ignore .ts derivces .js files from Git
* The limit parameter will just return the requested number of entries. If you want the old behavior
you can add force=true parameter, which will generate the number of new entries for the amount listed.

* The new default is 5000 encounters per 12 hour period now. Please test your stuff to be able to handle
this volume, which is a medium-large hospital size during an epidemic scare and such.

Reminder: The algorithm is that we generate
new encounters = (total number of encounter/day) * (fraction of the time elapsed from the last call)

We will drop the same number of the encounters as the new ones from the list. Consider that
dropped patients are the ones that have been discharged. I know this is not really realistic but
it should do for now and any more complex patient flow, you should handle that on your end from
the generated list.

### 0.0.6 - 0.0.7

Expand Down
30 changes: 18 additions & 12 deletions client/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,35 @@ export class Main implements m.ClassComponent {
private rawMwl: any[] = [];
private mode: "add" | "dept" | "mwl" | "raw" = "mwl";
private departments: string;
private limit = 0;
private limit = 100;
private usedUrl = "";

constructor() {
this.mwl = "";
this.departments = "";
console.log("Constructed");
}

public view() {
public view = () => {
const my = this;
const spacer = m("[style=margin-bottom:10px;]", m.trust(" "));
const h = m(`h2`, {}, `ZenSnapMD MWL Test Suite`);
const h = m("",
m(`h2`, {}, `ZenSnapMD MWL Test Suite`),
m("a[href=https://github.com/imanabu/dcmWebMwlTestGen][target=_blank]",
"Source on GitHub")
);

let help = m("");

const limitLabel = m("label[for=limit]", "Limit: ");
const limit = m("input[id=limit][type=text][style=margin-left:10px]",
{
onchange: m.withAttr("value", (v) => { my.limit = parseInt(v, 10);}),
placeholder: "10",
onchange: (e:Event) => {
const v = (e.currentTarget as HTMLInputElement).value;
my.limit = parseInt(v, 10);
console.log(`Limit set to ${my.limit}`);
},
placeholder: "100",
value: my.limit,
});
const limitCell = m(".col", [limitLabel, limit]);
Expand All @@ -61,7 +70,7 @@ export class Main implements m.ClassComponent {
const deptButton = m("button.btn-margin.col.btn-med.btn-info", {
onclick: () => {
my.mode = "dept";
return my.getDepartments();
return my.getDepartments.bind(my)();
},
}, "Show Departments");

Expand All @@ -76,7 +85,6 @@ export class Main implements m.ClassComponent {
let body: Vnode = m("");

if (my.mode === "mwl") {

help = m(".col.head-room", `Used QIDO API URL: ${my.usedUrl}`);

const listHead = m(".row.list-header",
Expand Down Expand Up @@ -106,8 +114,8 @@ export class Main implements m.ClassComponent {
}

return m(".row",
m(".col-1", item["00400100"].Value[0]["00400002"].Value[0]),
// m(".col", item["00400100"].Value[0]["00400003"].Value[0]),
m(".col-1", item["00400100"].Value[0]["00400002"].Value[0]
+ " " + item["00400100"].Value[0]["00400003"].Value[0]),
m(".col-2", finalName),
m(".col-1", item["00100020"].Value[0]),
m(".col-1", item["00100030"].Value[0]),
Expand Down Expand Up @@ -136,11 +144,10 @@ export class Main implements m.ClassComponent {
m(".row", help),
spacer,
body]);
}
};

private getMwl = () => {
const my = this;
my.mode = "mwl";
const url = my.limit ? `api/studies?limit=${my.limit}` :
`api/studies`;

Expand Down Expand Up @@ -176,7 +183,6 @@ export class Main implements m.ClassComponent {
my.mwl = error.toString();
}
);

};
}

Expand Down
8 changes: 4 additions & 4 deletions config/appConfig.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const appConfig = {

generator: {
// 12 makes about 100 case a day hospital.
absoluteMax: 250,
defaultMax: 20,
hourlyPatients: 12,
// Makes 5000 encounters every 12 hours
absoluteMax: 500,
defaultMax: 500,
hourlyPatients: 400,
persistConfig: false,
},

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcmwebmwltestgen",
"version": "0.0.8",
"version": "0.0.9",
"description": "DICOM Web Based Modality Worklist Test Generator",
"main": "app.js",
"repository": "https://[email protected]/imanabu/dcmWebMwlTestGen.git",
Expand Down
17 changes: 9 additions & 8 deletions routes/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import config = require("../config/appConfig");
import express = require("express");

import _ from "lodash/fp";
import {Request, Response} from "express";

import {INewStudy, IApiResponse, INewStudyDto} from "../model/dtos";
Expand All @@ -20,11 +19,13 @@ router.get("/studies", (req: Request, res: Response) => {
const currentTime = Date.now();
const elapsedHours = (currentTime - lastGeneratedAt)/(1000*60*60);

const defaultMode = !req.query.limit;

let limit: number = req.query.limit ? parseInt(req.query.limit as string , 10) :
let limit: number = req.query.limit ? parseInt(req.query.limit as string, 10) :
config.generator.defaultMax;

let force = req.query.force ? req.query.force as string : "";

const defaultMode = !req.query.limit || !force.startsWith("t");

limit = (limit > config.generator.absoluteMax) ? config.generator.absoluteMax : limit;

const hourlyPatients = req.query.hourly || config.generator.hourlyPatients;
Expand Down Expand Up @@ -74,11 +75,11 @@ router.get("/studies", (req: Request, res: Response) => {

previousLimit = limit;

let result = _.sortBy((x: any) => {
return [x["00100010"].Value[0].Alphabetic];
})(list);
// let result = _.sortBy((x: any) => {
// return [x["00100010"].Value[0].Alphabetic];
// })(list);

res.status(200).json(result);
res.status(200).json(list);
});

router.get("/departments", (req: Request, res: Response) => {
Expand Down

0 comments on commit 9c0d9ea

Please sign in to comment.