npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mie-data-faker

v2.2.5

Published

A package for generating fake table data for the MIE database.

Downloads

22

Readme

Table of Contents

About

This repository is dedicated to distribution and maintenance of the mie-data-faker npm package

MIE-DataFaker is a program designed to generate fake table data. For example, it can genereate a fake appointment and insert it into the appointments table as well as inserting the related fields into the multi_resources_apt table.

The backbone of this project is the npm package @faker-js/faker.

Tables Currently Supported

  1. Patients
  2. Appointments
  3. Documents
  4. Encounters
  5. Translate

Getting Started

Install the npm package

npm install mie-data-faker

Add configuration and environment files

Option 1: Download the raw files manually from this repository

config.js

.env.example

Option 2: Copy them from node_modules

The npm package has config templates in node_modules/mie-data-faker/config-templates

Example - Creating Fake Patients

Setup Steps

NOTE: This demonstration will not write to DB, so the .env file is not needed.

  1. Create a new directory and install this package
mkdir example
cd example
npm install mie-data-faker
  1. Add config.js to your projects root directory
  1. Edit config.js

    3a. Set numberOfRecords to 10

    3b. Set table to patients

config.js

const config = {

// General Settings

    // number of records to generate
    numberOfRecords: 10,

    // which object type to generate
    table: 'patients',

    ...

}
  1. Create a file called main.js
  1. Add your imports

main.js

import { createPatients, dataInsert} from "mie-data-faker";
import fs from 'fs';
import config from './config.js';
  1. Generate some patients

main.js

const table = config.table;
const rowsToInsert = config.numberOfRecords;

const obj = {patients: []};

// Wrap loop and logic in async function to ensure all patients are built prior to writing to JSON
(async () => {
    
    for (let i = 0; i < rowsToInsert; i++) {

        const patient = JSON.stringify(createPatients());

        obj.patients.push(JSON.parse(patient));

    };

})().then(() => {

    console.log('Done');

    writeToJSON(table, JSON.stringify(obj));

}).catch((err) => {

    console.error(err);

});



function writeToJSON(table, obj) {

    const filePath = `${table}-results.json`;

    fs.writeFile(filePath, obj, function (err) {

        if (err) throw err;

        console.log('Saved!');

    });
}
  1. View your results JSON

patients-results.json

{
    "patients": [{
        "first_name": "Raymond",
        "last_name": "King",
        "middle_name": "Shaun",
        "title": "",
        "suffix": "PhD",
        "address1": "296 Ankunding Center",
        "county": "Bedfordshire",
        "city": "Claircester",
        "state": "HI",
        "zip_code": "00366",
        "home_phone": "298-579-9040 x559",
        "work_phone": "1-896-456-6938 x20650",
        "cell_phone": "1-875-711-4110",
        "fax_number": "349-209-1644 x80718",
        "alternate_phone": "441-240-4577",
        "email": "[email protected]",
        "sex": "M",
        "ssn": 852839207,
        "marital_status": "D",
        "spouse_name": "",
        "spouse_birthdate": "0000-00-00 00:00:00",
        "emergency_contact": "",
        "emergency_phone": "(366) 659-0520 x453",
        "employment_status": "E",
        "employer_name": "Hermiston, McKenzie and King",
        "employer_addr1": "3292 Rogahn Forges",
        "employer_county": "Cambridgeshire",
        "employer_city": "North Yesenia",
        "employer_state": "MD",
        "employer_zipcode": "91315",
        "employer_country": "US",
        "interface": "MIE DataFaker",
        "birth_date": "1960-08-20 11:52",
        "death_indicator": 1,
        "death_date": "1978-06-12 13:42",
        "active": 0,
        "is_patient": 1,
        "create_date": "2023-03-17 12:45"
    }, {
        "first_name": "Ginger",
        "last_name": "Torphy",
        "middle_name": "Jessica",
        ...
    }
}