Skip to content

Commit de1a6c8

Browse files
feat(medical): add a medical module (#3949)
Co-authored-by: ST-DDT <ST-DDT@gmx.de>
1 parent 43bc48e commit de1a6c8

22 files changed

Lines changed: 1353 additions & 0 deletions

File tree

docs/.vitepress/api-pages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const apiPages = [
2828
{ text: 'Internet', link: '/api/internet.html' },
2929
{ text: 'Location', link: '/api/location.html' },
3030
{ text: 'Lorem', link: '/api/lorem.html' },
31+
{ text: 'Medical', link: '/api/medical.html' },
3132
{ text: 'Music', link: '/api/music.html' },
3233
{ text: 'Number', link: '/api/number.html' },
3334
{ text: 'Person', link: '/api/person.html' },

scripts/generate-locales.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const definitionsTypes: DefinitionType = {
6363
internet: 'InternetDefinition',
6464
location: 'LocationDefinition',
6565
lorem: 'LoremDefinition',
66+
medical: 'MedicalDefinition',
6667
metadata: 'MetadataDefinition',
6768
music: 'MusicDefinition',
6869
person: 'PersonDefinition',

src/definitions/definitions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { HackerDefinition } from './hacker';
1212
import type { InternetDefinition } from './internet';
1313
import type { LocationDefinition } from './location';
1414
import type { LoremDefinition } from './lorem';
15+
import type { MedicalDefinition } from './medical';
1516
import type { MetadataDefinition } from './metadata';
1617
import type { MusicDefinition } from './music';
1718
import type { PersonDefinition } from './person';
@@ -47,6 +48,7 @@ export type LocaleDefinition = {
4748
internet?: InternetDefinition;
4849
location?: LocationDefinition;
4950
lorem?: LoremDefinition;
51+
medical?: MedicalDefinition;
5052
music?: MusicDefinition;
5153
person?: PersonDefinition;
5254
phone_number?: PhoneNumberDefinition;

src/definitions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type { HackerDefinition } from './hacker';
1616
export type { InternetDefinition } from './internet';
1717
export type { LocationDefinition } from './location';
1818
export type { LoremDefinition } from './lorem';
19+
export type { MedicalDefinition } from './medical';
1920
export type { MetadataDefinition } from './metadata';
2021
export type { MusicDefinition } from './music';
2122
export type { PersonDefinition, PersonEntryDefinition } from './person';

src/definitions/medical.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import type { LocaleEntry } from './definitions';
2+
3+
/**
4+
* The possible definitions related to medical and healthcare data.
5+
*/
6+
export type MedicalDefinition = LocaleEntry<{
7+
/**
8+
* Medical specialties, e.g. `'Cardiology'`.
9+
*/
10+
specialty: string[];
11+
12+
/**
13+
* Hospital departments, e.g. `'Emergency Department'`.
14+
*/
15+
department: string[];
16+
17+
/**
18+
* Plausible medical condition names (without diagnosis codes), e.g. `'Type 2 Diabetes'`.
19+
*/
20+
condition: string[];
21+
22+
/**
23+
* Symptoms, e.g. `'Shortness of Breath'`.
24+
*/
25+
symptom: string[];
26+
27+
/**
28+
* Medical procedures, e.g. `'Appendectomy'`.
29+
*/
30+
procedure: string[];
31+
32+
/**
33+
* Common allergens, e.g. `'Penicillin'`.
34+
*/
35+
allergen: string[];
36+
37+
/**
38+
* Blood types, e.g. `'O+'`.
39+
*/
40+
blood_type: string[];
41+
42+
/**
43+
* Fictitious, brand-style drug names, e.g. `'Zolpraxen'`.
44+
*/
45+
drug_name: string[];
46+
}>;

src/faker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ImageModule } from './modules/image';
1919
import { InternetModule } from './modules/internet';
2020
import { LocationModule } from './modules/location';
2121
import { LoremModule } from './modules/lorem';
22+
import { MedicalModule } from './modules/medical';
2223
import { MusicModule } from './modules/music';
2324
import { PersonModule } from './modules/person';
2425
import { PhoneModule } from './modules/phone';
@@ -73,6 +74,7 @@ export class Faker extends SimpleFaker {
7374
readonly internet: InternetModule = new InternetModule(this);
7475
readonly location: LocationModule = new LocationModule(this);
7576
readonly lorem: LoremModule = new LoremModule(this);
77+
readonly medical: MedicalModule = new MedicalModule(this);
7678
readonly music: MusicModule = new MusicModule(this);
7779
readonly person: PersonModule = new PersonModule(this);
7880
readonly phone: PhoneModule = new PhoneModule(this);

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type {
2020
LocaleEntry,
2121
LocationDefinition,
2222
LoremDefinition,
23+
MedicalDefinition,
2324
MetadataDefinition,
2425
MusicDefinition,
2526
PersonDefinition,
@@ -75,6 +76,7 @@ export { IPv4Network } from './modules/internet';
7576
export type { IPv4NetworkType, InternetModule } from './modules/internet';
7677
export type { LocationModule, SimpleLocationModule } from './modules/location';
7778
export type { LoremModule } from './modules/lorem';
79+
export type { MedicalModule } from './modules/medical';
7880
export type { MusicModule } from './modules/music';
7981
export type { NumberModule } from './modules/number';
8082
export { Sex } from './modules/person';

src/locales/en/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import hacker from './hacker';
1818
import internet from './internet';
1919
import location from './location';
2020
import lorem from './lorem';
21+
import medical from './medical';
2122
import metadata from './metadata';
2223
import music from './music';
2324
import person from './person';
@@ -49,6 +50,7 @@ const en: LocaleDefinition = {
4950
internet,
5051
location,
5152
lorem,
53+
medical,
5254
metadata,
5355
music,
5456
person,

src/locales/en/medical/allergen.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export default [
2+
'Adhesive',
3+
'Anesthesia',
4+
'Aspirin',
5+
'Bee Sting',
6+
'Celery',
7+
'Cockroaches',
8+
'Codeine',
9+
'Contrast Dye',
10+
'Corn',
11+
'Dust Mites',
12+
'Eggs',
13+
'Fish',
14+
'Fragrance',
15+
'Grass',
16+
'Ibuprofen',
17+
'Insect Bites',
18+
'Latex',
19+
'Lupin',
20+
'Milk',
21+
'Mold',
22+
'Morphine',
23+
'Mustard',
24+
'Nickel',
25+
'Peanuts',
26+
'Penicillin',
27+
'Pet Dander',
28+
'Pollen',
29+
'Ragweed',
30+
'Red Dye',
31+
'Sesame',
32+
'Shellfish',
33+
'Soy',
34+
'Sulfa Drugs',
35+
'Sulfites',
36+
'Tree Nuts',
37+
'Wheat',
38+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default ['A+', 'A-', 'AB+', 'AB-', 'B+', 'B-', 'O+', 'O-'];

0 commit comments

Comments
 (0)