-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 532-support-drug-interactions-2
- Loading branch information
Showing
8 changed files
with
869 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Forms,Immediate packaging,Routes | ||
Bar,Aerosol,Buccal | ||
Block,Ampoule,Inhalation | ||
Capsule,Applicator,Intramuscular | ||
Capsule (enteric coated),Bag,Intrathecal | ||
Capsule (hard),Blister pack,Intratracheal | ||
Capsule (modified release),Bottle,Intrauterine | ||
Cement,Can,Intraperitoneal | ||
Chewing gum,Carton,Intravenous | ||
Collodion,Cartridge,Nasal | ||
Cream,Chamber,Ocular | ||
Cream (modified),Device,Oral | ||
Cream (vaginal),Dry powder inhaler,Otic | ||
Drug delivery system (intrauterine),Inhaler,Rectal | ||
Drug delivery system (vaginal),Metered dose inhaler,Subcutaneous | ||
Ear drop,Nebule,Subdermal | ||
Ear/eye drop,Pre-filled syringe,Sublingual | ||
Enema,Pump actuated aerosol,Topical | ||
Eye drop,Sachet,Transdermal | ||
Eye drop (gel forming),Spray,Vaginal | ||
Eye gel,Tube, | ||
Eye ointment,Vial, | ||
Eye solution,, | ||
Eye/ear ointment,, | ||
Foam,, | ||
Gas,, | ||
Gel,, | ||
Gel (intestinal),, | ||
Gel (modified release),, | ||
Granules,, | ||
Granules (effervescent),, | ||
Granules (modified release),, | ||
Implant,, | ||
Infusion,, | ||
Infusion (powder for),, | ||
Inhalation,, | ||
Inhalation (breath activated),, | ||
Inhalation (powder for),, | ||
Inhalation (pressurised),, | ||
Inhalation (solution),, | ||
Injection,, | ||
Injection (concentrated),, | ||
Injection (emulsion),, | ||
Injection (intra-ocular),, | ||
Injection (intrathecal),, | ||
Injection (modified release),, | ||
Injection (powder for),, | ||
Injection (suspension),, | ||
Injection (solution),, | ||
Jelly (lubricating),, | ||
Liniment,, | ||
Liquid,, | ||
Lotion,, | ||
Lozenge,, | ||
Mouth wash,, | ||
Nasal drop,, | ||
Nasal spray,, | ||
Nsal gel,, | ||
Oil,, | ||
Oil (bath),, | ||
Ointment,, | ||
Ointment (modified),, | ||
Oral application,, | ||
Oral gel,, | ||
Oral liquid,, | ||
Oral liquid (powder for),, | ||
Oral spray,, | ||
Paint,, | ||
Paste,, | ||
Paste (oromucosal),, | ||
Pastille,, | ||
Pessary,, | ||
Pessary (modified release),, | ||
Powder,, | ||
Powder (oral),, | ||
Shampoo,, | ||
Soap,, | ||
Solution,, | ||
Solution (concentrated dialysis),, | ||
Solution (dialysis),, | ||
Solution (irrigation),, | ||
Solution (peritoneal dialysis),, | ||
Solution (powder for dialysis),, | ||
Solution (powder for),, | ||
Spray,, | ||
Spray (pressurised),, | ||
Stick,, | ||
Strip (diagnostic),, | ||
Suppository,, | ||
Suspension,, | ||
Swab,, | ||
Tablet,, | ||
Tablet (buccal),, | ||
Tablet (chewable),, | ||
Tablet (compound diagnostic),, | ||
Tablet (dispersible),, | ||
Tablet (effervescent),, | ||
Tablet (enteric coated),, | ||
Tablet (gelatine coated),, | ||
Tablet (modified release),, | ||
Tablet (oral disintegrating),, | ||
Tablet (soluble),, | ||
Tablet (sublingual),, | ||
Tincture,, | ||
Toothpaste,, | ||
Topical application,, | ||
Topical liquid,, | ||
Transdermal patch,, | ||
Wafer,, |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as fs from 'fs'; | ||
import csv from 'csv-parser'; | ||
import { ConfigItems } from './types'; | ||
|
||
export class ConfigItemsDataParser { | ||
public readonly path: fs.PathLike; | ||
|
||
private data: ConfigItems; | ||
|
||
private isParsed: boolean; | ||
private isBuilt: boolean; | ||
|
||
constructor(path: fs.PathLike) { | ||
this.path = path; | ||
|
||
this.isParsed = false; | ||
this.isBuilt = false; | ||
|
||
this.data = { | ||
forms: [], | ||
immediatePackaging: [], | ||
routes: [], | ||
}; | ||
} | ||
|
||
public async parseData(): Promise<ConfigItems> { | ||
if (this.isParsed) return this.data; | ||
|
||
this.data = { | ||
forms: [], | ||
immediatePackaging: [], | ||
routes: [], | ||
}; | ||
|
||
const parseColumn = (column: string) => { | ||
const REGEX = { | ||
CR_LF: /[\r\n]/g, | ||
BRACKETED_DESCRIPTION: / *\([^)]*\) */g, | ||
SPACE: / /g, | ||
}; | ||
|
||
return column | ||
.trim() | ||
.toLowerCase() | ||
.replace(REGEX.CR_LF, '') | ||
.replace(REGEX.BRACKETED_DESCRIPTION, '') | ||
.replace(REGEX.SPACE, '_') | ||
.split('_') | ||
.map((word, index) => | ||
index === 0 ? word : word[0].toUpperCase() + word.slice(1) | ||
) | ||
.join(''); | ||
}; | ||
|
||
// Read data stream. | ||
const stream = fs.createReadStream(this.path); | ||
await new Promise(resolve => { | ||
stream | ||
.pipe(csv()) | ||
.on('data', (row: string) => { | ||
Object.entries<string>(row).forEach( | ||
([column, value]: [string, string]) => { | ||
if (value) { | ||
const key = parseColumn(column); | ||
this.data[key].push(value); | ||
} | ||
} | ||
); | ||
}) | ||
.on('end', () => resolve(null)); | ||
}); | ||
|
||
this.isParsed = true; | ||
return this.data; | ||
} | ||
|
||
public getItems(): ConfigItems { | ||
return this.data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface ConfigItems { | ||
forms: string[]; | ||
immediatePackaging: string[]; | ||
routes: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters