JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

JavaScript

console.log(getSeederData());

function getSeederData() {
  const rawData = getRawData();
  const seederData = [];
  let sectionId = 1;

  Object.keys(rawData).forEach(key => {
    rawData[key].forEach(name => {
      seederData.push({
        name,
        sectionId,
        chapterId: +key,
      });
      sectionId++;
    });
  });

  return seederData;
}

function getRawData() {
  return {
    '1': [
      'Intestinal infectious diseases (A00-A09)',
      'Tuberculosis (A15-A19)',
      'Certain zoonotic bacterial diseases (A20-A28)',
      'Other bacterial diseases (A30-A49)',
      'Infections with a predominantly sexual mode of transmission (A50-A64)',
      'Other spirochetal diseases (A65-A69)',
      'Other diseases caused by chlamydiae (A70-A74)',
      'Rickettsioses (A75-A79)',
      'Viral and prion infections of the central nervous system (A80-A89)',
      'Arthropod-borne viral fevers and viral hemorrhagic fevers (A90-A99)',
      'Viral infections characterized by skin and mucous membrane lesions (B00-B09)',
      'Other human herpesviruses (B10)',
      'Viral hepatitis (B15-B19)',
      'Human immunodeficiency virus [HIV] disease (B20)',
      'Other viral diseases (B25-B34)',
      'Mycoses (B35-B49)',
      'Protozoal diseases (B50-B64)',
      'Helminthiases (B65-B83)',
      'Pediculosis, acariasis and other infestations (B85-B89)',
      'Sequelae of infectious and parasitic diseases (B90-B94)',
      'Bacterial and viral infectious agents (B95-B97)',
      'Other infectious diseases (B99)',
    ],
    '2': [
      'Malignant neoplasms of lip, oral cavity and pharynx (C00-C14)',
      'Malignant neoplasms of digestive organs (C15-C26)',
      'Malignant neoplasms of respiratory and intrathoracic organs (C30-C39)',
      'Malignant neoplasms of bone and articular cartilage (C40-C41)',
      'Melanoma and other malignant neoplasms of skin (C43-C44)',
      'Malignant neoplasms of mesothelial and soft tissue (C45-C49)',
      'Malignant...