Skip to content

Commit 71b844f

Browse files
committed
9.10 - 9.11
1 parent 0dab833 commit 71b844f

10 files changed

Lines changed: 188 additions & 4 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
[
2+
{
3+
"code": "M24.2",
4+
"name": "Disorder of ligament",
5+
"latin": "Morbositas ligamenti"
6+
},
7+
{
8+
"code": "M51.2",
9+
"name": "Other specified intervertebral disc displacement",
10+
"latin": "Alia dislocatio disci intervertebralis specificata"
11+
},
12+
{
13+
"code": "S03.5",
14+
"name": "Sprain and strain of joints and ligaments of other and unspecified parts of head",
15+
"latin": "Distorsio et/sive distensio articulationum et/sive ligamentorum partium aliarum sive non specificatarum capitis"
16+
},
17+
{
18+
"code": "J10.1",
19+
"name": "Influenza with other respiratory manifestations, other influenza virus code entified",
20+
"latin": "Influenza cum aliis manifestationibus respiratoriis ab agente virali code entificato"
21+
},
22+
{
23+
"code": "J06.9",
24+
"name": "Acute upper respiratory infection, unspecified",
25+
"latin": "Infectio acuta respiratoria superior non specificata"
26+
},
27+
{
28+
"code": "Z57.1",
29+
"name": "Occupational exposure to radiation"
30+
},
31+
{
32+
"code": "N30.0",
33+
"name": "Acute cystitis",
34+
"latin": "Cystitis acuta"
35+
},
36+
{
37+
"code": "H54.7",
38+
"name": "Unspecified visual loss",
39+
"latin": "Amblyopia NAS"
40+
},
41+
{
42+
"code": "J03.0",
43+
"name": "Streptococcal tonsillitis",
44+
"latin": "Tonsillitis (palatina) streptococcica"
45+
},
46+
{
47+
"code": "L60.1",
48+
"name": "Onycholysis",
49+
"latin": "Onycholysis"
50+
},
51+
{
52+
"code": "Z74.3",
53+
"name": "Need for continuous supervision"
54+
},
55+
{
56+
"code": "L20",
57+
"name": "Atopic dermatitis",
58+
"latin": "Atopic dermatitis"
59+
},
60+
{
61+
"code": "F43.2",
62+
"name": "Adjustment disorders",
63+
"latin": "Perturbationes adaptationis"
64+
},
65+
{
66+
"code": "S62.5",
67+
"name": "Fracture of thumb",
68+
"latin": "Fractura [ossis/ossium] pollicis"
69+
},
70+
{
71+
"code": "H35.29",
72+
"name": "Other proliferative retinopathy",
73+
"latin": "Alia retinopathia proliferativa"
74+
},
75+
{
76+
"code": "J12.82",
77+
"name": "Pneumonia due to coronavirus disease"
78+
}
79+
]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"id": "d2773336-f723-11e9-8f0b-362b9e155667",
4+
"name": "John McClane",
5+
"dateOfBirth": "1986-07-09",
6+
"ssn": "090786-122X",
7+
"gender": "male",
8+
"occupation": "New york city cop"
9+
},
10+
{
11+
"id": "d2773598-f723-11e9-8f0b-362b9e155667",
12+
"name": "Martin Riggs",
13+
"dateOfBirth": "1979-01-30",
14+
"ssn": "300179-77A",
15+
"gender": "male",
16+
"occupation": "Cop"
17+
},
18+
{
19+
"id": "d27736ec-f723-11e9-8f0b-362b9e155667",
20+
"name": "Hans Gruber",
21+
"dateOfBirth": "1970-04-25",
22+
"ssn": "250470-555L",
23+
"gender": "male",
24+
"occupation": "Technician"
25+
},
26+
{
27+
"id": "d2773822-f723-11e9-8f0b-362b9e155667",
28+
"name": "Dana Scully",
29+
"dateOfBirth": "1974-01-05",
30+
"ssn": "050174-432N",
31+
"gender": "female",
32+
"occupation": "Forensic Pathologist"
33+
},
34+
{
35+
"id": "d2773c6e-f723-11e9-8f0b-362b9e155667",
36+
"name": "Matti Luukkainen",
37+
"dateOfBirth": "1971-04-09",
38+
"ssn": "090471-8890",
39+
"gender": "male",
40+
"occupation": "Digital evangelist"
41+
}
42+
]

part9/patientor-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"scripts": {
77
"tsc": "tsc",
8-
"dev": "ts-node-dev index.ts",
8+
"dev": "ts-node-dev src/index.ts",
99
"lint": "eslint --ext .ts .",
1010
"start": "node build/index.js"
1111
},
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import cors from "cors";
22
import express from "express";
3+
import diagnosesRouter from "./routes/diagnose";
4+
import patientsRouter from "./routes/patient";
5+
36
const app = express();
4-
app.use(cors);
7+
app.use(cors());
58
app.use(express.json());
69

710
app.get("/ping", (_req, res) => {
811
res.send("pong");
912
});
1013

14+
app.use("/api/diagnoses", diagnosesRouter);
15+
app.use("/api/patients", patientsRouter);
16+
1117
const PORT = 3001;
1218
app.listen(PORT, () => {
1319
console.log(`Server started on port ${PORT}`);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Router } from "express";
2+
import diagnoseService from "../services/diagnoseService";
3+
4+
const router = Router();
5+
6+
router.get("/", (_req, res) => {
7+
res.send(diagnoseService.getDiagnoses());
8+
});
9+
10+
export default router;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Router from "express";
2+
import patientService from "../services/patientService";
3+
const router = Router();
4+
5+
router.get("/", (_req, res) => {
6+
res.send(patientService.getPatients());
7+
});
8+
9+
export default router;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import diagnoseData from "../../data/diagnoses.json";
2+
import { Diagnose } from "../../types";
3+
4+
const getDiagnoses = (): Diagnose[] => {
5+
return diagnoseData;
6+
};
7+
8+
export default {
9+
getDiagnoses,
10+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import patientData from "../../data/patients.json";
2+
import { Patient } from "../../types";
3+
4+
const patients: Patient[] = patientData;
5+
6+
const getPatients = (): Omit<Patient, "ssn">[] => {
7+
return patients.map(({ id, name, dateOfBirth, occupation }) => ({
8+
id,
9+
name,
10+
dateOfBirth,
11+
occupation,
12+
}));
13+
};
14+
15+
export default { getPatients };

part9/patientor-backend/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
3636
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
3737
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38-
// "resolveJsonModule": true, /* Enable importing .json files */
38+
"resolveJsonModule": true /* Enable importing .json files */,
3939
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
4040

4141
/* JavaScript Support */
@@ -53,7 +53,7 @@
5353
"outDir": "./build/" /* Specify an output folder for all emitted files. */,
5454
// "removeComments": true, /* Disable emitting comments. */
5555
// "noEmit": true, /* Disable emitting files from a compilation. */
56-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
56+
"importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */,
5757
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
5858
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
5959
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */

part9/patientor-backend/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export interface Diagnose {
2+
code: string;
3+
name: string;
4+
latin?: string;
5+
}
6+
7+
export interface Patient {
8+
id: string;
9+
name: string;
10+
dateOfBirth: string;
11+
ssn: string;
12+
occupation: string;
13+
}

0 commit comments

Comments
 (0)