faker-js / faker

Generate massive amounts of fake data in the browser and node.js
https://fakerjs.dev
Other
12.9k stars 919 forks source link

Add medical module #2309

Open zlock55 opened 1 year ago

zlock55 commented 1 year ago

Clear and concise description of the problem

Would you please add medical terms in the generated data space

Suggested solution

like chemical terms you've already built it

Alternative

No response

Additional context

No response

github-actions[bot] commented 1 year ago

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

ST-DDT commented 1 year ago

Sorry, I'm not exactly sure what you are referring to. Are you referring to chemicals (used in/being) medicine or do you want any chemicals even raw chemicals used in the production of medicine or just various names of medicines? Do you only need the names? What is your use case for that list? Is it okay to have fictional names that use the common combination strategies such as Carbondioxide?

mmorris8 commented 7 months ago

I brought this up in a meeting today. I'm working for a hospital group. I'm going to start the process of getting permission to work on something like this in my spare time and publish something. In the mean while I also need to learn the process of setting up a module.

As to items that would be in such a module, off the top of my head:

matthewmayer commented 7 months ago

You can take a look at https://dev.to/matthewmayer/leveling-up-your-custom-fake-data-with-fakerjs-3f7m for strategies on how to provide your own data when Faker doesn't have it built in.

mmorris8 commented 7 months ago

Thanks. I will look into that for sure.

matthewmayer commented 7 months ago

If you do create some useful arrays of data feel free to contribute them back here. That would definitely increase the chance of this getting implemented!

Typically we would have anywhere between 10 and 1000 entries per item, and avoid getting from copyrighted sources:

https://github.com/faker-js/faker/blob/next/CONTRIBUTING.md#sourcing-data-for-definitions

ST-DDT commented 7 months ago

In the mean while I also need to learn the process of setting up a module.

Step 1) Explain what you need (including potential data structures) and in which context you need them

Aka do you need only the abbreviation or the full title as well? Where would you put them? Is it standard for your field of work or just in your company. Is it for hospitals only or for other medical institutions as well? Which locales are you able to provide the data for?

Step 2) Get/Provide feedback

Step 3) Get upvotes/user interest -> get go ahead from from maintainers

Step 4) Implement, the easiest way might be copying the basics from the animal module.

mmorris8 commented 7 months ago

Hmm.. Degree codes are international in and of themselves. There's only a handful of them, less than 50 probably, and my db only has around 30.

Most medical specialties are in Latin, so in western countries this will remain the same - i.e. "Urology" is "Urology" whether you're speaking English, German, French, and so on. There are some that have colloquial names though.

Pharmaceuticals are tricky. Most have a trademarked brand name - e.g. Tylenol - and a generic chemical name - acetaminophen. For the purposes of faker I think we can stick to the later just to be on the safe side.

Avoiding copyrighted sources entirely will be a bit of a problem. Names of certain procedures might be copyrighted or even trademarked. I'm not sure. Faker's usage is well within fair use guidelines - but that never stopped lawyers before (Exceptions in law are more worthless than used toilet paper and serve only as profit margins for lawyers).

matthewmayer commented 7 months ago

For medicines there might be logic in using completely fictitious medicine brandnames so there's no confusing them with real medicines.

mmorris8 commented 7 months ago

Brand names are unnecessary in my opinion. Also, the chemical names have the advantage of not needing internationalization in the western languages as, again, they are all Latin.

matthewmayer commented 7 months ago

I'm just thinking if you had like a mockup of a fake prescription then it's probably not a good idea to have real medicines in there.

Like if you show ${faker.number.int({min:100, max:1000})}mg ${faker.health.medicine()}

If it is a real medicine like ibuprofen you might accidentally put in a dangerous-sounding dose.

If it's a fake medicine name like Zenaphase it won't matter.

In the same way as we try to avoid profanity in our words module.

mmorris8 commented 7 months ago

Writing a test for such is a use case as well. It's a two-edged sword. I see no point in writing a module to create fake names - we have the lorem module already.

ST-DDT commented 7 months ago

Like if you show ${faker.number.int({min:100, max:1000})}mg ${faker.health.medicine()}

That is possible, but the pestcription would be generated by our users and not in our code and I hope that our users are professional enough to understand test data as such. Random names have either nothing in common with medicin if list based or might result in even worse texts if random (e.g. 1000mg brainamin).

matthewmayer commented 7 months ago

I mean the project is called "Faker" 🤣 we generally try to create plausible looking, not real data.

But I get your point. Latin-sounding names can be easily made already with lorem.

We might need to warn people that you shouldn't take random medicines in the same way we warn them not to call phone numbers generated by faker.phone.number() (as they may be real).

mmorris8 commented 7 months ago

I'd hazard a guess that the main users of this will be code monkeys for hospital groups like me. We know better. And while we can just the lib as is to with workarounds (medical degree codes are 2 or 3 letters, medicine names are between 5 to 15 letters on average) it's a nice to have.

Anyway, I'll take a stab at an API. Note - on the lists below I recommend excluding items that are gender specific to prevent the distraction of having test code spit out nonsense like a male patient with a hysterectomy in their history.

Healthcare: Overall module name

That's a start. The existing finance module covers most of the rest of the testing I have to do.

ST-DDT commented 7 months ago

Thanks for the specific api suggestion list.

The existing finance module covers most of the rest of the testing I have to do.

Just for curiosity, which methods from the finance module do you use/plan to use?

thoroc commented 1 month ago

Just chiming in, but does faker-js not have the capability to create your own provider like the python equivalent has?

That would allow the community to create providers that are not tied up to the core faker-js project.

That being said, I guess one could extend locally and import that local version of faker.

import { FakerOptions, Faker as FakerJs } from '@faker-js/faker';
import { CustomModule } from './custom-module';

class Faker extends FakerJs {
  readonly customModule: CustomModule;

  constructor(options: FakerOptions) {
    super(options);
    this.customModule = new CustomModule(this);
  }
}

export default Faker;
matthewmayer commented 1 month ago

Just chiming in, but does faker-js not have the capability to create your own provider like the python equivalent has?

That would allow the community to create providers that are not tied up to the core faker-js project.

That being said, I guess one could extend locally and import that local version of faker.

import { FakerOptions, Faker as FakerJs } from '@faker-js/faker';
import { CustomModule } from './custom-module';

class Faker extends FakerJs {
  readonly customModule: CustomModule;

  constructor(options: FakerOptions) {
    super(options);
    this.customModule = new CustomModule(this);
  }
}

export default Faker;

this has been proposed at #704

it's easy enough to make a function which uses faker helper functions to add your own custom data, see https://dev.to/matthewmayer/leveling-up-your-custom-fake-data-with-fakerjs-3f7m )

thoroc commented 1 month ago

Thank you. I've missed that one. ;)