From 0c2f42c29c5be7d8c37ba04ec27468323a4e5437 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 14:38:46 -0300 Subject: [PATCH 01/11] feat: adding locale to medicine module, add es_AR and pt_BR language definitions and use es_AR definitions for all es locales. --- include/faker-cxx/medicine.h | 10 +- src/modules/medicine.cpp | 27 ++- src/modules/medicine_data.h | 377 +++++++++++++++++++++++++++++++- tests/modules/medicine_test.cpp | 54 ++++- 4 files changed, 443 insertions(+), 25 deletions(-) diff --git a/include/faker-cxx/medicine.h b/include/faker-cxx/medicine.h index 3929074fb..71d475d18 100644 --- a/include/faker-cxx/medicine.h +++ b/include/faker-cxx/medicine.h @@ -3,11 +3,13 @@ #include #include "faker-cxx/export.h" +#include "faker-cxx/types/locale.h" namespace faker::medicine { /** * @brief Returns a random medical condition. + * @param locale The locale. Defaults to `Locale::en_US`. * * @returns Medical condition. * @@ -15,10 +17,11 @@ namespace faker::medicine * faker::medicine::condition() // "AIDS" * @endcode */ -FAKER_CXX_EXPORT std::string_view condition(); +FAKER_CXX_EXPORT std::string_view condition(Locale locale=Locale::en_US); /** * @brief Returns a random medical test + * @param locale The locale. Defaults to `Locale::en_US`. * * @returns Medical test. * @@ -26,10 +29,11 @@ FAKER_CXX_EXPORT std::string_view condition(); * faker::medicine::medicalTest() // "pulmonary auscultation" * @endcode */ -FAKER_CXX_EXPORT std::string_view medicalTest(); +FAKER_CXX_EXPORT std::string_view medicalTest(Locale locale=Locale::en_US); /** * @brief Returns a random Medical specialty + * @param locale The locale. Defaults to `Locale::en_US`. * * @returns Medical specialty. * @@ -38,5 +42,5 @@ FAKER_CXX_EXPORT std::string_view medicalTest(); * @endcode */ -FAKER_CXX_EXPORT std::string_view specialty(); +FAKER_CXX_EXPORT std::string_view specialty(Locale locale=Locale::en_US); } diff --git a/src/modules/medicine.cpp b/src/modules/medicine.cpp index c20f83d2d..835a931c5 100644 --- a/src/modules/medicine.cpp +++ b/src/modules/medicine.cpp @@ -7,19 +7,34 @@ namespace faker::medicine { -std::string_view condition() +std::string_view condition(Locale locale) { - return helper::randomElement(medicalConditions); + auto localeLocal = locale; + if (medicineMapSpan.find(locale) == medicineMapSpan.end()) + { + localeLocal = Locale::en_US; + } + return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalConditions); } -std::string_view medicalTest() +std::string_view medicalTest(Locale locale) { - return helper::randomElement(medicalTests); + auto localeLocal = locale; + if (medicineMapSpan.find(locale) == medicineMapSpan.end()) + { + localeLocal = Locale::en_US; + } + return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalTests); } -std::string_view specialty() +std::string_view specialty(Locale locale) { - return helper::randomElement(specialties); + auto localeLocal = locale; + if (medicineMapSpan.find(locale) == medicineMapSpan.end()) + { + localeLocal = Locale::en_US; + } + return helper::randomElement((medicineMapSpan.at(localeLocal)).specialties); } } diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 3d9b4cfb6..2e5b2fb35 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -2,10 +2,21 @@ #include #include +#include +#include namespace faker::medicine { -const auto medicalConditions = std::to_array({ +struct MedicineDefinition +{ + std::span medicalConditions; + std::span medicalTests; + std::span specialties; + +}; + +//"en_US" +const auto enUSMedicalConditions = std::to_array({ "AIDS", "Anorexia Nervosa", "Arthritis Juvenile Rheumatoid", @@ -24,8 +35,8 @@ const auto medicalConditions = std::to_array({ "Diabetes Mellitus", "Down syndrome", "Elevated Blood Lead Level", - "Epilepsy", - "Failure to Thrive", + "Epilepsy", + "Failure to Thrive", "Fetal Alcohol Syndrome", "Gall Bladder Disease", "Gastro Esophageal Reflux Disease", @@ -67,7 +78,7 @@ const auto medicalConditions = std::to_array({ "Ulcers Stomach or Intestinal", }); -const auto medicalTests = std::to_array({ +const auto enUSMedicalTests = std::to_array({ "HEENT examination", "abdominal palpation", "amniocentesis", @@ -105,7 +116,7 @@ const auto medicalTests = std::to_array({ "vaginal examination", }); -const auto specialties = std::to_array({ +const auto enUSSpecialties = std::to_array({ "Accident and emergency medicine", "Allergist", "Anaesthetics", @@ -162,4 +173,360 @@ const auto specialties = std::to_array({ "Vascular surgery", "Venereology", }); + + +const MedicineDefinition enUSMedicineDefinition = {.medicalConditions = enUSMedicalConditions, + .medicalTests = enUSMedicalTests, + .specialties = enUSSpecialties}; + +//"es_AR" +const auto esARMedicalConditions = std::to_array({ + "SIDA", + "Anorexia nerviosa", + "Artritis Reumatoide Juvenil", + "Asma Moderada o Grave Persistente", + "Bronquiolitis", + "Bulimia", + "Cáncer", + "Enfermedades cardiorrespiratorias", + "Enfermedad celíaca", + "Parálisis cerebral", + "labio hendido o paladar hendido", + "Enfermedad de Crohn", + "Fibrosis quística", + "Depresión", + "Discapacidades del desarrollo sensorial o motora", + "Diabetes Mellitus", + "Síndrome de Down", + "Nivel elevado de plomo en sangre", + "Epilepsia", + "Síndrome de alcoholismo fetal", + "Enfermedad de la vesícula biliar", + "Enfermedad por reflujo gastroesofágico", + "Anormalidades gastrointestinales", + "Infección por VIH", + "Cardiopatía", + "Hepatitis", + "Hipertensión Crónica/Prehipertensión", + "Hipertensión inducida por el embarazo", + "Hipertiroidismo", + "hipoglucemia", + "Hipotiroidismo", + "Errores innatos del metabolismo", + "Enfermedad Inflamatoria Intestinal (EII)", + "Intolerancia a la lactosa", + "Grande para la edad gestacional", + "Enfermedad del hígado", + "Lupus eritematoso", + "Cirugía Mayor Quemaduras o Traumatismos", + "Síndromes de malabsorción", + "Meningitis", + "Esclerosis múltiple", + "Distrofia muscular", + "Síndrome de abstinencia neonatal", + "Defecto del tubo neural (espina bífida)", + "Enfermedades por deficiencia de nutrientes", + "Pancreatitis", + "Infección parasitaria", + "La enfermedad de Parkinson", + "Neumonía", + "prediabetes", + "Enfermedad renal", + "Anemia falciforme", + "Enterocolitis y síndrome del intestino delgado", + "Pequeño para la edad gestacional (PEG)", + "Talasemia mayor", + "Tuberculosis", + "Colitis ulcerosa", + "Úlceras Estómago o Intestinal" + +}); + +const auto esARMedicalTests = std::to_array({ + "examen HEENT", + "palpación abdominal", + "amniocentesis", + "balistocardiograma", + "cápsula endoscópica", + "auscultación cardíaca", + "coloscopía", + "colposcopía", + "cateterismo coronario", + "cystoscopía", + "examinación rectal digital", + "ecocardiografía", + "electrocardiográma", + "electroencefalográma", + "electromiografía", + "colangiopancreatografía retrógrada endoscópica", + "estudio de motilidad esofágica", + "monitorización del pH esofágico", + "esofagogastroduodenoscopia", + "prueba de audición", + "histeroscopia", + "laparoscopia", + "laringoscopia", + "biopsia de hígado", + "mamografía", + "examen neurológico", + "pruebas neuropsicológicas", + "polisomnografía", + "evaluación psiquiátrica", + "auscultación pulmonar", + "pletismografía pulmonar", + "biopsia de piel", + "toracocentesis", + "pruebas urodinámicas", + "examen vaginal", +}); + +const auto esARSpecialties = std::to_array({ + "Medicina de emergencia y accidentes", + "Alergias", + "Estética", + "Cardiología", + "Psiquatría infantil", + "Biología Clínica", + "Química Clínica", + "Microbiología Clínica", + "Neurofisiología Clínica", + "Cirugía Creaneofacial", + "Dermatología", + "Endocrinología", + "Medicina General y Familiar", + "Cirugía Gastroenterológica", + "Gastroenterolgía", + "Práctica General", + "Cirugía General", + "Geriátrico", + "Hematología", + "Immunología", + "Enfermedades Infecciosas", + "Medicina Interna", + "Medicinal de Laboratorio", + "Nefrología", + "Neurología", + "Neurosiquiatría", + "Neurocirugía", + "Medicina Nuclear", + "Ginecología y Obstetricia", + "Medicina Ocupacional", + "Oncología", + "Oftalmología", + "Cirugía Oral y maxilofacial", + "Ortopedía", + "Otorrinolaringología", + "Cirugía Pediátrica", + "Pediatría", + "Patología", + "Farmacología", + "Medicina física y de rehabilitación", + "Cirugía Plástica", + "Cirugía podológica", + "Medicina Preventiva", + "Psiquiatráa", + "Salud Pública", + "Oncología Radioterápica", + "Radiología", + "Medicina Respiratoría", + "Reumatología", + "Estomatología", + "Cirugía Toráxica", + "Medicina Tropical", + "Urología", + "Cirugía Vascular", + "Venereología", +}); + +const MedicineDefinition esARMedicineDefinition = {.medicalConditions = esARMedicalConditions, + .medicalTests = esARMedicalTests, + .specialties = esARSpecialties}; +//"pt_BR" +const auto ptBRMedicalConditions = std::to_array({ + "AIDS", + "Anorexia nervosa", + "Artrite Reumatóide Juvenil", + "Asma Persistente Moderada ou Grave", + "bronquiolite", + "Bulimia", + "Câncer", + "Doenças cardiorrespiratórias", + "Doença celíaca", + "Paralisia cerebral", + "lábio leporino ou fenda palatina", + "Doença de Crohn", + "Fibrose cística", + "Depressão", + "Deficiências de desenvolvimento sensorial ou motor", + "Diabetes Mellitus", + "Síndrome de Down", + "Nível elevado de chumbo no sangue", + "Epilepsia", + "Síndrome alcoólica fetal", + "Doença da vesícula biliar", + "Doença do refluxo gastroesofágico", + "Anormalidades gastrointestinais", + "Infecção pelo HIV", + "Doença cardíaca", + "Hepatite", + "Hipertensão/Pré-hipertensão Crônica", + "Hipertensão induzida pela gravidez", + "Hipertireoidismo", + "hipoglicemia", + "Hipotireoidismo", + "Erros inatos do metabolismo", + "Doença Inflamatória Intestinal (DII)", + "Intolerância à lactose", + "Grande para a idade gestacional", + "Doença hepática", + "Lúpus eritematoso", + "Cirurgia de Grande Queimadura ou Trauma", + "Síndromes de má absorção", + "Meningite", + "Esclerose múltipla", + "Distrofia muscular", + "Síndrome de abstinência neonatal", + "Defeito do tubo neural (espinha bífida)" + "Doenças por deficiência de nutrientes", + "Pancreatite", + "Infecção parasitária", + "Doença de Parkinson" + "Pneumonia", + "pré-diabetes", + "Doença renal", + "Anemia falciforme", + "Enterocolite e síndrome do intestino delgado", + "Pequeno para a idade gestacional (PIG)", + "Talassemia maior", + "Tuberculose", + "Colite ulcerativa", + "Úlceras estomacais ou intestinais" +}); + +const auto ptBRMedicalTests = std::to_array({ + "exame HEENT", + "palpação abdominal", + "amniocentese", + "balistocardiograma", + "endoscopia por cápsula", + "ausculta cardíaca", + "coloscopia", + "colposcopia", + "cateterismo coronário", + "cistoscopia", + "exame retal digital", + "ecocardiografia", + "eletrocardiograma", + "eletroencefalograma", + "eletromiografia", + "colangiopancreatografia retrógrada endoscópica", + "estudo da motilidade esofágica", + "monitoramento do pH esofágico", + "esofagogastroduodenoscopia", + "teste de audição", + "histeroscopia", + "laparoscopia", + "laringoscopia", + "biópsia hepática", + "mamografia", + "exame neurológico", + "testes neuropsicológicos", + "polissonografia", + "avaliação psiquiátrica", + "ausculta pulmonar", + "pletismografia pulmonar", + "biópsia de pele", + "toracocentese", + "testes urodinâmicos", + "exame vaginal" +}); + +const auto ptBRSpecialties = std::to_array({ + "Medicina de emergência e acidentes", + "Alergias", + "Estética", + "Cardiologia", + "Psiquiatria infantil", + "Biologia Clínica", + "Química Clínica", + "Microbiologia Clínica", + "Neurofisiologia Clínica", + "Cirurgia Creneofacial", + "Dermatologia", + "Endocrinologia", + "Medicina Geral e Familiar", + "Cirurgia Gastroenterológica", + "Gastroenterologia", + "Clínica Geral", + "Cirurgia Geral", + "Geriátrica", + "Hematologia", + "Imunologia", + "Doenças Infecciosas", + "Medicina interna", + "Medicina Laboratorial", + "Nefrologia", + "Neurologia", + "Neuropsiquiatria", + "Neurocirurgia", + "Medicina Nuclear", + "Ginecologia e Obstetrícia", + "Medicina Ocupacional", + "Oncologia", + "Oftalmologia", + "Cirurgia Oral e Maxilofacial", + "Ortopedia", + "Otorrinolaringologia", + "Cirurgia Pediátrica", + "Pediatria", + "Patologia", + "Farmacologia", + "Medicina Física e de Reabilitação", + "Cirurgia plástica", + "Cirurgia Podiátrica", + "Medicina preventiva", + "Psiquiatria", + "Saúde pública", + "Oncologia de Radiação", + "Radiologia", + "Medicina Respiratória", + "Reumatologia", + "Estomatologia", + "Cirurgia Toráxica", + "Medicina Tropical", + "Urologia", + "Cirurgia Vascular", + "Venereologia", +}); + +const MedicineDefinition ptBRMedicineDefinition = {.medicalConditions = ptBRMedicalConditions, + .medicalTests = ptBRMedicalTests, + .specialties = ptBRSpecialties}; + +const std::map medicineMapSpan({ + {faker::Locale::en_US, {enUSMedicineDefinition}}, + {faker::Locale::pt_BR, {ptBRMedicineDefinition}}, + {faker::Locale::es_AR, {esARMedicineDefinition}}, + {faker::Locale::es_BO, {esARMedicineDefinition}}, + {faker::Locale::es_CL, {esARMedicineDefinition}}, + {faker::Locale::es_CO, {esARMedicineDefinition}}, + {faker::Locale::es_CR, {esARMedicineDefinition}}, + {faker::Locale::es_DO, {esARMedicineDefinition}}, + {faker::Locale::es_EC, {esARMedicineDefinition}}, + {faker::Locale::es_ES, {esARMedicineDefinition}}, + {faker::Locale::es_GT, {esARMedicineDefinition}}, + {faker::Locale::es_HN, {esARMedicineDefinition}}, + {faker::Locale::es_MX, {esARMedicineDefinition}}, + {faker::Locale::es_NI, {esARMedicineDefinition}}, + {faker::Locale::es_PA, {esARMedicineDefinition}}, + {faker::Locale::es_PE, {esARMedicineDefinition}}, + {faker::Locale::es_PR, {esARMedicineDefinition}}, + {faker::Locale::es_PY, {esARMedicineDefinition}}, + {faker::Locale::es_US, {esARMedicineDefinition}}, + {faker::Locale::es_SV, {esARMedicineDefinition}}, + {faker::Locale::es_UY, {esARMedicineDefinition}}, + {faker::Locale::es_VE, {esARMedicineDefinition}}, +}); + } + diff --git a/tests/modules/medicine_test.cpp b/tests/modules/medicine_test.cpp index df3e9026e..bd033d12d 100644 --- a/tests/modules/medicine_test.cpp +++ b/tests/modules/medicine_test.cpp @@ -6,36 +6,68 @@ #include "gtest/gtest.h" #include "medicine_data.h" +#include "locale.h" using namespace ::testing; +using namespace faker; using namespace faker::medicine; -class MedicineTest : public Test +namespace +{ + +const struct MedicineDefinition& getMedicineMapDefinition(Locale locale) +{ + if (medicineMapSpan.find(locale) == medicineMapSpan.end()) + { + return medicineMapSpan.at(Locale::en_US); + } + else + { + return medicineMapSpan.at(locale); + } +} +} +class MedicineTestLocale : public TestWithParam { public: }; -TEST_F(MedicineTest, shouldGenerateMedicalCondition) + +TEST_P(MedicineTestLocale, shouldGenerateMedicalConditionLocale) { - const auto generatedMedicalCondition = condition(); + auto extra = GetParam(); + auto generatedMedicalCondition = condition(extra); + auto medicalDefinition = getMedicineMapDefinition(extra); - ASSERT_TRUE(std::ranges::any_of(medicalConditions, - [generatedMedicalCondition](const std::string_view& medicalCondition) + ASSERT_TRUE(std::ranges::any_of(medicalDefinition.medicalConditions, [generatedMedicalCondition](const std::string_view& medicalCondition) { return medicalCondition == generatedMedicalCondition; })); } -TEST_F(MedicineTest, shouldGenerateMedicalTest) + +TEST_P(MedicineTestLocale, shouldGenerateMedicalTestLocale) { - const auto generatedMedicalTest = medicalTest(); + auto extra = GetParam(); + + const auto generatedMedicalTest = medicalTest(extra); + + auto medicalDefinition = getMedicineMapDefinition(extra); - ASSERT_TRUE(std::ranges::any_of(medicalTests, [generatedMedicalTest](const std::string_view& medicalTest) + ASSERT_TRUE(std::ranges::any_of(medicalDefinition.medicalTests, [generatedMedicalTest](const std::string_view& medicalTest) { return medicalTest == generatedMedicalTest; })); } -TEST_F(MedicineTest, shouldGenerateSpecialty) +TEST_P(MedicineTestLocale, shouldGenerateSpecialtyLocale) { - const auto generatedSpecialty = specialty(); + auto extra = GetParam(); - ASSERT_TRUE(std::ranges::any_of(specialties, [generatedSpecialty](const std::string_view& specialty) + const auto generatedSpecialty = specialty(extra); + + auto medicalDefinition = getMedicineMapDefinition(extra); + + ASSERT_TRUE(std::ranges::any_of(medicalDefinition.specialties, [generatedSpecialty](const std::string_view& specialty) { return specialty == generatedSpecialty; })); } + + +INSTANTIATE_TEST_SUITE_P(testMedicineByLocale, MedicineTestLocale, ValuesIn(locales), + [](const TestParamInfo& paramInfo) { return toString(paramInfo.param); }); \ No newline at end of file From ceb046135c7eb89145fdd3488319ec2ecced88dd Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 14:50:45 -0300 Subject: [PATCH 02/11] fix: formatting --- include/faker-cxx/medicine.h | 6 ++--- src/modules/medicine.cpp | 3 +++ src/modules/medicine_data.h | 52 ++++++++++++------------------------ 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/include/faker-cxx/medicine.h b/include/faker-cxx/medicine.h index 71d475d18..3cacda320 100644 --- a/include/faker-cxx/medicine.h +++ b/include/faker-cxx/medicine.h @@ -17,7 +17,7 @@ namespace faker::medicine * faker::medicine::condition() // "AIDS" * @endcode */ -FAKER_CXX_EXPORT std::string_view condition(Locale locale=Locale::en_US); +FAKER_CXX_EXPORT std::string_view condition(Locale locale = Locale::en_US); /** * @brief Returns a random medical test @@ -29,7 +29,7 @@ FAKER_CXX_EXPORT std::string_view condition(Locale locale=Locale::en_US); * faker::medicine::medicalTest() // "pulmonary auscultation" * @endcode */ -FAKER_CXX_EXPORT std::string_view medicalTest(Locale locale=Locale::en_US); +FAKER_CXX_EXPORT std::string_view medicalTest(Locale locale = Locale::en_US); /** * @brief Returns a random Medical specialty @@ -42,5 +42,5 @@ FAKER_CXX_EXPORT std::string_view medicalTest(Locale locale=Locale::en_US); * @endcode */ -FAKER_CXX_EXPORT std::string_view specialty(Locale locale=Locale::en_US); +FAKER_CXX_EXPORT std::string_view specialty(Locale locale = Locale::en_US); } diff --git a/src/modules/medicine.cpp b/src/modules/medicine.cpp index 835a931c5..109af36b5 100644 --- a/src/modules/medicine.cpp +++ b/src/modules/medicine.cpp @@ -14,6 +14,7 @@ std::string_view condition(Locale locale) { localeLocal = Locale::en_US; } + return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalConditions); } @@ -24,6 +25,7 @@ std::string_view medicalTest(Locale locale) { localeLocal = Locale::en_US; } + return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalTests); } @@ -34,6 +36,7 @@ std::string_view specialty(Locale locale) { localeLocal = Locale::en_US; } + return helper::randomElement((medicineMapSpan.at(localeLocal)).specialties); } diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 2e5b2fb35..181e3a22a 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -11,8 +11,7 @@ struct MedicineDefinition { std::span medicalConditions; std::span medicalTests; - std::span specialties; - + std::span specialties; }; //"en_US" @@ -35,7 +34,7 @@ const auto enUSMedicalConditions = std::to_array({ "Diabetes Mellitus", "Down syndrome", "Elevated Blood Lead Level", - "Epilepsy", + "Epilepsy", "Failure to Thrive", "Fetal Alcohol Syndrome", "Gall Bladder Disease", @@ -175,9 +174,8 @@ const auto enUSSpecialties = std::to_array({ }); -const MedicineDefinition enUSMedicineDefinition = {.medicalConditions = enUSMedicalConditions, - .medicalTests = enUSMedicalTests, - .specialties = enUSSpecialties}; +const MedicineDefinition enUSMedicineDefinition = { + .medicalConditions = enUSMedicalConditions,.medicalTests = enUSMedicalTests,.specialties = enUSSpecialties}; //"es_AR" const auto esARMedicalConditions = std::to_array({ @@ -238,8 +236,7 @@ const auto esARMedicalConditions = std::to_array({ "Talasemia mayor", "Tuberculosis", "Colitis ulcerosa", - "Úlceras Estómago o Intestinal" - + "Úlceras Estómago o Intestinal", }); const auto esARMedicalTests = std::to_array({ @@ -338,9 +335,9 @@ const auto esARSpecialties = std::to_array({ "Venereología", }); -const MedicineDefinition esARMedicineDefinition = {.medicalConditions = esARMedicalConditions, - .medicalTests = esARMedicalTests, - .specialties = esARSpecialties}; +const MedicineDefinition esARMedicineDefinition = { + .medicalConditions = esARMedicalConditions,.medicalTests = esARMedicalTests,.specialties = esARSpecialties}; + //"pt_BR" const auto ptBRMedicalConditions = std::to_array({ "AIDS", @@ -499,32 +496,17 @@ const auto ptBRSpecialties = std::to_array({ "Venereologia", }); -const MedicineDefinition ptBRMedicineDefinition = {.medicalConditions = ptBRMedicalConditions, - .medicalTests = ptBRMedicalTests, - .specialties = ptBRSpecialties}; +const MedicineDefinition ptBRMedicineDefinition = { + .medicalConditions = ptBRMedicalConditions,.medicalTests = ptBRMedicalTests,.specialties = ptBRSpecialties}; const std::map medicineMapSpan({ - {faker::Locale::en_US, {enUSMedicineDefinition}}, - {faker::Locale::pt_BR, {ptBRMedicineDefinition}}, - {faker::Locale::es_AR, {esARMedicineDefinition}}, - {faker::Locale::es_BO, {esARMedicineDefinition}}, - {faker::Locale::es_CL, {esARMedicineDefinition}}, - {faker::Locale::es_CO, {esARMedicineDefinition}}, - {faker::Locale::es_CR, {esARMedicineDefinition}}, - {faker::Locale::es_DO, {esARMedicineDefinition}}, - {faker::Locale::es_EC, {esARMedicineDefinition}}, - {faker::Locale::es_ES, {esARMedicineDefinition}}, - {faker::Locale::es_GT, {esARMedicineDefinition}}, - {faker::Locale::es_HN, {esARMedicineDefinition}}, - {faker::Locale::es_MX, {esARMedicineDefinition}}, - {faker::Locale::es_NI, {esARMedicineDefinition}}, - {faker::Locale::es_PA, {esARMedicineDefinition}}, - {faker::Locale::es_PE, {esARMedicineDefinition}}, - {faker::Locale::es_PR, {esARMedicineDefinition}}, - {faker::Locale::es_PY, {esARMedicineDefinition}}, - {faker::Locale::es_US, {esARMedicineDefinition}}, - {faker::Locale::es_SV, {esARMedicineDefinition}}, - {faker::Locale::es_UY, {esARMedicineDefinition}}, + {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}},{faker::Locale::es_AR, {esARMedicineDefinition}}, + {faker::Locale::es_BO, {esARMedicineDefinition}},{faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, + {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}},{faker::Locale::es_EC, {esARMedicineDefinition}}, + {faker::Locale::es_ES, {esARMedicineDefinition}},{faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, + {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}},{faker::Locale::es_PA, {esARMedicineDefinition}}, + {faker::Locale::es_PE, {esARMedicineDefinition}},{faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, + {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}},{faker::Locale::es_UY, {esARMedicineDefinition}}, {faker::Locale::es_VE, {esARMedicineDefinition}}, }); From 94864f630c2cecae5b49b248041e2e75f803f038 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:02:16 -0300 Subject: [PATCH 03/11] fix: formatting --- src/modules/medicine_data.h | 210 ++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 104 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 181e3a22a..08fa3d81e 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -197,7 +197,7 @@ const auto esARMedicalConditions = std::to_array({ "Diabetes Mellitus", "Síndrome de Down", "Nivel elevado de plomo en sangre", - "Epilepsia", + "Epilepsia", "Síndrome de alcoholismo fetal", "Enfermedad de la vesícula biliar", "Enfermedad por reflujo gastroesofágico", @@ -339,103 +339,102 @@ const MedicineDefinition esARMedicineDefinition = { .medicalConditions = esARMedicalConditions,.medicalTests = esARMedicalTests,.specialties = esARSpecialties}; //"pt_BR" -const auto ptBRMedicalConditions = std::to_array({ - "AIDS", - "Anorexia nervosa", - "Artrite Reumatóide Juvenil", - "Asma Persistente Moderada ou Grave", - "bronquiolite", - "Bulimia", - "Câncer", - "Doenças cardiorrespiratórias", - "Doença celíaca", - "Paralisia cerebral", - "lábio leporino ou fenda palatina", - "Doença de Crohn", - "Fibrose cística", - "Depressão", - "Deficiências de desenvolvimento sensorial ou motor", - "Diabetes Mellitus", - "Síndrome de Down", - "Nível elevado de chumbo no sangue", - "Epilepsia", - "Síndrome alcoólica fetal", - "Doença da vesícula biliar", - "Doença do refluxo gastroesofágico", - "Anormalidades gastrointestinais", - "Infecção pelo HIV", - "Doença cardíaca", - "Hepatite", - "Hipertensão/Pré-hipertensão Crônica", - "Hipertensão induzida pela gravidez", - "Hipertireoidismo", - "hipoglicemia", - "Hipotireoidismo", - "Erros inatos do metabolismo", - "Doença Inflamatória Intestinal (DII)", - "Intolerância à lactose", - "Grande para a idade gestacional", - "Doença hepática", - "Lúpus eritematoso", - "Cirurgia de Grande Queimadura ou Trauma", - "Síndromes de má absorção", - "Meningite", - "Esclerose múltipla", - "Distrofia muscular", - "Síndrome de abstinência neonatal", - "Defeito do tubo neural (espinha bífida)" - "Doenças por deficiência de nutrientes", - "Pancreatite", - "Infecção parasitária", - "Doença de Parkinson" - "Pneumonia", - "pré-diabetes", - "Doença renal", - "Anemia falciforme", - "Enterocolite e síndrome do intestino delgado", - "Pequeno para a idade gestacional (PIG)", - "Talassemia maior", - "Tuberculose", - "Colite ulcerativa", - "Úlceras estomacais ou intestinais" +const auto ptBRMedicalConditions = + std::to_array({"AIDS", + "Anorexia nervosa", + "Artrite Reumatóide Juvenil", + "Asma Persistente Moderada ou Grave", + "bronquiolite", + "Bulimia", + "Câncer", + "Doenças cardiorrespiratórias", + "Doença celíaca", + "Paralisia cerebral", + "lábio leporino ou fenda palatina", + "Doença de Crohn", + "Fibrose cística", + "Depressão", + "Deficiências de desenvolvimento sensorial ou motor", + "Diabetes Mellitus", + "Síndrome de Down", + "Nível elevado de chumbo no sangue", + "Epilepsia", + "Síndrome alcoólica fetal", + "Doença da vesícula biliar", + "Doença do refluxo gastroesofágico", + "Anormalidades gastrointestinais", + "Infecção pelo HIV", + "Doença cardíaca", + "Hepatite", + "Hipertensão/Pré-hipertensão Crônica", + "Hipertensão induzida pela gravidez", + "Hipertireoidismo", + "hipoglicemia", + "Hipotireoidismo", + "Erros inatos do metabolismo", + "Doença Inflamatória Intestinal (DII)", + "Intolerância à lactose", + "Grande para a idade gestacional", + "Doença hepática", + "Lúpus eritematoso", + "Cirurgia de Grande Queimadura ou Trauma", + "Síndromes de má absorção", + "Meningite", + "Esclerose múltipla", + "Distrofia muscular", + "Síndrome de abstinência neonatal", + "Defeito do tubo neural (espinha bífida)" + "Doenças por deficiência de nutrientes", + "Pancreatite", + "Infecção parasitária", + "Doença de Parkinson" + "Pneumonia", + "pré-diabetes", + "Doença renal", + "Anemia falciforme", + "Enterocolite e síndrome do intestino delgado", + "Pequeno para a idade gestacional (PIG)", + "Talassemia maior", + "Tuberculose", + "Colite ulcerativa", + "Úlceras estomacais ou intestinais" }); -const auto ptBRMedicalTests = std::to_array({ - "exame HEENT", - "palpação abdominal", - "amniocentese", - "balistocardiograma", - "endoscopia por cápsula", - "ausculta cardíaca", - "coloscopia", - "colposcopia", - "cateterismo coronário", - "cistoscopia", - "exame retal digital", - "ecocardiografia", - "eletrocardiograma", - "eletroencefalograma", - "eletromiografia", - "colangiopancreatografia retrógrada endoscópica", - "estudo da motilidade esofágica", - "monitoramento do pH esofágico", - "esofagogastroduodenoscopia", - "teste de audição", - "histeroscopia", - "laparoscopia", - "laringoscopia", - "biópsia hepática", - "mamografia", - "exame neurológico", - "testes neuropsicológicos", - "polissonografia", - "avaliação psiquiátrica", - "ausculta pulmonar", - "pletismografia pulmonar", - "biópsia de pele", - "toracocentese", - "testes urodinâmicos", - "exame vaginal" +const auto ptBRMedicalTests = std::to_array({ "exame HEENT", + "palpação abdominal", + "amniocentese", + "balistocardiograma", + "endoscopia por cápsula", + "ausculta cardíaca", + "coloscopia", + "colposcopia", + "cateterismo coronário", + "cistoscopia", + "exame retal digital", + "ecocardiografia", + "eletrocardiograma", + "eletroencefalograma", + "eletromiografia", + "colangiopancreatografia retrógrada endoscópica", + "estudo da motilidade esofágica", + "monitoramento do pH esofágico", + "esofagogastroduodenoscopia", + "teste de audição", + "histeroscopia", + "laparoscopia", + "laringoscopia", + "biópsia hepática", + "mamografia", + "exame neurológico", + "testes neuropsicológicos", + "polissonografia", + "avaliação psiquiátrica", + "ausculta pulmonar", + "pletismografia pulmonar", + "biópsia de pele", + "toracocentese", + "testes urodinâmicos", + "exame vaginal" }); const auto ptBRSpecialties = std::to_array({ @@ -500,14 +499,17 @@ const MedicineDefinition ptBRMedicineDefinition = { .medicalConditions = ptBRMedicalConditions,.medicalTests = ptBRMedicalTests,.specialties = ptBRSpecialties}; const std::map medicineMapSpan({ - {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}},{faker::Locale::es_AR, {esARMedicineDefinition}}, - {faker::Locale::es_BO, {esARMedicineDefinition}},{faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, - {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}},{faker::Locale::es_EC, {esARMedicineDefinition}}, - {faker::Locale::es_ES, {esARMedicineDefinition}},{faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, - {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}},{faker::Locale::es_PA, {esARMedicineDefinition}}, - {faker::Locale::es_PE, {esARMedicineDefinition}},{faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, - {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}},{faker::Locale::es_UY, {esARMedicineDefinition}}, - {faker::Locale::es_VE, {esARMedicineDefinition}}, + {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}}, + {faker::Locale::es_AR, {esARMedicineDefinition}},{faker::Locale::es_BO, {esARMedicineDefinition}}, + {faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, + {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}}, + {faker::Locale::es_EC, {esARMedicineDefinition}},{faker::Locale::es_ES, {esARMedicineDefinition}}, + {faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, + {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}}, + {faker::Locale::es_PA, {esARMedicineDefinition}},{faker::Locale::es_PE, {esARMedicineDefinition}}, + {faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, + {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}}, + {faker::Locale::es_UY, {esARMedicineDefinition}},{faker::Locale::es_VE, {esARMedicineDefinition}}, }); } From 2cda1a45969edca06591f03c3260d21b3b1345e6 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:06:15 -0300 Subject: [PATCH 04/11] fix: formatting --- src/modules/medicine_data.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 08fa3d81e..5c3437ea5 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -11,7 +11,7 @@ struct MedicineDefinition { std::span medicalConditions; std::span medicalTests; - std::span specialties; + std::span specialties; }; //"en_US" @@ -35,7 +35,7 @@ const auto enUSMedicalConditions = std::to_array({ "Down syndrome", "Elevated Blood Lead Level", "Epilepsy", - "Failure to Thrive", + "Failure to Thrive", "Fetal Alcohol Syndrome", "Gall Bladder Disease", "Gastro Esophageal Reflux Disease", @@ -175,7 +175,7 @@ const auto enUSSpecialties = std::to_array({ const MedicineDefinition enUSMedicineDefinition = { - .medicalConditions = enUSMedicalConditions,.medicalTests = enUSMedicalTests,.specialties = enUSSpecialties}; + .medicalConditions = enUSMedicalConditions, .medicalTests = enUSMedicalTests, .specialties = enUSSpecialties}; //"es_AR" const auto esARMedicalConditions = std::to_array({ @@ -336,11 +336,11 @@ const auto esARSpecialties = std::to_array({ }); const MedicineDefinition esARMedicineDefinition = { - .medicalConditions = esARMedicalConditions,.medicalTests = esARMedicalTests,.specialties = esARSpecialties}; + .medicalConditions = esARMedicalConditions, .medicalTests = esARMedicalTests, .specialties = esARSpecialties}; //"pt_BR" const auto ptBRMedicalConditions = - std::to_array({"AIDS", + std::to_array({"AIDS", "Anorexia nervosa", "Artrite Reumatóide Juvenil", "Asma Persistente Moderada ou Grave", @@ -397,8 +397,7 @@ const auto ptBRMedicalConditions = "Talassemia maior", "Tuberculose", "Colite ulcerativa", - "Úlceras estomacais ou intestinais" -}); + "Úlceras estomacais ou intestinais"}); const auto ptBRMedicalTests = std::to_array({ "exame HEENT", "palpação abdominal", @@ -434,8 +433,7 @@ const auto ptBRMedicalTests = std::to_array({ "exame HEENT", "biópsia de pele", "toracocentese", "testes urodinâmicos", - "exame vaginal" -}); + "exame vaginal"}); const auto ptBRSpecialties = std::to_array({ "Medicina de emergência e acidentes", @@ -496,7 +494,7 @@ const auto ptBRSpecialties = std::to_array({ }); const MedicineDefinition ptBRMedicineDefinition = { - .medicalConditions = ptBRMedicalConditions,.medicalTests = ptBRMedicalTests,.specialties = ptBRSpecialties}; + .medicalConditions = ptBRMedicalConditions, .medicalTests = ptBRMedicalTests, .specialties = ptBRSpecialties}; const std::map medicineMapSpan({ {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}}, From 0c3f5af6824c99f22d3a8bc90d348683f9747c1e Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:14:08 -0300 Subject: [PATCH 05/11] formatting --- src/modules/medicine_data.h | 161 +++++++++++++----------------------- 1 file changed, 56 insertions(+), 105 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 5c3437ea5..eea706df7 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -173,7 +173,6 @@ const auto enUSSpecialties = std::to_array({ "Venereology", }); - const MedicineDefinition enUSMedicineDefinition = { .medicalConditions = enUSMedicalConditions, .medicalTests = enUSMedicalTests, .specialties = enUSSpecialties}; @@ -339,101 +338,61 @@ const MedicineDefinition esARMedicineDefinition = { .medicalConditions = esARMedicalConditions, .medicalTests = esARMedicalTests, .specialties = esARSpecialties}; //"pt_BR" -const auto ptBRMedicalConditions = +const auto ptBRMedicalConditions = std::to_array({"AIDS", - "Anorexia nervosa", - "Artrite Reumatóide Juvenil", - "Asma Persistente Moderada ou Grave", - "bronquiolite", - "Bulimia", - "Câncer", - "Doenças cardiorrespiratórias", - "Doença celíaca", - "Paralisia cerebral", - "lábio leporino ou fenda palatina", - "Doença de Crohn", - "Fibrose cística", - "Depressão", - "Deficiências de desenvolvimento sensorial ou motor", - "Diabetes Mellitus", - "Síndrome de Down", - "Nível elevado de chumbo no sangue", - "Epilepsia", - "Síndrome alcoólica fetal", - "Doença da vesícula biliar", - "Doença do refluxo gastroesofágico", - "Anormalidades gastrointestinais", - "Infecção pelo HIV", - "Doença cardíaca", - "Hepatite", - "Hipertensão/Pré-hipertensão Crônica", - "Hipertensão induzida pela gravidez", - "Hipertireoidismo", - "hipoglicemia", - "Hipotireoidismo", - "Erros inatos do metabolismo", - "Doença Inflamatória Intestinal (DII)", - "Intolerância à lactose", - "Grande para a idade gestacional", - "Doença hepática", - "Lúpus eritematoso", - "Cirurgia de Grande Queimadura ou Trauma", - "Síndromes de má absorção", - "Meningite", - "Esclerose múltipla", - "Distrofia muscular", - "Síndrome de abstinência neonatal", - "Defeito do tubo neural (espinha bífida)" - "Doenças por deficiência de nutrientes", - "Pancreatite", - "Infecção parasitária", - "Doença de Parkinson" - "Pneumonia", - "pré-diabetes", - "Doença renal", - "Anemia falciforme", - "Enterocolite e síndrome do intestino delgado", - "Pequeno para a idade gestacional (PIG)", - "Talassemia maior", - "Tuberculose", - "Colite ulcerativa", - "Úlceras estomacais ou intestinais"}); + "Anorexia nervosa", + "Artrite Reumatóide Juvenil", + "Asma Persistente Moderada ou Grave", + "bronquiolite", + "Bulimia", + "Câncer", + "Doenças cardiorrespiratórias", + "Doença celíaca", + "Paralisia cerebral", + "lábio leporino ou fenda palatina", + "Doença de Crohn", + "Fibrose cística", + "Depressão", + "Deficiências de desenvolvimento sensorial ou motor", + "Diabetes Mellitus", + "Síndrome de Down", + "Úlceras estomacais ou intestinais"}); -const auto ptBRMedicalTests = std::to_array({ "exame HEENT", - "palpação abdominal", - "amniocentese", - "balistocardiograma", - "endoscopia por cápsula", - "ausculta cardíaca", - "coloscopia", - "colposcopia", - "cateterismo coronário", - "cistoscopia", - "exame retal digital", - "ecocardiografia", - "eletrocardiograma", - "eletroencefalograma", - "eletromiografia", - "colangiopancreatografia retrógrada endoscópica", - "estudo da motilidade esofágica", - "monitoramento do pH esofágico", - "esofagogastroduodenoscopia", - "teste de audição", - "histeroscopia", - "laparoscopia", - "laringoscopia", - "biópsia hepática", - "mamografia", - "exame neurológico", - "testes neuropsicológicos", - "polissonografia", - "avaliação psiquiátrica", - "ausculta pulmonar", - "pletismografia pulmonar", - "biópsia de pele", - "toracocentese", - "testes urodinâmicos", - "exame vaginal"}); +const auto ptBRMedicalTests = std::to_array({"exame HEENT", + "palpação abdominal", + "amniocentese", + "balistocardiograma", + "endoscopia por cápsula", + "ausculta cardíaca", + "coloscopia", + "colposcopia", + "cateterismo coronário", + "cistoscopia", + "exame retal digital", + "ecocardiografia", + "eletrocardiograma", + "eletroencefalograma", + "eletromiografia", + "colangiopancreatografia retrógrada endoscópica", + "estudo da motilidade esofágica", + "monitoramento do pH esofágico", + "esofagogastroduodenoscopia", + "teste de audição", + "histeroscopia", + "laparoscopia", + "laringoscopia", + "biópsia hepática", + "mamografia", + "exame neurológico", + "testes neuropsicológicos", + "polissonografia", + "avaliação psiquiátrica", + "ausculta pulmonar", + "pletismografia pulmonar", + "biópsia de pele", + "toracocentese", + "testes urodinâmicos", + "exame vaginal"}); const auto ptBRSpecialties = std::to_array({ "Medicina de emergência e acidentes", @@ -497,17 +456,9 @@ const MedicineDefinition ptBRMedicineDefinition = { .medicalConditions = ptBRMedicalConditions, .medicalTests = ptBRMedicalTests, .specialties = ptBRSpecialties}; const std::map medicineMapSpan({ - {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}}, - {faker::Locale::es_AR, {esARMedicineDefinition}},{faker::Locale::es_BO, {esARMedicineDefinition}}, - {faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, - {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}}, - {faker::Locale::es_EC, {esARMedicineDefinition}},{faker::Locale::es_ES, {esARMedicineDefinition}}, - {faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, - {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}}, - {faker::Locale::es_PA, {esARMedicineDefinition}},{faker::Locale::es_PE, {esARMedicineDefinition}}, - {faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, - {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}}, - {faker::Locale::es_UY, {esARMedicineDefinition}},{faker::Locale::es_VE, {esARMedicineDefinition}}, + {faker::Locale::en_US, {enUSMedicineDefinition}}, + {faker::Locale::pt_BR, {ptBRMedicineDefinition}}, + {faker::Locale::es_AR, {esARMedicineDefinition}}, }); } From 0012bccb3fae5191d84833b083dbf65747a70dc3 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:23:27 -0300 Subject: [PATCH 06/11] fix: reformatting --- src/modules/medicine.cpp | 3 --- src/modules/medicine_data.h | 29 ++++++++--------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/modules/medicine.cpp b/src/modules/medicine.cpp index 109af36b5..835a931c5 100644 --- a/src/modules/medicine.cpp +++ b/src/modules/medicine.cpp @@ -14,7 +14,6 @@ std::string_view condition(Locale locale) { localeLocal = Locale::en_US; } - return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalConditions); } @@ -25,7 +24,6 @@ std::string_view medicalTest(Locale locale) { localeLocal = Locale::en_US; } - return helper::randomElement((medicineMapSpan.at(localeLocal)).medicalTests); } @@ -36,7 +34,6 @@ std::string_view specialty(Locale locale) { localeLocal = Locale::en_US; } - return helper::randomElement((medicineMapSpan.at(localeLocal)).specialties); } diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index eea706df7..932af1311 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -1,9 +1,9 @@ #pragma once #include -#include -#include #include +#include +#include namespace faker::medicine { @@ -338,25 +338,12 @@ const MedicineDefinition esARMedicineDefinition = { .medicalConditions = esARMedicalConditions, .medicalTests = esARMedicalTests, .specialties = esARSpecialties}; //"pt_BR" -const auto ptBRMedicalConditions = - std::to_array({"AIDS", - "Anorexia nervosa", - "Artrite Reumatóide Juvenil", - "Asma Persistente Moderada ou Grave", - "bronquiolite", - "Bulimia", - "Câncer", - "Doenças cardiorrespiratórias", - "Doença celíaca", - "Paralisia cerebral", - "lábio leporino ou fenda palatina", - "Doença de Crohn", - "Fibrose cística", - "Depressão", - "Deficiências de desenvolvimento sensorial ou motor", - "Diabetes Mellitus", - "Síndrome de Down", - "Úlceras estomacais ou intestinais"}); +const auto ptBRMedicalConditions = std::to_array( + {"AIDS","Anorexia nervosa","Artrite Reumatóide Juvenil","Asma Persistente Moderada ou Grave","bronquiolite", + "Bulimia","Câncer","Doenças cardiorrespiratórias","Doença celíaca","Paralisia cerebral", + "lábio leporino ou fenda palatina","Doença de Crohn","Fibrose cística","Depressão", + "Deficiências de desenvolvimento sensorial ou motor","Diabetes Mellitus","Síndrome de Down", + "Úlceras estomacais ou intestinais"}); const auto ptBRMedicalTests = std::to_array({"exame HEENT", "palpação abdominal", From 95d6ad82223f646178beefe1a39f2816bf9c5293 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:28:47 -0300 Subject: [PATCH 07/11] fix: another formatting --- src/modules/medicine.cpp | 2 +- src/modules/medicine_data.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/medicine.cpp b/src/modules/medicine.cpp index 835a931c5..30bfcbb96 100644 --- a/src/modules/medicine.cpp +++ b/src/modules/medicine.cpp @@ -34,7 +34,7 @@ std::string_view specialty(Locale locale) { localeLocal = Locale::en_US; } - return helper::randomElement((medicineMapSpan.at(localeLocal)).specialties); + return helper::randomElement((medicineMapSpan.at(localeLocal)).specialties); } } diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 932af1311..8323e113c 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -339,10 +339,10 @@ const MedicineDefinition esARMedicineDefinition = { //"pt_BR" const auto ptBRMedicalConditions = std::to_array( - {"AIDS","Anorexia nervosa","Artrite Reumatóide Juvenil","Asma Persistente Moderada ou Grave","bronquiolite", - "Bulimia","Câncer","Doenças cardiorrespiratórias","Doença celíaca","Paralisia cerebral", - "lábio leporino ou fenda palatina","Doença de Crohn","Fibrose cística","Depressão", - "Deficiências de desenvolvimento sensorial ou motor","Diabetes Mellitus","Síndrome de Down", + {"AIDS", "Anorexia nervosa", "Artrite Reumatóide Juvenil", "Asma Persistente Moderada ou Grave", "bronquiolite", + "Bulimia", "Câncer", "Doenças cardiorrespiratórias", "Doença celíaca", "Paralisia cerebral", + "lábio leporino ou fenda palatina", "Doença de Crohn", "Fibrose cística", "Depressão", + "Deficiências de desenvolvimento sensorial ou motor", "Diabetes Mellitus", "Síndrome de Down", "Úlceras estomacais ou intestinais"}); const auto ptBRMedicalTests = std::to_array({"exame HEENT", From 0609ebe63c068b32f8d27c0348d29c109d3994bc Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:43:34 -0300 Subject: [PATCH 08/11] fix: check formatting --- src/modules/medicine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/medicine.cpp b/src/modules/medicine.cpp index 30bfcbb96..057c3ce48 100644 --- a/src/modules/medicine.cpp +++ b/src/modules/medicine.cpp @@ -7,6 +7,7 @@ namespace faker::medicine { + std::string_view condition(Locale locale) { auto localeLocal = locale; From 7f61077102047d5e88e361f1ba8a2a6e5c837feb Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:46:25 -0300 Subject: [PATCH 09/11] fix: last line in medicine_data.h --- src/modules/medicine_data.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 8323e113c..45af3c621 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -448,5 +448,4 @@ const std::map medicineMapSpan({ {faker::Locale::es_AR, {esARMedicineDefinition}}, }); -} - +} \ No newline at end of file From 4859d107894ba00da9fc2b1f9c0ec2e03fe9282b Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:50:30 -0300 Subject: [PATCH 10/11] fix: using es_AR definitions for all countries with es as language --- src/modules/medicine_data.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index 45af3c621..f63a937d1 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -443,9 +443,17 @@ const MedicineDefinition ptBRMedicineDefinition = { .medicalConditions = ptBRMedicalConditions, .medicalTests = ptBRMedicalTests, .specialties = ptBRSpecialties}; const std::map medicineMapSpan({ - {faker::Locale::en_US, {enUSMedicineDefinition}}, - {faker::Locale::pt_BR, {ptBRMedicineDefinition}}, - {faker::Locale::es_AR, {esARMedicineDefinition}}, + {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}}, + {faker::Locale::es_AR, {esARMedicineDefinition}},{faker::Locale::es_BO, {esARMedicineDefinition}}, + {faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, + {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}}, + {faker::Locale::es_EC, {esARMedicineDefinition}},{faker::Locale::es_ES, {esARMedicineDefinition}}, + {faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, + {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}}, + {faker::Locale::es_PA, {esARMedicineDefinition}},{faker::Locale::es_PE, {esARMedicineDefinition}}, + {faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, + {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}}, + {faker::Locale::es_UY, {esARMedicineDefinition}},{faker::Locale::es_VE, {esARMedicineDefinition}}, }); } \ No newline at end of file From f9a5804eb7d1688ed920a4eca5e404d8faad27f9 Mon Sep 17 00:00:00 2001 From: Gustavo Bastian Date: Thu, 28 Nov 2024 15:56:32 -0300 Subject: [PATCH 11/11] fix: adding new line at end medicine_data.h --- src/modules/medicine_data.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/modules/medicine_data.h b/src/modules/medicine_data.h index f63a937d1..5d302f36e 100644 --- a/src/modules/medicine_data.h +++ b/src/modules/medicine_data.h @@ -443,17 +443,17 @@ const MedicineDefinition ptBRMedicineDefinition = { .medicalConditions = ptBRMedicalConditions, .medicalTests = ptBRMedicalTests, .specialties = ptBRSpecialties}; const std::map medicineMapSpan({ - {faker::Locale::en_US, {enUSMedicineDefinition}},{faker::Locale::pt_BR, {ptBRMedicineDefinition}}, - {faker::Locale::es_AR, {esARMedicineDefinition}},{faker::Locale::es_BO, {esARMedicineDefinition}}, - {faker::Locale::es_CL, {esARMedicineDefinition}},{faker::Locale::es_CO, {esARMedicineDefinition}}, - {faker::Locale::es_CR, {esARMedicineDefinition}},{faker::Locale::es_DO, {esARMedicineDefinition}}, - {faker::Locale::es_EC, {esARMedicineDefinition}},{faker::Locale::es_ES, {esARMedicineDefinition}}, - {faker::Locale::es_GT, {esARMedicineDefinition}},{faker::Locale::es_HN, {esARMedicineDefinition}}, - {faker::Locale::es_MX, {esARMedicineDefinition}},{faker::Locale::es_NI, {esARMedicineDefinition}}, - {faker::Locale::es_PA, {esARMedicineDefinition}},{faker::Locale::es_PE, {esARMedicineDefinition}}, - {faker::Locale::es_PR, {esARMedicineDefinition}},{faker::Locale::es_PY, {esARMedicineDefinition}}, - {faker::Locale::es_US, {esARMedicineDefinition}},{faker::Locale::es_SV, {esARMedicineDefinition}}, - {faker::Locale::es_UY, {esARMedicineDefinition}},{faker::Locale::es_VE, {esARMedicineDefinition}}, + {faker::Locale::en_US, {enUSMedicineDefinition}}, {faker::Locale::pt_BR, {ptBRMedicineDefinition}}, + {faker::Locale::es_AR, {esARMedicineDefinition}}, {faker::Locale::es_BO, {esARMedicineDefinition}}, + {faker::Locale::es_CL, {esARMedicineDefinition}}, {faker::Locale::es_CO, {esARMedicineDefinition}}, + {faker::Locale::es_CR, {esARMedicineDefinition}}, {faker::Locale::es_DO, {esARMedicineDefinition}}, + {faker::Locale::es_EC, {esARMedicineDefinition}}, {faker::Locale::es_ES, {esARMedicineDefinition}}, + {faker::Locale::es_GT, {esARMedicineDefinition}}, {faker::Locale::es_HN, {esARMedicineDefinition}}, + {faker::Locale::es_MX, {esARMedicineDefinition}}, {faker::Locale::es_NI, {esARMedicineDefinition}}, + {faker::Locale::es_PA, {esARMedicineDefinition}}, {faker::Locale::es_PE, {esARMedicineDefinition}}, + {faker::Locale::es_PR, {esARMedicineDefinition}}, {faker::Locale::es_PY, {esARMedicineDefinition}}, + {faker::Locale::es_US, {esARMedicineDefinition}}, {faker::Locale::es_SV, {esARMedicineDefinition}}, + {faker::Locale::es_UY, {esARMedicineDefinition}}, {faker::Locale::es_VE, {esARMedicineDefinition}}, }); -} \ No newline at end of file +}