text:
const MACSS = (tuberculosis=ICD10AM["A15", "A15.0", "A15.1", "A15.2", "A15.3", "A15.4", "A15.5",
                              "A15.6", "A15.7", "A15.8", "A15.9", "A16", "A16.0", "A16.1",
                              "A16.2", "A16.3", "A16.4", "A16.5", "A16.7", "A16.8", "A16.9",
                              "A17", "A17.0", "A17.1", "A17.8", "A17.9", "A18", "A18.0",
                              "A18.1", "A18.2", "A18.3", "A18.4", "A18.5", "A18.6", "A18.7",
                              "A18.8", "A19", "A19.0", "A19.1", "A19.2", "A19.8", "A19.9",
                              "B90", "B90.0", "B90.1", "B90.2", "B90.8", "B90.9", "K23.0",
                              "K93.0", "N33.0", "N74.0", "N74.1", "Z86.11"],
         septicemia=ICD10AM["A02.1", "A22.7", "A26.7", "A32.7", "A40", "A40.0", "A40.1",
                            "A40.2", "A40.3", "A40.8", "A40.9", "A41", "A41.0", "A41.1",
                            "A41.2", "A41.3", "A41.4", "A41.5", "A41.50", "A41.51",
                            "A41.52", "A41.58", "A41.8", "A41.9", "A42.7"],
         otherbactinfect=ICD10AM["A49", "A49.0", "A49.1", "A49.2", "A49.3", "A49.8",
                                 "A49.9", "B95", "B95.0", "B95.1", "B95.2", "B95.3",
                                 "B95.4", "B95.41", "B95.42", "B95.48", "B95.5", "B95.6",
                                 "B95.7", "B95.8", "B96", "B96.0", "B96.1", "B96.2",
                                 "B96.3", "B96.31", "B96.38", "B96.39", "B96.4", "B96.5",
                                 "B96.6", "B96.7", "B96.8", "B96.81", "B96.88"],
         hivaids=ICD10AM["B20", "B20.0", "B20.1", "B20.2", "B20.3", "B20.4", "B20.5",
                         "B20.6", "B20.7", "B20.8", "B20.9", "B21", "B21.0", "B21.1",
                         "B21.2", "B21.3", "B21.7", "B21.8", "B21.9", "B22", "B22.0",
                         "B22.1", "B22.2", "B22.7", "B23", "B23.0", "B23.1", "B23.2",
                         "B23.8", "B24", "R75"],
         candidiasis=ICD10AM["B37", "B37.0", "B37.1", "B37.2", "B37.3", "B37.4", "B37.5",
                             "B37.6", "B37.7", "B37.8", "B37.81", "B37.88", "B37.9"],
         systemicmycosis=ICD10AM["B38", "B38.0", "B38.1", "B38.2", "B38.3", "B38.4",
                                 "B38.7", "B38.8", "B38.9", "B39", "B39.0", "B39.1",
                                 "B39.2", "B39.3", "B39.4", "B39.5", "B39.9", "B40",
                                 "B40.0", "B40.1", "B40.2", "B40.3", "B40.7", "B40.8",
                                 "B40.9", "B41", "B41.0", "B41.7", "B41.8", "B41.9", "B42",
                                 "B42.0", "B42.1", "B42.7", "B42.8", "B42.9", "B43",
                                 "B43.0", "B43.1", "B43.2", "B43.8", "B43.9", "B44",
                                 "B44.0", "B44.1", "B44.2", "B44.7", "B44.8", "B44.9",
                                 "B45", "B45.0", "B45.1", "B45.2", "B45.3", "B45.7",
                                 "B45.8", "B45.9", "B46", "B46.0", "B46.1", "B46.2",
                                 "B46.3", "B46.4", "B46.5", "B46.8", "B46.9", "B47",
                                 "B47.0", "B47.1", "B47.9", "B48", "B48.0", "B48.1",
                                 "B48.2", "B48.3", "B48.4", "B48.7", "B48.8", "B49"],
         cancer_lung=ICD10AM["C33", "C34", "C34.0", "C34.1", "C34.2", "C34.3", "C34.8",
                             "C34.9", "Z85.1"],
         cancer_breast=ICD10AM["C50", "C50.0", "C50.1", "C50.2", "C50.3", "C50.4", "C50.5",
                               "C50.6", "C50.8", "C50.9", "Z85.3"],
         cancer_otherprimary=ICD10AM["C00", "C00.0", "C00.1", "C00.2", "C00.3", "C00.4",
                                     "C00.5", "C00.6", "C00.8", "C00.9", "C01", "C02",
                                     "C02.0", "C02.1", "C02.2", "C02.3", "C02.4", "C02.8",
                                     "C02.9", "C03", "C03.0", "C03.1", "C03.9", "C04",
                                     "C04.0", "C04.1", "C04.8", "C04.9", "C05", "C05.0",
                                     "C05.1", "C05.2", "C05.8", "C05.9", "C06", "C06.0",
                                     "C06.1", "C06.2", "C06.8", "C06.9", "C07", "C08",
                                     "C08.0", "C08.1", "C08.8", "C08.9", "C09", "C09.0",
                                     "C09.1", "C09.8", "C09.9", "C10", "C10.0", "C10.1",
                                     "C10.2", "C10.3", "C10.4", "C10.8", "C10.9", "C11",
                                     "C11.0", "C11.1", "C11.2", "C11.3", "C11.8", "C11.9",
                                     "C12", "C13", "C13.0", "C13.1", "C13.2", "C13.8",
                                     "C13.9", "C14", "C14.0", "C14.2", "C14.8", "C15",
                                     "C15.0", "C15.1", "C15.2", "C15.3", "C15.4", "C15.5",
                                     "C15.8", "C15.9", "C16", "C16.0", "C16.1", "C16.2",
                                     "C16.3", "C16.4", "C16.5", "C16.6", "C16.8", "C16.9",
                                     "C17", "C17.0", "C17.1", "C17.2", "C17.3", "C17.8",
                                     "C17.9", "C18", "C18.0", "C18.1", "C18.2", "C18.3",
                                     "C18.4", "C18.5", "C18.6", "C18.7", "C18.8", "C18.9",
                                     "C19", "C20", "C21", "C21.0", "C21.1", "C21.2",
                                     "C21.8", "C22", "C22.0", "C22.1", "C22.2", "C22.3",
                                     "C22.4", "C22.7", "C22.9", "C23", "C24", "C24.0",
                                     "C24.1", "C24.8", "C24.9", "C25", "C25.0", "C25.1",
                                     "C25.2", "C25.3", "C25.4", "C25.7", "C25.8", "C25.9",
                                     "C26", "C26.0", "C26.1", "C26.8", "C26.9", "C30",
                                     "C30.0", "C30.1", "C31", "C31.0", "C31.1", "C31.2",
                                     "C31.3", "C31.8", "C31.9", "C32", "C32.0", "C32.1",
                                     "C32.2", "C32.3", "C32.8", "C32.9", "C37", "C38",
                                     "C38.0", "C38.1", "C38.2", "C38.3", "C38.4", "C38.8",
                                     "C39", "C39.0", "C39.8", "C39.9", "C40", "C40.0",
                                     "C40.1", "C40.2", "C40.3", "C40.8", "C40.9", "C41",
                                     "C41.0", "C41.01", "C41.02", "C41.1", "C41.2", "C41.3",
                                     "C41.4", "C41.8", "C41.9", "C43", "C43.0", "C43.1",
                                     "C43.2", "C43.3", "C43.4", "C43.5", "C43.6", "C43.7",
                                     "C43.8", "C43.9", "C44", "C44.0", "C44.1", "C44.2",
                                     "C44.3", "C44.4", "C44.5", "C44.6", "C44.7", "C44.8",
                                     "C44.9", "C45", "C45.0", "C45.1", "C45.2", "C45.7",
                                     "C45.9", "C46", "C46.0", "C46.1", "C46.2", "C46.3",
                                     "C46.7", "C46.8", "C46.9", "C47", "C47.0", "C47.1",
                                     "C47.2", "C47.3", "C47.4", "C47.5", "C47.6", "C47.8",
                                     "C47.9", "C48", "C48.0", "C48.1", "C48.2", "C48.8",
                                     "C49", "C49.0", "C49.1", "C49.2", "C49.3", "C49.4",
                                     "C49.5", "C49.6", "C49.8", "C49.9", "C51", "C51.0",
                                     "C51.1", "C51.2", "C51.8", "C51.9", "C52", "C53",
                                     "C53.0", "C53.1", "C53.8", "C53.9", "C54", "C54.0",
                                     "C54.1", "C54.2", "C54.3", "C54.8", "C54.9", "C55",
                                     "C56", "C57", "C57.0", "C57.1", "C57.2", "C57.3",
                                     "C57.4", "C57.7", "C57.8", "C57.9", "C58", "C60",
                                     "C60.0", "C60.1", "C60.2", "C60.8", "C60.9", "C61",
                                     "C62", "C62.0", "C62.1", "C62.9", "C63", "C63.0",
                                     "C63.1", "C63.2", "C63.7", "C63.8", "C63.9", "C64",
                                     "C65", "C66", "C67", "C67.0", "C67.1", "C67.2",
                                     "C67.3", "C67.4", "C67.5", "C67.6", "C67.7", "C67.8",
                                     "C67.9", "C68", "C68.0", "C68.1", "C68.8", "C68.9",
                                     "C69", "C69.0", "C69.1", "C69.2", "C69.3", "C69.4",
                                     "C69.5", "C69.6", "C69.8", "C69.9", "C70", "C70.0",
                                     "C70.1", "C70.9", "C71", "C71.0", "C71.1", "C71.2",
                                     "C71.3", "C71.4", "C71.5", "C71.6", "C71.7", "C71.8",
                                     "C71.9", "C72", "C72.0", "C72.1", "C72.2", "C72.3",
                                     "C72.4", "C72.5", "C72.8", "C72.9", "C73", "C74",
                                     "C74.0", "C74.1", "C74.9", "C75", "C75.0", "C75.1",
                                     "C75.2", "C75.3", "C75.4", "C75.5", "C75.8", "C75.9",
                                     "C76", "C76.0", "C76.1", "C76.2", "C76.3", "C76.4",
                                     "C76.5", "C76.7", "C76.8", "C88.7", "C90", "C90.2",
                                     "C90.20", "C90.21", "C94.4", "C94.40", "C94.41", "D37",
                                     "D37.0", "D37.1", "D37.2", "D37.3", "D37.4", "D37.5",
                                     "D37.6", "D37.7", "D37.9", "D38", "D38.0", "D38.1",
                                     "D38.2", "D38.3", "D38.4", "D38.5", "D38.6", "D39",
                                     "D39.0", "D39.1", "D39.2", "D39.7", "D39.9", "D40",
                                     "D40.0", "D40.1", "D40.7", "D40.9", "D41", "D41.0",
                                     "D41.1", "D41.2", "D41.3", "D41.4", "D41.7", "D41.9",
                                     "D42", "D42.0", "D42.1", "D42.9", "D43", "D43.0",
                                     "D43.1", "D43.2", "D43.3", "D43.4", "D43.7", "D43.9",
                                     "D44", "D44.0", "D44.1", "D44.2", "D44.3", "D44.4",
                                     "D44.5", "D44.6", "D44.7", "D44.8", "D44.9", "D45",
                                     "D46", "D46.0", "D46.1", "D46.2", "D46.3", "D46.4",
                                     "D46.7", "D46.9", "D47.0", "D47.1", "D47.3", "D47.7",
                                     "D47.9", "D48", "D48.0", "D48.1", "D48.2", "D48.3",
                                     "D48.4", "D48.5", "D48.6", "D48.7", "D48.9", "Z51.0",
                                     "Z51.1", "Z51.2", "Z85.0", "Z85.2", "Z85.4", "Z85.5",
                                     "Z85.8", "Z85.9"],
         lymphoma=ICD10AM["C81", "C81.0", "C81.1", "C81.2", "C81.3", "C81.7", "C81.9",
                          "C82", "C82.0", "C82.1", "C82.2", "C82.7", "C82.9", "C83",
                          "C83.0", "C83.1", "C83.2", "C83.3", "C83.4", "C83.5", "C83.6",
                          "C83.7", "C83.8", "C83.9", "C84", "C84.0", "C84.1", "C84.2",
                          "C84.3", "C84.4", "C84.5", "C85", "C85.0", "C85.1", "C85.7",
                          "C85.9", "C88.3", "C88.30", "C88.31", "C88.70", "C88.71", "C88.9",
                          "C88.90", "C88.91", "C90.0", "C90.00", "C90.01", "C90.1",
                          "C90.10", "C90.11", "C91", "C91.0", "C91.00", "C91.01", "C91.1",
                          "C91.10", "C91.11", "C91.2", "C91.20", "C91.21", "C91.3",
                          "C91.30", "C91.31", "C91.4", "C91.40", "C91.41", "C91.5",
                          "C91.50", "C91.51", "C91.7", "C91.70", "C91.71", "C91.9",
                          "C91.90", "C91.91", "C92", "C92.0", "C92.00", "C92.01", "C92.1",
                          "C92.10", "C92.11", "C92.2", "C92.20", "C92.21", "C92.3",
                          "C92.30", "C92.31", "C92.4", "C92.40", "C92.41", "C92.5",
                          "C92.50", "C92.51", "C92.7", "C92.70", "C92.71", "C92.9",
                          "C92.90", "C92.91", "C93", "C93.0", "C93.00", "C93.01", "C93.1",
                          "C93.10", "C93.11", "C93.2", "C93.20", "C93.21", "C93.7",
                          "C93.70", "C93.71", "C93.9", "C93.90", "C93.91", "C94", "C94.0",
                          "C94.00", "C94.01", "C94.1", "C94.10", "C94.11", "C94.2",
                          "C94.20", "C94.21", "C94.3", "C94.30", "C94.31", "C94.5",
                          "C94.50", "C94.51", "C94.7", "C94.70", "C94.71", "C95", "C95.0",
                          "C95.00", "C95.01", "C95.1", "C95.10", "C95.11", "C95.2",
                          "C95.20", "C95.21", "C95.7", "C95.70", "C95.71", "C95.9",
                          "C95.90", "C95.91", "C96", "C96.0", "C96.1", "C96.2", "C96.3",
                          "C96.7", "C96.9", "Z85.6", "Z85.7"],
         cancer_secondary_lymphnode=ICD10AM["C77", "C77.0", "C77.1", "C77.2", "C77.3",
                                            "C77.4", "C77.5", "C77.8", "C77.9"],
         cancer_secondary_other=ICD10AM["C78", "C78.0", "C78.1", "C78.2", "C78.3", "C78.4",
                                        "C78.5", "C78.6", "C78.7", "C78.8", "C79", "C79.0",
                                        "C79.1", "C79.2", "C79.3", "C79.4", "C79.5",
                                        "C79.6", "C79.7", "C79.8", "C79.81", "C79.82",
                                        "C79.88", "C80", "C97"],
         neoplasm_colorectal_benign=ICD10AM["D12", "D12.0", "D12.1", "D12.2", "D12.3",
                                            "D12.4", "D12.5", "D12.6", "D12.7", "D12.8",
                                            "D12.9"],
         uterineleiomyoma=ICD10AM["D25", "D25.0", "D25.1", "D25.2", "D25.9"],
         hypothyroidism=ICD10AM["E00", "E00.0", "E00.1", "E00.2", "E00.9", "E01", "E01.0",
                                "E01.1", "E01.2", "E01.8", "E02", "E03", "E03.0", "E03.1",
                                "E03.2", "E03.3", "E03.4", "E03.8", "E03.9", "E89.0"],
         diabetes=ICD10AM["E10.0", "E10.00", "E10.01", "E10.1", "E10.10", "E10.11",
                          "E10.12", "E10.13", "E10.14", "E10.15", "E10.16", "E10.9",
                          "E10.90", "E10.91", "E11.0", "E11.00", "E11.01", "E11.02",
                          "E11.1", "E11.10", "E11.11", "E11.12", "E11.13", "E11.14",
                          "E11.15", "E11.16", "E11.9", "E11.90", "E11.91", "E12.0",
                          "E12.00", "E12.01", "E12.1", "E12.10", "E12.11", "E12.9",
                          "E12.90", "E12.91", "E13.0", "E13.00", "E13.01", "E13.02",
                          "E13.1", "E13.10", "E13.11", "E13.12", "E13.13", "E13.14",
                          "E13.15", "E13.16", "E13.9", "E13.90", "E13.91", "E14.0",
                          "E14.00", "E14.01", "E14.02", "E14.1", "E14.10", "E14.11",
                          "E14.12", "E14.13", "E14.14", "E14.15", "E14.16", "E14.9",
                          "E14.90", "E14.91"],
         diabetes_complication=ICD10AM["E10.2", "E10.20", "E10.21", "E10.22", "E10.23",
                                       "E10.29", "E10.4", "E10.40", "E10.41", "E10.42",
                                       "E10.43", "E10.49", "E10.6", "E10.60", "E10.61",
                                       "E10.62", "E10.63", "E10.64", "E10.65", "E10.69",
                                       "E10.7", "E10.70", "E10.71", "E10.73", "E10.8",
                                       "E10.80", "E10.81", "E11.2", "E11.20", "E11.21",
                                       "E11.22", "E11.23", "E11.29", "E11.4", "E11.40",
                                       "E11.41", "E11.42", "E11.43", "E11.49", "E11.6",
                                       "E11.60", "E11.61", "E11.62", "E11.63", "E11.64",
                                       "E11.65", "E11.69", "E11.7", "E11.70", "E11.71",
                                       "E11.72", "E11.73", "E11.8", "E11.80", "E11.81",
                                       "E12.2", "E12.20", "E12.21", "E12.4", "E12.40",
                                       "E12.41", "E12.6", "E12.60", "E12.61", "E12.7",
                                       "E12.70", "E12.71", "E12.8", "E12.80", "E12.81",
                                       "E13.2", "E13.20", "E13.21", "E13.22", "E13.23",
                                       "E13.29", "E13.4", "E13.40", "E13.41", "E13.42",
                                       "E13.43", "E13.49", "E13.6", "E13.60", "E13.61",
                                       "E13.62", "E13.63", "E13.64", "E13.65", "E13.69",
                                       "E13.7", "E13.70", "E13.71", "E13.72", "E13.73",
                                       "E13.8", "E13.80", "E13.81", "E14.2", "E14.20",
                                       "E14.21", "E14.22", "E14.23", "E14.29", "E14.4",
                                       "E14.40", "E14.41", "E14.42", "E14.43", "E14.49",
                                       "E14.6", "E14.60", "E14.61", "E14.62", "E14.63",
                                       "E14.64", "E14.65", "E14.69", "E14.7", "E14.70",
                                       "E14.71", "E14.72", "E14.73", "E14.8", "E14.80",
                                       "E14.81", "M14.2", "M14.2*"],
         malnutrition=ICD10AM["E40", "E41", "E42", "E43", "E44", "E44.0", "E44.1", "E45",
                              "E46", "E64.0"],
         avitaminosis=ICD10AM["E50", "E50.0", "E50.1", "E50.2", "E50.3", "E50.4", "E50.5",
                              "E50.6", "E50.7", "E50.8", "E50.9", "E51", "E51.1", "E51.2",
                              "E51.8", "E51.9", "E52", "E53", "E53.0", "E53.1", "E53.8",
                              "E53.9", "E54", "E55", "E55.0", "E55.9", "E56", "E56.0",
                              "E56.1", "E56.8", "E56.9", "E58", "E59", "E60", "E61",
                              "E61.0", "E61.1", "E61.2", "E61.3", "E61.4", "E61.5", "E61.6",
                              "E61.7", "E61.8", "E61.9", "E63", "E63.0", "E63.1", "E63.8",
                              "E63.9", "E64.1", "E64.2", "E64.3", "E64.8", "E64.9", "M83",
                              "M83.0", "M83.00", "M83.01", "M83.02", "M83.03", "M83.04",
                              "M83.05", "M83.06", "M83.07", "M83.08", "M83.09", "M83.1",
                              "M83.10", "M83.11", "M83.12", "M83.13", "M83.14", "M83.15",
                              "M83.16", "M83.17", "M83.18", "M83.19", "M83.2", "M83.20",
                              "M83.21", "M83.22", "M83.23", "M83.24", "M83.25", "M83.26",
                              "M83.27", "M83.28", "M83.29", "M83.3", "M83.30", "M83.31",
                              "M83.32", "M83.33", "M83.34", "M83.35", "M83.36", "M83.37",
                              "M83.38", "M83.39", "M83.4", "M83.40", "M83.41", "M83.42",
                              "M83.43", "M83.44", "M83.45", "M83.46", "M83.47", "M83.48",
                              "M83.49", "M83.5", "M83.50", "M83.51", "M83.52", "M83.53",
                              "M83.54", "M83.55", "M83.56", "M83.57", "M83.58", "M83.59",
                              "M83.8", "M83.80", "M83.81", "M83.82", "M83.83", "M83.84",
                              "M83.85", "M83.86", "M83.87", "M83.88", "M83.89", "M83.9",
                              "M83.90", "M83.91", "M83.92", "M83.93", "M83.94", "M83.95",
                              "M83.96", "M83.97", "M83.98", "M83.99"],
         gout=ICD10AM["M10", "M10.0", "M10.00", "M10.01", "M10.02", "M10.03", "M10.04",
                      "M10.05", "M10.06", "M10.07", "M10.08", "M10.09", "M10.1", "M10.10",
                      "M10.11", "M10.12", "M10.13", "M10.14", "M10.15", "M10.16", "M10.17",
                      "M10.18", "M10.19", "M10.2", "M10.20", "M10.21", "M10.22", "M10.23",
                      "M10.24", "M10.25", "M10.26", "M10.27", "M10.28", "M10.29", "M10.3",
                      "M10.30", "M10.31", "M10.32", "M10.33", "M10.34", "M10.35", "M10.36",
                      "M10.37", "M10.38", "M10.39", "M10.4", "M10.40", "M10.41", "M10.42",
                      "M10.43", "M10.44", "M10.45", "M10.46", "M10.47", "M10.48", "M10.49",
                      "M10.9", "M10.90", "M10.91", "M10.92", "M10.93", "M10.94", "M10.95",
                      "M10.96", "M10.97", "M10.98", "M10.99", "M14.0"],
         fluidelectrolytedisorders=ICD10AM["E86", "E87", "E87.0", "E87.1", "E87.2", "E87.3",
                                           "E87.4", "E87.5", "E87.6", "E87.7", "E87.8"],
         obesity=ICD10AM["E66", "E66.0", "E66.1", "E66.2", "E66.8", "E66.9"],
         othermetabolicdisorder=ICD10AM["C88.0", "C88.00", "C88.01", "C88.1", "C88.10",
                                        "C88.11", "C88.2", "C88.20", "C88.21", "D47.2",
                                        "D76", "D76.0", "D76.1", "D76.2", "D76.3", "D81.3",
                                        "D81.5", "D89.0", "D89.1", "E20", "E20.0", "E20.1",
                                        "E20.8", "E65", "E67", "E67.0", "E67.1", "E67.2",
                                        "E67.3", "E67.8", "E68", "E70", "E70.0", "E70.1",
                                        "E70.2", "E70.3", "E70.8", "E70.9", "E71", "E71.0",
                                        "E71.1", "E71.2", "E71.3", "E72", "E72.0", "E72.1",
                                        "E72.2", "E72.3", "E72.4", "E72.5", "E72.8",
                                        "E72.9", "E73", "E73.0", "E73.1", "E73.8", "E73.9",
                                        "E74", "E74.0", "E74.1", "E74.2", "E74.3", "E74.4",
                                        "E74.8", "E74.9", "E75.3", "E75.5", "E75.6", "E76",
                                        "E76.0", "E76.1", "E76.2", "E76.3", "E76.8",
                                        "E76.9", "E77", "E77.0", "E77.1", "E77.8", "E77.9",
                                        "E78", "E78.0", "E78.1", "E78.2", "E78.3", "E78.4",
                                        "E78.5", "E78.6", "E78.8", "E78.9", "E79", "E79.0",
                                        "E79.1", "E79.8", "E79.9", "E80", "E80.0", "E80.1",
                                        "E80.2", "E80.3", "E80.4", "E80.5", "E80.6",
                                        "E80.7", "E83", "E83.0", "E83.1", "E83.2", "E83.3",
                                        "E83.4", "E83.5", "E83.8", "E83.9", "E84", "E84.0",
                                        "E84.1", "E84.8", "E84.9", "E85", "E85.0", "E85.1",
                                        "E85.2", "E85.3", "E85.4", "E85.8", "E85.9", "E88",
                                        "E88.0", "E88.1", "E88.2", "E88.8", "E88.9", "E90",
                                        "M14.1", "M14.3", "M14.3*", "M14.4", "M14.4*",
                                        "M14.5", "M14.5*", "M14.6", "M14.6*", "R77",
                                        "R77.0", "R77.1", "R77.2", "R77.8", "R77.9"],
         immunedisorder=ICD10AM["D80", "D80.0", "D80.1", "D80.2", "D80.3", "D80.4", "D80.5",
                                "D80.6", "D80.7", "D80.8", "D80.9", "D81.0", "D81.1",
                                "D81.2", "D81.4", "D81.6", "D81.7", "D81.8", "D81.9", "D82",
                                "D82.0", "D82.1", "D82.2", "D82.3", "D82.4", "D82.8",
                                "D82.9", "D83", "D83.0", "D83.1", "D83.2", "D83.8", "D83.9",
                                "D84", "D84.0", "D84.1", "D84.8", "D84.9", "D89.9"],
         anaemias=ICD10AM["D50", "D50.0", "D50.1", "D50.8", "D50.9", "D51", "D51.0",
                          "D51.1", "D51.2", "D51.3", "D51.8", "D51.9", "D52", "D52.0",
                          "D52.1", "D52.8", "D52.9", "D53", "D53.0", "D53.1", "D53.2",
                          "D53.8", "D53.9", "D55", "D55.0", "D55.1", "D55.2", "D55.3",
                          "D55.8", "D55.9", "D56", "D56.0", "D56.1", "D56.2", "D56.3",
                          "D56.4", "D56.8", "D56.9", "D57", "D57.0", "D57.1", "D57.2",
                          "D57.3", "D57.8", "D58", "D58.0", "D58.1", "D58.2", "D58.8",
                          "D58.9", "D59", "D59.0", "D59.1", "D59.2", "D59.3", "D59.4",
                          "D59.5", "D59.6", "D59.8", "D59.9", "D60", "D60.0", "D60.1",
                          "D60.8", "D60.9", "D61", "D61.0", "D61.1", "D61.2", "D61.3",
                          "D61.8", "D61.9", "D62", "D63", "D63.0", "D63.8", "D64", "D64.0",
                          "D64.1", "D64.2", "D64.3", "D64.4", "D64.8", "D64.9"],
         coagulopathy=ICD10AM["D65", "D66", "D67", "D68", "D68.0", "D68.1", "D68.2",
                              "D68.3", "D68.4", "D68.8", "D68.9", "D69", "D69.0", "D69.1",
                              "D69.2", "D69.3", "D69.4", "D69.5", "D69.6", "D69.8", "D69.9",
                              "D77", "D77*", "R23.3"],
         dementia=ICD10AM["D65", "D66", "D67", "D68", "D68.0", "D68.1", "D68.2", "D68.3",
                          "D68.4", "D68.8", "D68.9", "D69", "D69.0", "D69.1", "D69.2",
                          "D69.3", "D69.4", "D69.5", "D69.6", "D69.8", "D69.9", "D77",
                          "D77*", "R23.3"],
         alcoholism=ICD10AM["F10", "F10.0", "F10.1", "F10.2", "F10.3", "F10.4", "F10.5",
                            "F10.6", "F10.7", "F10.8", "F10.9"],
         illicitdruguse=ICD10AM["F11", "F11.0", "F11.1", "F11.2", "F11.3", "F11.4", "F11.5",
                                "F11.6", "F11.7", "F11.8", "F11.9", "F12", "F12.0", "F12.1",
                                "F12.2", "F12.3", "F12.4", "F12.5", "F12.6", "F12.7",
                                "F12.8", "F12.9", "F13", "F13.0", "F13.1", "F13.2", "F13.3",
                                "F13.4", "F13.5", "F13.6", "F13.7", "F13.8", "F13.9", "F14",
                                "F14.0", "F14.1", "F14.2", "F14.3", "F14.4", "F14.5",
                                "F14.6", "F14.7", "F14.8", "F14.9", "F15", "F15.0", "F15.1",
                                "F15.2", "F15.3", "F15.4", "F15.5", "F15.6", "F15.7",
                                "F15.8", "F15.9", "F16", "F16.0", "F16.1", "F16.2", "F16.3",
                                "F16.4", "F16.5", "F16.6", "F16.7", "F16.8", "F16.9",
                                "F17.2", "F17.3", "F17.4", "F17.5", "F17.6", "F17.7",
                                "F17.8", "F17.9", "F18", "F18.0", "F18.1", "F18.2", "F18.3",
                                "F18.4", "F18.5", "F18.6", "F18.7", "F18.8", "F18.9", "F19",
                                "F19.0", "F19.1", "F19.2", "F19.3", "F19.4", "F19.5",
                                "F19.6", "F19.7", "F19.8", "F19.9", "F55", "F55.0", "F55.1",
                                "F55.2", "F55.3", "F55.4", "F55.5", "F55.6", "F55.8",
                                "F55.9"],
         schizophrenia=ICD10AM["F20.0", "F20.1", "F20.2", "F20.3", "F20.5", "F20.6",
                               "F20.8", "F20.9", "F21", "F23.1", "F23.10", "F23.11",
                               "F23.2", "F23.20", "F23.21", "F25", "F25.0", "F25.1",
                               "F25.2", "F25.8", "F25.9"],
         psychosis_affective=ICD10AM["F30", "F30.0", "F30.1", "F30.2", "F30.8", "F30.9",
                                     "F31", "F31.0", "F31.1", "F31.2", "F31.3", "F31.4",
                                     "F31.5", "F31.6", "F31.7", "F31.8", "F31.9", "F32",
                                     "F32.0", "F32.00", "F32.01", "F32.1", "F32.10",
                                     "F32.11", "F32.2", "F32.20", "F32.21", "F32.3",
                                     "F32.30", "F32.31", "F32.8", "F32.80", "F32.81", "F33",
                                     "F33.0", "F33.1", "F33.2", "F33.3", "F33.4", "F33.8",
                                     "F33.9", "F34.8", "F34.9", "F38", "F38.0", "F38.1",
                                     "F38.8", "F39"],
         psychosis_othernontransient=ICD10AM["F04", "F04.0", "F04.00", "F04.01", "F04.02",
                                             "F04.03", "F04.9", "F06.8", "F06.9", "F09",
                                             "F22", "F22.0", "F22.8", "F22.9", "F23",
                                             "F23.0", "F23.00", "F23.01", "F23.3", "F23.30",
                                             "F23.31", "F23.8", "F23.80", "F23.81", "F23.9",
                                             "F23.90", "F23.91", "F24", "F28", "F29",
                                             "F84.0", "F84.1", "F84.3", "F84.4", "F84.5",
                                             "F84.8", "F84.9"],
         depression_nonpsychotic=ICD10AM["F20.4", "F32.9", "F32.90", "F32.91", "F34.1",
                                         "F41.2"],
         neuroses=ICD10AM["F07", "F07.0", "F07.1", "F07.2", "F07.8", "F07.9", "F34.0",
                          "F40", "F40.0", "F40.00", "F40.01", "F40.1", "F40.2", "F40.8",
                          "F40.9", "F41.0", "F41.1", "F41.3", "F41.8", "F41.9", "F42",
                          "F42.0", "F42.1", "F42.2", "F42.8", "F42.9", "F43.1", "F43.2",
                          "F44", "F44.0", "F44.1", "F44.2", "F44.3", "F44.4", "F44.5",
                          "F44.6", "F44.7", "F44.8", "F44.80", "F44.81", "F44.82", "F44.88",
                          "F44.9", "F45", "F45.0", "F45.1", "F45.2", "F45.3", "F45.30",
                          "F45.31", "F45.32", "F45.33", "F45.34", "F45.35", "F45.38",
                          "F45.39", "F45.4", "F45.8", "F45.9", "F48", "F48.0", "F48.1",
                          "F48.8", "F48.9", "F50", "F50.0", "F50.1", "F50.2", "F50.3",
                          "F50.4", "F50.5", "F50.8", "F50.9", "F51", "F51.0", "F51.1",
                          "F51.2", "F51.3", "F51.4", "F51.5", "F51.8", "F51.9", "F52",
                          "F52.0", "F52.1", "F52.2", "F52.3", "F52.4", "F52.5", "F52.6",
                          "F52.7", "F52.8", "F52.9", "F59", "F60", "F60.0", "F60.1",
                          "F60.2", "F60.3", "F60.30", "F60.31", "F60.4", "F60.5", "F60.6",
                          "F60.7", "F60.8", "F60.9", "F61", "F62", "F62.0", "F62.1",
                          "F62.8", "F62.9", "F63", "F63.0", "F63.1", "F63.2", "F63.3",
                          "F63.8", "F63.9", "F64", "F64.0", "F64.1", "F64.2", "F64.8",
                          "F64.9", "F65", "F65.0", "F65.1", "F65.2", "F65.3", "F65.4",
                          "F65.5", "F65.6", "F65.8", "F65.9", "F66", "F66.0", "F66.1",
                          "F66.2", "F66.8", "F66.9", "F68", "F68.0", "F68.1", "F68.8",
                          "F69", "F91", "F91.0", "F91.1", "F91.2", "F91.3", "F91.8",
                          "F91.9", "F92", "F92.0", "F92.8", "F92.9", "F93", "F93.0",
                          "F93.1", "F93.2", "F93.3", "F93.8", "F93.9", "F94", "F94.0",
                          "F94.1", "F94.2", "F94.8", "F94.9", "F95", "F95.0", "F95.1",
                          "F95.2", "F95.8", "F95.9", "F98", "F98.0", "F98.1", "F98.2",
                          "F98.3", "F98.4", "F98.5", "F98.6", "F98.8", "F98.9", "F99",
                          "G44.2", "G44.3"],
         mentalretardation=ICD10AM["F70", "F70.0", "F70.1", "F70.8", "F70.9", "F71",
                                   "F71.0", "F71.1", "F71.8", "F71.9", "F72", "F72.0",
                                   "F72.1", "F72.8", "F72.9", "F73", "F73.0", "F73.1",
                                   "F73.8", "F73.9", "F78", "F78.0", "F78.1", "F78.8",
                                   "F78.9", "F79", "F79.0", "F79.1", "F79.8", "F79.9"],
         incontinence=ICD10AM["N39.4", "R15", "R32"],
         inflammatoryCNSdis=ICD10AM["G00", "G00.0", "G00.1", "G00.2", "G00.3", "G00.8",
                                    "G00.9", "G01", "G02", "G02.0", "G02.1", "G02.8", "G03",
                                    "G03.0", "G03.1", "G03.2", "G03.8", "G03.9", "G04.0",
                                    "G04.2", "G04.8", "G04.9", "G05", "G05.0", "G05.1",
                                    "G05.2", "G05.8", "G06", "G06.0", "G06.1", "G06.2",
                                    "G07", "G08", "G09", "G92"],
         parkinson=ICD10AM["G20", "G21", "G21.0", "G21.1", "G21.2", "G21.3", "G21.8",
                           "G21.9", "G22"],
         otherextrapyramidaldis=ICD10AM["G10", "G23", "G23.0", "G23.1", "G23.2", "G23.8",
                                        "G23.9", "G24", "G24.0", "G24.1", "G24.2", "G24.3",
                                        "G24.4", "G24.5", "G24.8", "G24.9", "G25", "G25.0",
                                        "G25.1", "G25.2", "G25.3", "G25.4", "G25.5",
                                        "G25.6", "G25.8", "G25.9", "G26", "G90.3"],
         degenneuromuscdis=ICD10AM["B94.1", "E75.0", "E75.1", "E75.2", "E75.4", "F84.2",
                                   "G11", "G11.0", "G11.1", "G11.2", "G11.3", "G11.4",
                                   "G11.8", "G11.9", "G12", "G12.0", "G12.1", "G12.2",
                                   "G12.8", "G12.9", "G13", "G13.0", "G13.1", "G13.2",
                                   "G13.8", "G31.81", "G31.88", "G32", "G32.0", "G32.8",
                                   "G35", "G36", "G36.0", "G36.1", "G36.8", "G36.9", "G37",
                                   "G37.0", "G37.1", "G37.2", "G37.3", "G37.4", "G37.5",
                                   "G37.8", "G37.9", "G70", "G70.0", "G70.1", "G70.2",
                                   "G70.8", "G70.9", "G71", "G71.0", "G71.1", "G71.2",
                                   "G71.3", "G71.8", "G71.9", "G72", "G72.0", "G72.1",
                                   "G72.2", "G72.3", "G72.4", "G72.8", "G72.9", "G73",
                                   "G73.0", "G73.1", "G73.2", "G73.3", "G73.4", "G73.5",
                                   "G73.6", "G73.7", "G90.0", "G90.2", "G90.8", "G90.9",
                                   "G91", "G91.0", "G91.1", "G91.2", "G91.3", "G91.8",
                                   "G91.9", "G93", "G93.0", "G93.1", "G93.2", "G93.3",
                                   "G93.4", "G93.5", "G93.6", "G93.7", "G93.8", "G93.9",
                                   "G94", "G94.0", "G94.1", "G94.2", "G94.8", "G95",
                                   "G95.0", "G95.1", "G95.2", "G95.8", "G95.9", "G99.0",
                                   "G99.1", "G99.2"],
         paraquadraplegia=ICD10AM["B91", "G04.1", "G82", "G82.0", "G82.00", "G82.01",
                                  "G82.02", "G82.03", "G82.04", "G82.05", "G82.06", "G82.1",
                                  "G82.10", "G82.11", "G82.12", "G82.13", "G82.14",
                                  "G82.15", "G82.16", "G82.2", "G82.20", "G82.21", "G82.22",
                                  "G82.23", "G82.24", "G82.25", "G82.26", "G82.3", "G82.30",
                                  "G82.31", "G82.32", "G82.33", "G82.34", "G82.35",
                                  "G82.36", "G82.4", "G82.40", "G82.41", "G82.42", "G82.43",
                                  "G82.44", "G82.45", "G82.46", "G82.5", "G82.50", "G82.51",
                                  "G82.52", "G82.53", "G82.54", "G82.55", "G82.56", "G83",
                                  "G83.0", "G83.1", "G83.2", "G83.3", "G83.4", "G83.8",
                                  "G83.9"],
         cerebralpalsy_infantile=ICD10AM["G80", "G80.0", "G80.00", "G80.01", "G80.02",
                                         "G80.03", "G80.09", "G80.1", "G80.2", "G80.3",
                                         "G80.4", "G80.8", "G80.9"],
         epilepsy=ICD10AM["G40", "G40.0", "G40.00", "G40.01", "G40.1", "G40.10", "G40.11",
                          "G40.2", "G40.20", "G40.21", "G40.3", "G40.30", "G40.31", "G40.4",
                          "G40.40", "G40.41", "G40.5", "G40.50", "G40.51", "G40.6",
                          "G40.60", "G40.61", "G40.7", "G40.70", "G40.71", "G40.8",
                          "G40.80", "G40.81", "G40.9", "G40.90", "G40.91", "G41", "G41.0",
                          "G41.1", "G41.2", "G41.8", "G41.9", "G47.4", "R56", "R56.0",
                          "R56.8"],
         glaucoma=ICD10AM["H40", "H40.0", "H40.1", "H40.2", "H40.3", "H40.4", "H40.5",
                          "H40.6", "H40.8", "H40.9", "H42", "H42.0", "H42.8"],
         cataract=ICD10AM["H25", "H25.0", "H25.1", "H25.2", "H25.8", "H25.9", "H26",
                          "H26.0", "H26.1", "H26.2", "H26.3", "H26.4", "H26.8", "H26.9",
                          "H28.0", "H28.1", "H28.2", "Z96.1"],
         blindness=ICD10AM["B94.0", "E10.3", "E10.30", "E10.31", "E10.32", "E10.33",
                           "E10.34", "E10.35", "E10.36", "E10.39", "E11.3", "E11.30",
                           "E11.31", "E11.32", "E11.33", "E11.34", "E11.35", "E11.36",
                           "E11.39", "E12.3", "E12.30", "E12.31", "E13.3", "E13.30",
                           "E13.31", "E13.32", "E13.33", "E13.34", "E13.35", "E13.36",
                           "E13.39", "E14.3", "E14.30", "E14.31", "E14.32", "E14.33",
                           "E14.34", "E14.35", "E14.36", "E14.39", "H54", "H54.0", "H54.1",
                           "H54.2", "H54.3", "H54.4", "H54.5", "H54.6", "H54.7", "Z97.0"],
         cerebrovascdis=ICD10AM["G45", "G45.0", "G45.1", "G45.2", "G45.3", "G45.4", "G45.8",
                                "G45.9", "G46", "G46.0", "G46.1", "G46.2", "G46.3", "G46.4",
                                "G46.5", "G46.6", "G46.7", "G46.8", "G81", "G81.0", "G81.1",
                                "G81.9", "G97.8", "G97.9", "H34.0", "I61", "I61.0", "I61.1",
                                "I61.2", "I61.3", "I61.4", "I61.5", "I61.6", "I61.8",
                                "I61.9", "I62", "I62.0", "I62.1", "I62.9", "I63", "I63.0",
                                "I63.1", "I63.2", "I63.3", "I63.4", "I63.5", "I63.6",
                                "I63.8", "I63.9", "I64", "I65", "I65.0", "I65.1", "I65.2",
                                "I65.3", "I65.8", "I65.9", "I66", "I66.0", "I66.1", "I66.2",
                                "I66.3", "I66.4", "I66.8", "I66.9", "I67", "I67.0", "I67.1",
                                "I67.2", "I67.3", "I67.4", "I67.5", "I67.6", "I67.7",
                                "I67.8", "I67.9", "I68.0", "I68.0*", "I69", "I69.0",
                                "I69.1", "I69.2", "I69.3", "I69.4", "I69.8", "R47", "R47.0",
                                "R47.1", "R47.8"],
         hypertension=ICD10AM["I10", "I11.9", "I12.9", "I13.9", "I15", "I15.0", "I15.1",
                              "I15.2", "I15.8", "I15.9"],
         congestiveheartdis=ICD10AM["I11.0", "I13.0", "I42", "I42.0", "I42.1", "I42.2",
                                    "I42.3", "I42.4", "I42.5", "I42.6", "I42.7", "I42.8",
                                    "I42.9", "I43", "I43.0", "I43.1", "I43.2", "I43.8",
                                    "I50", "I50.0", "I50.1", "I50.9", "I51.7", "R60",
                                    "R60.0", "R60.1", "R60.9"],
         myocardialinfarction=ICD10AM["I21", "I21.0", "I21.1", "I21.2", "I21.3", "I21.4",
                                      "I21.9", "I22", "I22.0", "I22.1", "I22.8", "I22.9",
                                      "I25.2"],
         otherischemicheartdis=ICD10AM["I20", "I20.0", "I20.1", "I20.8", "I20.9", "I24",
                                       "I24.0", "I24.1", "I24.8", "I24.9", "I25.1",
                                       "I25.10", "I25.11", "I25.12", "I25.13", "I25.3",
                                       "I25.4", "I25.5", "I25.6", "I25.8", "I25.9", "T82.1",
                                       "T82.2", "T82.3", "T82.5"],
         chronicpulmonarycircdis=ICD10AM["I27", "I27.0", "I27.1", "I27.2", "I27.8", "I27.9",
                                     "I28.9"],
         valvulardis=ICD10AM["I05.0", "I05.1", "I05.2", "I05.8", "I05.9", "I06", "I06.0",
                             "I06.1", "I06.2", "I06.8", "I06.9", "I07", "I07.0", "I07.1",
                             "I07.2", "I07.8", "I07.9", "I08", "I08.0", "I08.1", "I08.2",
                             "I08.3", "I08.8", "I08.9", "I09.1", "I34", "I34.0", "I34.1",
                             "I34.2", "I34.8", "I34.9", "I35", "I35.0", "I35.1", "I35.2",
                             "I35.8", "I35.9", "I36", "I36.0", "I36.1", "I36.2", "I36.8",
                             "I36.9", "I37", "I37.0", "I37.1", "I37.2", "I37.8", "I37.9",
                             "I38", "I39", "I39.0", "I39.1", "I39.2", "I39.3", "I39.4",
                             "I39.8", "T82.0", "Z95.2", "Z95.3", "Z95.4"],
         cardiacdysrhythmia=ICD10AM["I44", "I44.0", "I44.1", "I44.2", "I44.3", "I44.4",
                                    "I44.5", "I44.6", "I44.7", "I45", "I45.0", "I45.1",
                                    "I45.2", "I45.3", "I45.4", "I45.5", "I45.6", "I45.8",
                                    "I45.9", "I46", "I46.0", "I46.1", "I46.9", "I47",
                                    "I47.0", "I47.1", "I47.2", "I47.9", "I48", "I49",
                                    "I49.0", "I49.1", "I49.2", "I49.3", "I49.4", "I49.5",
                                    "I49.8", "I49.9", "R00.1", "R09.2", "Z45.0", "Z95.0"],
         periphvascdis=ICD10AM["E10.5", "E10.50", "E10.51", "E10.52", "E10.53", "E10.59",
                               "E11.5", "E11.50", "E11.51", "E11.52", "E11.53", "E11.59",
                               "E12.5", "E12.50", "E12.51", "E13.5", "E13.50", "E13.51",
                               "E13.52", "E13.53", "E13.59", "E14.5", "E14.50", "E14.51",
                               "E14.52", "E14.53", "E14.59", "I70", "I70.0", "I70.1",
                               "I70.2", "I70.20", "I70.21", "I70.22", "I70.23", "I70.24",
                               "I70.8", "I70.9", "I72", "I72.0", "I72.1", "I72.2", "I72.3",
                               "I72.4", "I72.8", "I72.9", "I73", "I73.0", "I73.1", "I73.8",
                               "I73.9", "I77.1", "I79.2", "K55.1", "K55.8", "K55.9", "R02",
                               "T82.4", "Z95.8", "Z95.9"],
         hemorrhoids=ICD10AM["I84", "I84.0", "I84.1", "I84.2", "I84.3", "I84.4", "I84.5",
                             "I84.6", "I84.7", "I84.8", "I84.9"],
         pneumonia=ICD10AM["A48.1", "A48.2", "J12", "J12.0", "J12.1", "J12.2", "J12.8",
                           "J12.9", "J13", "J14", "J15", "J15.0", "J15.1", "J15.2", "J15.3",
                           "J15.4", "J15.5", "J15.6", "J15.7", "J15.8", "J15.9", "J16",
                           "J16.0", "J16.8", "J17", "J17.0", "J17.1", "J17.2", "J17.3",
                           "J17.8", "J18", "J18.0", "J18.1", "J18.2", "J18.8", "J18.9"],
         chronicpulmonarydis=ICD10AM["J40", "J41", "J41.0", "J41.1", "J41.8", "J42", "J43",
                                     "J43.0", "J43.1", "J43.2", "J43.8", "J43.9", "J44",
                                     "J44.0", "J44.1", "J44.8", "J44.9", "J47", "J60",
                                     "J61", "J62", "J62.0", "J62.8", "J63", "J63.0",
                                     "J63.1", "J63.2", "J63.3", "J63.4", "J63.5", "J63.8",
                                     "J64", "J65", "J66", "J66.0", "J66.1", "J66.2",
                                     "J66.8", "J67", "J67.0", "J67.1", "J67.2", "J67.3",
                                     "J67.4", "J67.5", "J67.6", "J67.7", "J67.8", "J67.9",
                                     "J68.4", "J68.8"],
         asthma=ICD10AM["J45", "J45.0", "J45.1", "J45.8", "J45.9", "J46"],
         pleurisy=ICD10AM["J90", "J91", "J92", "J92.0", "J92.9", "J94", "J94.0", "J94.1",
                          "J94.2", "J94.8", "J94.9", "R09.1"],
         otherrespdisorder=ICD10AM["J22", "J80", "J81", "J82", "J95", "J95.0", "J95.1",
                                   "J95.2", "J95.3", "J95.4", "J95.5", "J95.8", "J95.9",
                                   "J96", "J96.0", "J96.1", "J96.9", "J98", "J98.0",
                                   "J98.1", "J98.2", "J98.3", "J98.4", "J98.5", "J98.6",
                                   "J98.8", "J98.9", "Z90.2"],
         esophagealdis=ICD10AM["K20", "K21", "K21.0", "K21.9", "K22", "K22.0", "K22.1",
                               "K22.2", "K22.3", "K22.4", "K22.5", "K22.6", "K22.8",
                               "K22.9", "K23.1", "K23.8", "R22", "R22.0", "R22.1", "R22.2",
                               "R22.3", "R22.4", "R22.7", "R22.9"],
         pepticulcer=ICD10AM["K25", "K25.0", "K25.1", "K25.2", "K25.3", "K25.4", "K25.5",
                             "K25.6", "K25.7", "K25.9", "K26", "K26.0", "K26.1", "K26.2",
                             "K26.3", "K26.4", "K26.5", "K26.6", "K26.7", "K26.9", "K27",
                             "K27.0", "K27.1", "K27.2", "K27.3", "K27.4", "K27.5", "K27.6",
                             "K27.7", "K27.9", "K28", "K28.0", "K28.1", "K28.2", "K28.3",
                             "K28.4", "K28.5", "K28.6", "K28.7", "K28.9"],
         gastritis=ICD10AM["K29", "K29.0", "K29.1", "K29.2", "K29.3", "K29.4", "K29.5",
                           "K29.6", "K29.7", "K29.8", "K29.9"],
         cholelithiasis=ICD10AM["K80", "K80.0", "K80.00", "K80.01", "K80.1", "K80.10",
                                "K80.11", "K80.2", "K80.20", "K80.21", "K80.3", "K80.30",
                                "K80.31", "K80.4", "K80.40", "K80.41", "K80.5", "K80.50",
                                "K80.51", "K80.8", "K80.80", "K80.81", "K81", "K81.0",
                                "K81.1", "K81.8", "K81.9", "K82", "K82.0", "K82.1", "K82.2",
                                "K82.3", "K82.4", "K82.8", "K82.9", "K87.0"],
         chronicliverdis=ICD10AM["K70", "K70.0", "K70.1", "K70.2", "K70.3", "K70.4",
                                 "K70.9", "K71.7", "K73", "K73.0", "K73.1", "K73.2",
                                 "K73.8", "K73.9", "K74", "K74.0", "K74.1", "K74.2",
                                 "K74.3", "K74.4", "K74.5", "K74.6", "K76.0", "K76.1",
                                 "R16.0", "R16.2", "Z94.4"],
         chronicliverdis_sequelae=ICD10AM["K72.1", "K72.9", "K76.6", "K76.7"],
         abdominalhernia=ICD10AM["K40", "K40.0", "K40.00", "K40.01", "K40.1", "K40.10",
                                 "K40.11", "K40.2", "K40.20", "K40.21", "K40.3", "K40.30",
                                 "K40.31", "K40.4", "K40.40", "K40.41", "K40.9", "K40.90",
                                 "K40.91", "K41", "K41.0", "K41.1", "K41.2", "K41.3",
                                 "K41.4", "K41.9", "K42", "K42.0", "K42.1", "K42.9", "K43",
                                 "K43.0", "K43.1", "K43.9", "K44", "K44.0", "K44.1",
                                 "K44.9", "K45", "K45.0", "K45.1", "K45.8", "K46", "K46.0",
                                 "K46.1", "K46.9"],
         noninfectdigestivedis=ICD10AM["K52", "K52.0", "K52.1", "K52.2", "K52.8", "K52.9",
                                       "K58", "K58.0", "K58.9", "K59", "K59.0", "K59.1",
                                       "K59.2", "K59.3", "K59.4", "K59.8", "K59.9", "K60",
                                       "K60.0", "K60.1", "K60.2", "K60.3", "K60.4", "K60.5",
                                       "K91.0", "K91.1", "K93.1", "Z90.3"],
         diverticulardis=ICD10AM["K57.0", "K57.00", "K57.01", "K57.02", "K57.03", "K57.1",
                                 "K57.10", "K57.11", "K57.12", "K57.13", "K57.2", "K57.20",
                                 "K57.21", "K57.22", "K57.23", "K57.3", "K57.30", "K57.31",
                                 "K57.32", "K57.33", "K57.4", "K57.40", "K57.41", "K57.42",
                                 "K57.43", "K57.5", "K57.50", "K57.51", "K57.52", "K57.53",
                                 "K57.8", "K57.80", "K57.81", "K57.82", "K57.83", "K57.9",
                                 "K57.90", "K57.91", "K57.92", "K57.93"],
         peritonealadhesion=ICD10AM["K66", "K66.0", "K66.1", "K66.8", "K66.9"],
         otherintestinedis=ICD10AM["K55.2", "K55.21", "K55.22", "K62", "K62.0", "K62.1",
                                   "K62.2", "K62.3", "K62.4", "K62.5", "K62.6", "K62.7",
                                   "K62.8", "K62.9", "K63", "K63.0", "K63.1", "K63.2",
                                   "K63.3", "K63.4", "K63.5", "K63.50", "K63.51", "K63.58",
                                   "K63.8", "K63.9", "K91.4", "K92.8", "K92.9", "K93.8"],
         gihemorrhage=ICD10AM["K92.0", "K92.1", "K92.2"],
         chronicrenaldis=ICD10AM["I12.0", "I13.1", "I13.2", "N11", "N11.1", "N11.8",
                                 "N11.9", "N18", "N18.0", "N18.1", "N18.2", "N18.3",
                                 "N18.4", "N18.5", "N18.8", "N18.9", "N18.90", "N18.91",
                                 "N19", "Z49", "Z49.0", "Z49.1", "Z49.2", "Z94.0", "Z99.2"],
         otherurinarysysdis=ICD10AM["N06", "N06.0", "N06.1", "N06.2", "N06.3", "N06.4",
                                    "N06.5", "N06.6", "N06.7", "N06.8", "N06.9", "N11.0",
                                    "N12", "N13", "N13.0", "N13.1", "N13.2", "N13.3",
                                    "N13.4", "N13.5", "N13.6", "N13.7", "N13.8", "N28",
                                    "N28.0", "N28.1", "N28.8", "N28.9", "N29", "N29.0",
                                    "N29.1", "N31", "N31.0", "N31.1", "N31.2", "N31.8",
                                    "N31.9", "N32", "N32.0", "N32.1", "N32.2", "N32.3",
                                    "N32.4", "N32.8", "N32.9", "N39.1", "N39.2", "N39.81",
                                    "Z90.5"], urinarytractinf=ICD10AM["N39.0"],
         benignprostatichypertrophy=ICD10AM["D29.1", "N40", "R33"],
         breastdisorder=ICD10AM["N60", "N60.0", "N60.1", "N60.2", "N60.3", "N60.4", "N60.8",
                                "N60.9", "N61", "N62", "N63", "N64", "N64.0", "N64.1",
                                "N64.2", "N64.3", "N64.4", "N64.5", "N64.8", "N64.9",
                                "Z90.1"],
         pelvicinflammdis=ICD10AM["N70", "N70.0", "N70.1", "N70.9", "N73", "N73.0", "N73.1",
                                  "N73.2", "N73.3", "N73.4", "N73.5", "N73.6", "N73.8",
                                  "N73.9", "N74.2", "N74.3", "N74.4", "N74.8"],
         cervitisvaginitis=ICD10AM["N72", "N75", "N75.0", "N75.1", "N75.8", "N75.9", "N76",
                                   "N76.0", "N76.1", "N76.2", "N76.3", "N76.4", "N76.5",
                                   "N76.6", "N76.8", "N77", "N77.0", "N77.1", "N77.8"],
         genitalprolapse=ICD10AM["N81", "N81.0", "N81.1", "N81.2", "N81.3", "N81.4",
                                 "N81.5", "N81.6", "N81.8", "N81.9", "N99.3"],
         noninflammovariancond=ICD10AM["N83", "N83.0", "N83.1", "N83.2", "N83.3", "N83.4",
                                       "N83.5", "N83.6", "N83.7", "N83.8", "N83.9"],
         uterinedisorder=ICD10AM["N84.0", "N84.1", "N85", "N85.0", "N85.1", "N85.2",
                                 "N85.3", "N85.4", "N85.5", "N85.6", "N85.7", "N85.8",
                                 "N85.9", "N93", "N93.0", "N93.8", "N93.9"],
         gynecologicpain=ICD10AM["N39.3", "N94", "N94.0", "N94.1", "N94.2", "N94.3",
                                 "N94.4", "N94.5", "N94.6", "N94.8", "N94.9"],
         menstrualdisorder=ICD10AM["N89.7", "N91", "N91.0", "N91.1", "N91.2", "N91.3",
                                   "N91.4", "N91.5", "N92.0", "N92.1", "N92.2", "N92.3",
                                   "N92.5", "N92.6"],
         menopausedisorder=ICD10AM["N92.4", "N95", "N95.0", "N95.1", "N95.2", "N95.3",
                                   "N95.8", "N95.9"],
         femaleinfertility=ICD10AM["N97", "N97.0", "N97.1", "N97.2", "N97.3", "N97.4",
                                   "N97.8", "N97.9"],
         allnotnormaldelivary=ICD10AM["A34", "F53", "F53.0", "F53.1", "F53.8", "F53.9",
                                      "O00", "O00.0", "O00.1", "O00.2", "O00.8", "O00.9",
                                      "O01", "O01.0", "O01.1", "O01.9", "O02", "O02.0",
                                      "O02.1", "O02.8", "O02.9", "O03", "O03.0", "O03.1",
                                      "O03.2", "O03.3", "O03.4", "O03.5", "O03.6", "O03.7",
                                      "O03.8", "O03.9", "O04", "O04.0", "O04.1", "O04.2",
                                      "O04.3", "O04.4", "O04.5", "O04.6", "O04.7", "O04.8",
                                      "O04.9", "O05", "O05.0", "O05.1", "O05.2", "O05.3",
                                      "O05.4", "O05.5", "O05.6", "O05.7", "O05.8", "O05.9",
                                      "O06", "O06.0", "O06.1", "O06.2", "O06.3", "O06.4",
                                      "O06.5", "O06.6", "O06.7", "O06.8", "O06.9", "O07",
                                      "O07.0", "O07.1", "O07.2", "O07.3", "O07.4", "O07.5",
                                      "O07.6", "O07.7", "O07.8", "O07.9", "O08", "O08.0",
                                      "O08.1", "O08.2", "O08.3", "O08.4", "O08.5", "O08.6",
                                      "O08.7", "O08.8", "O08.9", "O09", "O09.0", "O09.1",
                                      "O09.2", "O09.3", "O09.4", "O09.5", "O09.9", "O10",
                                      "O10.0", "O10.1", "O10.2", "O10.3", "O10.4", "O10.9",
                                      "O11", "O12", "O12.0", "O12.1", "O12.2", "O13", "O14",
                                      "O14.0", "O14.1", "O14.9", "O15", "O15.0", "O15.1",
                                      "O15.2", "O15.9", "O16", "O20", "O20.0", "O20.8",
                                      "O20.9", "O21", "O21.0", "O21.1", "O21.2", "O21.8",
                                      "O21.9", "O22", "O22.0", "O22.1", "O22.2", "O22.3",
                                      "O22.4", "O22.5", "O22.8", "O22.9", "O23", "O23.0",
                                      "O23.1", "O23.2", "O23.3", "O23.4", "O23.5", "O23.9",
                                      "O24", "O24.0", "O24.1", "O24.11", "O24.12", "O24.19",
                                      "O24.2", "O24.21", "O24.22", "O24.29", "O24.3",
                                      "O24.31", "O24.32", "O24.39", "O24.4", "O24.41",
                                      "O24.42", "O24.49", "O24.5", "O24.51", "O24.52",
                                      "O24.59", "O24.9", "O24.91", "O24.92", "O24.99",
                                      "O25", "O26", "O26.0", "O26.1", "O26.2", "O26.3",
                                      "O26.4", "O26.5", "O26.6", "O26.7", "O26.8", "O26.81",
                                      "O26.82", "O26.83", "O26.88", "O26.9", "O29.0",
                                      "O29.1", "O29.2", "O29.3", "O29.4", "O29.5", "O29.6",
                                      "O29.8", "O29.9", "O30", "O30.0", "O30.1", "O30.2",
                                      "O30.8", "O30.9", "O31", "O31.0", "O31.1", "O31.2",
                                      "O31.8", "O32", "O32.0", "O32.1", "O32.2", "O32.3",
                                      "O32.4", "O32.5", "O32.6", "O32.8", "O32.9", "O33",
                                      "O33.0", "O33.1", "O33.2", "O33.3", "O33.4", "O33.5",
                                      "O33.6", "O33.7", "O33.8", "O33.9", "O34", "O34.0",
                                      "O34.1", "O34.2", "O34.3", "O34.4", "O34.5", "O34.6",
                                      "O34.7", "O34.8", "O34.9", "O35", "O35.0", "O35.1",
                                      "O35.2", "O35.3", "O35.4", "O35.5", "O35.6", "O35.7",
                                      "O35.8", "O35.9", "O36", "O36.0", "O36.1", "O36.2",
                                      "O36.3", "O36.4", "O36.5", "O36.6", "O36.7", "O36.8",
                                      "O36.9", "O40", "O41", "O41.0", "O41.1", "O41.8",
                                      "O41.9", "O42", "O42.0", "O42.1", "O42.11", "O42.12",
                                      "O42.2", "O42.9", "O43", "O43.0", "O43.1", "O43.2",
                                      "O43.8", "O43.9", "O44", "O44.0", "O44.1", "O45",
                                      "O45.0", "O45.8", "O45.9", "O46", "O46.0", "O46.8",
                                      "O46.9", "O47", "O47.0", "O47.1", "O47.9", "O48",
                                      "O60", "O61", "O61.0", "O61.1", "O61.8", "O61.9",
                                      "O62", "O62.0", "O62.1", "O62.2", "O62.3", "O62.4",
                                      "O62.8", "O62.9", "O63", "O63.0", "O63.1", "O63.2",
                                      "O63.9", "O64", "O64.0", "O64.1", "O64.2", "O64.3",
                                      "O64.4", "O64.5", "O64.8", "O64.9", "O65", "O65.0",
                                      "O65.1", "O65.2", "O65.3", "O65.4", "O65.5", "O65.8",
                                      "O65.9", "O66", "O66.0", "O66.1", "O66.2", "O66.3",
                                      "O66.4", "O66.5", "O66.8", "O66.9", "O67", "O67.0",
                                      "O67.8", "O67.9", "O68", "O68.0", "O68.1", "O68.2",
                                      "O68.3", "O68.8", "O68.9", "O69", "O69.0", "O69.1",
                                      "O69.2", "O69.3", "O69.4", "O69.5", "O69.8", "O69.9",
                                      "O70", "O70.0", "O70.1", "O70.2", "O70.3", "O70.9",
                                      "O71", "O71.0", "O71.1", "O71.2", "O71.3", "O71.4",
                                      "O71.5", "O71.6", "O71.7", "O71.8", "O71.9", "O72",
                                      "O72.0", "O72.1", "O72.2", "O72.3", "O73", "O73.0",
                                      "O73.1", "O74", "O74.0", "O74.1", "O74.2", "O74.3",
                                      "O74.4", "O74.5", "O74.6", "O74.7", "O74.8", "O74.9",
                                      "O75", "O75.0", "O75.1", "O75.2", "O75.3", "O75.4",
                                      "O75.5", "O75.6", "O75.7", "O75.8", "O75.9", "O81",
                                      "O82", "O85", "O86", "O86.0", "O86.1", "O86.2",
                                      "O86.3", "O86.4", "O86.8", "O87", "O87.0", "O87.1",
                                      "O87.2", "O87.3", "O87.8", "O87.9", "O88", "O88.0",
                                      "O88.1", "O88.2", "O88.3", "O88.8", "O89", "O89.0",
                                      "O89.1", "O89.2", "O89.3", "O89.4", "O89.5", "O89.6",
                                      "O89.8", "O89.9", "O90", "O90.0", "O90.1", "O90.2",
                                      "O90.3", "O90.4", "O90.5", "O90.8", "O90.9", "O91",
                                      "O91.0", "O91.00", "O91.01", "O91.1", "O91.10",
                                      "O91.11", "O91.2", "O91.20", "O91.21", "O92", "O92.0",
                                      "O92.00", "O92.01", "O92.1", "O92.10", "O92.11",
                                      "O92.2", "O92.20", "O92.21", "O92.3", "O92.30",
                                      "O92.31", "O92.4", "O92.40", "O92.41", "O92.5",
                                      "O92.50", "O92.51", "O92.6", "O92.60", "O92.61",
                                      "O92.7", "O92.70", "O92.71", "O94", "O95", "O96",
                                      "O97", "O98", "O98.0", "O98.1", "O98.2", "O98.3",
                                      "O98.4", "O98.5", "O98.6", "O98.8", "O98.9", "O99",
                                      "O99.0", "O99.1", "O99.2", "O99.3", "O99.4", "O99.5",
                                      "O99.6", "O99.7", "O99.8", "Z35", "Z35.0", "Z35.1",
                                      "Z35.2", "Z35.3", "Z35.4", "Z35.5", "Z35.51",
                                      "Z35.52", "Z35.6", "Z35.7", "Z35.8", "Z35.9"],
         chronicskinulcer=ICD10AM["L89", "L97", "L98.4"],
         rheumatologicdis=ICD10AM["H19.3", "L87.1", "L90.0", "L94.1", "L94.3", "L94.4",
                                  "M05", "M05.0", "M05.00", "M05.01", "M05.02", "M05.03",
                                  "M05.04", "M05.05", "M05.06", "M05.07", "M05.08",
                                  "M05.09", "M05.1", "M05.10", "M05.11", "M05.12", "M05.13",
                                  "M05.14", "M05.15", "M05.16", "M05.17", "M05.18",
                                  "M05.19", "M05.2", "M05.20", "M05.21", "M05.22", "M05.23",
                                  "M05.24", "M05.25", "M05.26", "M05.27", "M05.28",
                                  "M05.29", "M05.3", "M05.30", "M05.31", "M05.32", "M05.33",
                                  "M05.34", "M05.35", "M05.36", "M05.37", "M05.38",
                                  "M05.39", "M05.8", "M05.80", "M05.81", "M05.82", "M05.83",
                                  "M05.84", "M05.85", "M05.86", "M05.87", "M05.88",
                                  "M05.89", "M05.9", "M05.90", "M05.91", "M05.92", "M05.93",
                                  "M05.94", "M05.95", "M05.96", "M05.97", "M05.98",
                                  "M05.99", "M06", "M06.0", "M06.00", "M06.01", "M06.02",
                                  "M06.03", "M06.04", "M06.05", "M06.06", "M06.07",
                                  "M06.08", "M06.09", "M06.1", "M06.10", "M06.11", "M06.12",
                                  "M06.13", "M06.14", "M06.15", "M06.16", "M06.17",
                                  "M06.18", "M06.19", "M06.2", "M06.20", "M06.21", "M06.22",
                                  "M06.23", "M06.24", "M06.25", "M06.26", "M06.27",
                                  "M06.28", "M06.29", "M06.3", "M06.30", "M06.31", "M06.32",
                                  "M06.33", "M06.34", "M06.35", "M06.36", "M06.37",
                                  "M06.38", "M06.39", "M06.4", "M06.40", "M06.41", "M06.42",
                                  "M06.43", "M06.44", "M06.45", "M06.46", "M06.47",
                                  "M06.48", "M06.49", "M06.8", "M06.80", "M06.81", "M06.82",
                                  "M06.83", "M06.84", "M06.85", "M06.86", "M06.87",
                                  "M06.88", "M06.89", "M06.9", "M06.90", "M06.91", "M06.92",
                                  "M06.93", "M06.94", "M06.95", "M06.96", "M06.97",
                                  "M06.98", "M06.99", "M07.00", "M08", "M08.0", "M08.00",
                                  "M08.01", "M08.02", "M08.03", "M08.04", "M08.05",
                                  "M08.06", "M08.07", "M08.08", "M08.09", "M08.1", "M08.10",
                                  "M08.11", "M08.12", "M08.13", "M08.14", "M08.15",
                                  "M08.16", "M08.17", "M08.18", "M08.19", "M08.2", "M08.20",
                                  "M08.21", "M08.22", "M08.23", "M08.24", "M08.25",
                                  "M08.26", "M08.27", "M08.28", "M08.29", "M08.3", "M08.4",
                                  "M08.40", "M08.41", "M08.42", "M08.43", "M08.44",
                                  "M08.45", "M08.46", "M08.47", "M08.48", "M08.49", "M08.8",
                                  "M08.80", "M08.81", "M08.82", "M08.83", "M08.84",
                                  "M08.85", "M08.86", "M08.87", "M08.88", "M08.89", "M08.9",
                                  "M08.90", "M08.91", "M08.92", "M08.93", "M08.94",
                                  "M08.95", "M08.96", "M08.97", "M08.98", "M08.99", "M09.8",
                                  "M09.80", "M09.81", "M09.82", "M09.83", "M09.84",
                                  "M09.85", "M09.86", "M09.87", "M09.88", "M09.89", "M12",
                                  "M12.0", "M12.00", "M12.01", "M12.02", "M12.03", "M12.04",
                                  "M12.05", "M12.06", "M12.07", "M12.08", "M12.09", "M32",
                                  "M32.0", "M32.1", "M32.8", "M32.9", "M33", "M33.0",
                                  "M33.1", "M33.2", "M33.9", "M34", "M34.0", "M34.1",
                                  "M34.2", "M34.8", "M34.9", "M35", "M35.0", "M35.1",
                                  "M35.2", "M35.3", "M35.4", "M35.5", "M35.6", "M35.7",
                                  "M35.8", "M35.9", "M36", "M36.0", "M45", "M45.0",
                                  "M45.00", "M45.01", "M45.02", "M45.03", "M45.04",
                                  "M45.05", "M45.06", "M45.07", "M45.08", "M45.09", "M46.0",
                                  "M46.00", "M46.01", "M46.02", "M46.03", "M46.04",
                                  "M46.05", "M46.06", "M46.07", "M46.08", "M46.09", "M46.1",
                                  "M46.5", "M46.50", "M46.51", "M46.52", "M46.53", "M46.54",
                                  "M46.55", "M46.56", "M46.57", "M46.58", "M46.59", "M46.8",
                                  "M46.80", "M46.81", "M46.82", "M46.83", "M46.84",
                                  "M46.85", "M46.86", "M46.87", "M46.88", "M46.89", "M46.9",
                                  "M46.90", "M46.91", "M46.92", "M46.93", "M46.94",
                                  "M46.95", "M46.96", "M46.97", "M46.98", "M46.99",
                                  "M48.90", "M48.91", "M48.94", "M48.95", "M48.96",
                                  "M48.97", "M48.98", "M48.99", "M49.0", "M49.00", "M49.01",
                                  "M49.02", "M49.03", "M49.04", "M49.05", "M49.06",
                                  "M49.07", "M49.08", "M49.09", "M49.1", "M49.10", "M49.11",
                                  "M49.12", "M49.13", "M49.14", "M49.15", "M49.16",
                                  "M49.17", "M49.18", "M49.19", "M49.2", "M49.20", "M49.21",
                                  "M49.22", "M49.23", "M49.24", "M49.25", "M49.26",
                                  "M49.27", "M49.28", "M49.29", "M49.3", "M49.30", "M49.31",
                                  "M49.32", "M49.33", "M49.34", "M49.35", "M49.36",
                                  "M49.37", "M49.38", "M49.39", "M49.4", "M49.40", "M49.41",
                                  "M49.42", "M49.43", "M49.44", "M49.45", "M49.46",
                                  "M49.47", "M49.48", "M49.49", "M49.8", "M49.80", "M49.81",
                                  "M49.82", "M49.83", "M49.84", "M49.85", "M49.86",
                                  "M49.87", "M49.88", "M49.89", "M90.0", "M90.00", "M90.01",
                                  "M90.02", "M90.03", "M90.04", "M90.05", "M90.06",
                                  "M90.07", "M90.08", "M90.09"])

# macss = DataFrame(XLSX.readtable("C:\\Users\\timbp\\Downloads\\ICD-10-AM_MACSS_coding\\ICD-10-AM_MACSS_coding.xlsx",
#                                  "ICD-10-AM MACSS coding"; infer_eltypes=true)...)

# m = macss[:, "MACSS coding"][macss[:, "ICD-10-AM"] .== "Z99.2", :]

# rename!(macss, ["ICD10AMcode", "MACSScondition", "MACSSlabel"])

# filter!(:MACSSlabel => !ismissing, macss)

# disallowmissing!(macss)

# macss.MACSScondition = Int8.(macss.MACSScondition)

# # namemap = Dict{String,Symbol}(
# #   "Septicemia" => :septicemia,
# #   "Tuberculosis" => :tuberculosis,
# #   "Other bacterial infections" => :otherbactinfect,
# #   "HIV or AIDS" => :hivaids,
# #   "Candidiasis" => :candidiasis,
# #   "Systemic mycosis" => :mycosis,
# #   "Other primary cancer" => :otherprimarycancer,
# #   "Lung cancer" => :lungcancer,
# #   "Breast cancer" => :breastcancer,
# #   "Secondary cancer of lymph nodes" => :secondarycancer_lymph,
# #   "Other secondary cancer" => :secondarycancer,
# #   "Lymphoma or leukemia" => :lymphoma,
# #   "Benign neoplasms of the colon or rectum" => :benigncolorectalneoplasm,
# #   "Uterine leiomyoma" => :uterineleiomyoma,
# #   "Hypothyroidism" => :hypothyroidism,
# #   "Diabetes mellitus" => :diabetes,
# #   "Complications of diabetes" => :diabetes_comp,
# #   "Malnutrition or cachexia" => :malnutrition,
# #   "Avitaminosis" => :avitaminosis,
# #   "Gout" => :gout,

# # )


text:
Base.push!(LOAD_PATH, joinpath(@__DIR__, "..", "packages"))
using VSCodeServer
pop!(LOAD_PATH)

let
    args = [popfirst!(Base.ARGS) for _ in 1:2]

    conn_pipeline, telemetry_pipeline = args[1:2]

    VSCodeServer.serve_notebook(conn_pipeline, crashreporting_pipename=telemetry_pipeline)
end

ext: jl

max_stars_repo_name: novitk/julia-vscode

max_issues_repo_name: novitk/julia-vscode

max_forks_repo_name: novitk/julia-vscode


text:
# SPDX-License-Identifier: MIT

abstract type AbstractNormal{D} <: AbstractModel end

function basemeasure(::AbstractNormal, X::AbstractMatrix)
    o = similar(X, size(X,2))
    fill!(o, -.5*log(2π))
end

function _quadratic_stats(x::AbstractVector, y::AbstractVector)
    xyᵀ = x*y'
    vcat(diag(xyᵀ), EFD.vec_tril(xyᵀ))
end

function statistics(m::AbstractNormal, X::AbstractMatrix)
    XX = hcat([_quadratic_stats(x, x) for x in eachcol(X)]...)
    o = similar(X, 1, size(X,2))
    fill!(o, 1)
    vcat(X, XX, o)
end

function loglikelihood(m::AbstractNormal, X::AbstractMatrix, cache = Dict())
    Tη = vectorize(m, cache)
    @cache cache TX = statistics(m, X)
    BX = basemeasure(m, X)
    TX' * Tη .+ BX
end

function ∇sum_loglikelihood(m::AbstractNormal, cache)
    ∇sum_loglikelihood(m, sum(eachcol(cache[:TX])), cache)
end

"""
    mutable struct NormalIndependentParams{D} <: AbstractModel
        μ
        Λ
    end

Normal distribution with independent mean μ and precision matrix Λ.
"""
mutable struct NormalIndependentParams{D} <: AbstractNormal{D}
    μ::P where P <: AbstractParameter
    Λ::P where P <: AbstractParameter
end

function Normal(T, D; W₀ = Matrix{T}(I, D, D), μ₀ = zeros(T, D),
                Σ₀ = Matrix{T}(I, D, D), σ = 0, pstrength = 1)

    μ = BayesianParameter(EFD.Normal(μ₀, T(pstrength) * Σ₀),
                          EFD.Normal(μ₀ .+ randn(T, D) .* T(σ), T(1/pstrength) * Σ₀))
    Λ = BayesianParameter(EFD.Wishart(W₀, D - 1 + T(pstrength)),
                          EFD.Wishart(W₀, D - 1 + T(pstrength)))
    NormalIndependentParams{D}(μ, Λ)
end
Normal(D; kwargs...) = Normal(Float64, D; kwargs...)

function vectorize(m::NormalIndependentParams, cache)
    TΛ = statistics(m.Λ)
    @cache cache diagΛ = TΛ[1]
    @cache cache trilΛ = TΛ[2]
    @cache cache lnΛ = TΛ[3]
    @cache cache Λ = EFD.matrix(diagΛ, trilΛ)

    Tμ = statistics(m.μ)
    @cache cache μ = Tμ[1]
    @cache cache diag_μμᵀ = Tμ[2]
    @cache cache tril_μμᵀ = Tμ[3]
    @cache cache μμᵀ = EFD.matrix(diag_μμᵀ, tril_μμᵀ)

    T = eltype(μ)
    tr_Λμμᵀ = dot(diagΛ, diag_μμᵀ) + T(2)*dot(trilΛ, tril_μμᵀ)
    vcat(Λ*μ, -T(.5) * diagΛ, -trilΛ, -T(.5) * (tr_Λμμᵀ - lnΛ))
end

function ∇sum_loglikelihood(m::AbstractNormal, Tx::AbstractVector, cache)
    μ = cache[:μ]
    diag_μμᵀ = cache[:diag_μμᵀ]
    tril_μμᵀ = cache[:tril_μμᵀ]

    Λ = cache[:Λ]
    diagΛ = cache[:diagΛ]
    trilΛ = cache[:trilΛ]

    D = length(μ)
    O  = (D^2 - D) ÷ 2
    T = eltype(μ)
    x = view(Tx, 1:D)
    diag_xxᵀ = view(Tx, D+1:2*D)
    tril_xxᵀ = view(Tx, 2*D+1:2*D+O)
    C = CUDA.@allowscalar Tx[end]

    ∂Tμ₁ = Λ * x
    ∂Tμ₂ = -vcat(T(.5)*diagΛ, trilΛ)*C
    ∂Tμ = vcat(∂Tμ₁, ∂Tμ₂)

    xμᵀ = x * μ'
    diag_xμᵀ = diag(xμᵀ)
    tril_xμᵀ = EFD.vec_tril(xμᵀ)
    tril_μxᵀ = EFD.vec_tril(μ * x')

    ∂diagΛ = -T(.5)*diag_xxᵀ + diag_xμᵀ - T(.5)*C*diag_μμᵀ
    ∂trilΛ = -tril_xxᵀ + (tril_μxᵀ + tril_xμᵀ) - C*tril_μμᵀ
    ∂lnΛ = T(.5)*C
    ∂TΛ = vcat(∂diagΛ, ∂trilΛ, ∂lnΛ)

    Dict(m.μ => ∂Tμ, m.Λ => ∂TΛ)
end

abstract type AbstractNormalDiag{D} <: AbstractNormal{D} end

statistics(m::AbstractNormalDiag, X::AbstractMatrix) = statistics(typeof(m), X)
function statistics(::Type{<:AbstractNormalDiag}, X::AbstractMatrix{T}) where T
    o = similar(X, 1, size(X,2))
    fill!(o, 1)
    vcat(X, X.^2, o)
end

"""
    mutable struct NormalDiagIndependentParams{D} <: AbstractModel
        μ
        λ
    end

Normal distribution with independent mean μ and diagonal precision
matrix Λ with diagonal elements λ.
"""
mutable struct NormalDiagIndependentParams{D} <: AbstractNormalDiag{D}
    μ::P where P <: AbstractParameter
    λ::P where P <: AbstractParameter
end

function NormalDiag(T, D; β₀ = ones(T, D), μ₀ = zeros(T, D),
                    diagΣ₀ = ones(T, D), pstrength = 1, σ = 0)

    μ = BayesianParameter(EFD.NormalDiag(μ₀, T(1/pstrength) * diagΣ₀),
                          EFD.NormalDiag(μ₀ .+ randn(T, D) .* T(σ), T(1/pstrength) * diagΣ₀))
    λ = BayesianParameter(EFD.Gamma(pstrength * ones(T, D), T(pstrength) .* β₀),
                          EFD.Gamma(pstrength * ones(T, D), T(pstrength) .* β₀))
    NormalDiagIndependentParams{D}(μ, λ)
end
NormalDiag(D; kwargs...) = NormalDiag(Float64, D; kwargs...)

function vectorize(m::NormalDiagIndependentParams, cache)
    Tμ = statistics(m.μ)
    @cache cache μ = Tμ[1]
    @cache cache diag_μμᵀ = Tμ[2]

    Tλ = statistics(m.λ)
    @cache cache λ =  Tλ[1]
    lnλ =  Tλ[2]
    @cache cache logdetΛ = sum(lnλ)

    T = eltype(μ)
    tr_Λμμᵀ = dot(λ, diag_μμᵀ)
    vcat(λ .* μ, -T(.5) * λ, -T(.5) * (tr_Λμμᵀ - logdetΛ))
end

function ∇sum_loglikelihood(m::NormalDiagIndependentParams, Tx::AbstractVector, cache)
    μ = cache[:μ]
    diag_μμᵀ = cache[:diag_μμᵀ]

    λ = cache[:λ]
    logdetΛ = cache[:logdetΛ]

    D = length(μ)
    T = eltype(μ)
    x = view(Tx, 1:D)
    diag_xxᵀ = view(Tx, D+1:2*D)
    C = @CUDA.allowscalar Tx[end]

    ∂Tμ₁ = λ .* x
    ∂Tμ₂ = -T(.5)*C*λ
    ∂Tμ = vcat(∂Tμ₁, ∂Tμ₂)

    diag_xμᵀ = x .* μ
    ∂diagΛ = -T(.5)*(diag_xxᵀ - diag_xμᵀ + C*diag_μμᵀ)
    ∂lnλ = similar(λ)
    fill!(∂lnλ, T(.5*C))
    ∂Tλ= vcat(∂diagΛ, ∂lnλ)

    Dict(m.μ => ∂Tμ, m.λ => ∂Tλ)
end

max_stars_repo_name: lucasondel/PPCA

max_issues_repo_name: lucasondel/PPCA

max_forks_repo_name: lucasondel/PPCA


text:
using YaoAPI
using Test

@testset "YaoAPI.jl" begin
    # Write your own tests here.
end


text:
"""
Add to a figure a plot of a SFM distribution.

    plot!(p,
        model::SFFM.Model,
        mesh::SFFM.Mesh,
        Dist::SFFMDistribution;
        jitter = 0,
        kwargs...,
    )

# Arguments
- `p::Plots.Plot{Plots.GRBackend}`: a plot object as initialised by `plot()`
- `Model`: A Model object
- `mesh`: A Mesh object from `MakeMesh`
- `Dist`: A SFFMDistribution object as output from `Coeff2Dist` or `Sims2Dist`
- `jitter`: the amount to jitter the points (in the x-direction)
- `kwargs`: keyword args to pass to `plot()`
"""
function plot!(
    model::Model,
    mesh::Mesh,
    Dist::SFFMDensity;
    jitter = 0,
    kwargs...
)
    pc = 0
    qc = 0
    # yLimValues = (0.0, 0.0)
    for i = 1:NPhases(model)
        p = Plots.plot!(
            Dist.x,
            Dist.distribution[:, :, i];
            subplot = i,
            title = "φ=" * string(i),
            ylabel = string(typeof(d))[15:end],
            kwargs...,
        )
        if model.C[i] <= 0
            pc = pc + 1
            x = [model.Bounds[1,1]]
            y = [Dist.pm[pc]]
            p = Plots.scatter!(
                x .- jitter/2 .+ jitter*rand(),
                y;
                subplot = i,
                kwargs...,
            )
        end
        if model.C[i] >= 0
            qc = qc + 1
            x = [model.Bounds[1,end]]
            y = [Dist.pm[sum(model.C .<= 0) + qc]]
            p = Plots.scatter!(
                x .- jitter/2 .+ jitter*rand(),
                y;
                subplot = i,
                kwargs...,
            )
        end

    end

    return p
end # end plot!

function plot!(
    p,
    model::Model,
    mesh::Mesh,
    Dist::SFFMDistribution;
    jitter = 0,
    kwargs...
)
    pc = 0
    qc = 0
    # yLimValues = (0.0, 0.0)
    for i = 1:NPhases(model)
        p = Plots.bar!(
            Dist.x[:],
            Dist.distribution[:, :, i][:];
            bar_width = Δ(mesh),
            subplot = i,
            title = "φ=" * string(i),
            ylabel = string(typeof(Dist))[15:end],
            kwargs...,
        )
        if model.C[i] <= 0
            pc = pc + 1
            x = [model.Bounds[1,1]]
            y = [Dist.pm[pc]]
            p = Plots.scatter!(
                x .- jitter/2 .+ jitter*rand(),
                y;
                subplot = i,
                kwargs...,
            )
        end
        if model.C[i] >= 0
            qc = qc + 1
            x = [model.Bounds[1,end]]
            y = [Dist.pm[sum(model.C .<= 0) + qc]]
            p = Plots.scatter!(
                x .- jitter/2 .+ jitter*rand(),
                y;
                subplot = i,
                kwargs...,
            )
        end

    end

    return p
end # end plot!

"""
Initialise and plot a SFM distribution.

    plot(
        model::SFFM.Model;
        mesh::SFFM.Mesh,
        dist::NamedTuple{(:pm, :distribution, :x, :type)};
        jitter = 0,
        kwargs...,
    )

# Arguments
- `Model`: A Model object
- `mesh`: A Mesh object from `MakeMesh`
- `Dist`: A distribution object as output from `Coeff2Dist` or `Sims2Dist`
- `color`: (optional) a colour specifier for the plot
- `jitter`: the amount to jitter the points (in the x-direction)
- `kwargs`: keyword args to pass to `plot()`

# Output
- a plot object of type `Plots.Plot{Plots.GRBackend}` with `NPhases` subplots
    containing a plot of the distribution for each phase.
"""
function plot(
    model::SFFM.Model,
    mesh::SFFM.Mesh,
    dist::SFFMDistribution;
    jitter = 0,
    kwargs...,
)
    p = Plots.plot(layout = Plots.@layout(Plots.grid((NPhases(model)+1)÷2, 2)))
    p = SFFM.plot!(
        p,
        model,
        mesh,
        dist;
        jitter = jitter,
        kwargs...,
    )

    return p
end # end plot

"""

    plot(model::Model; kwargs...,)

Blank initialiser for a plot of a SFFM model.

input:
 - `model::Model` a object of SFFM model type
 -  `kwargs`: optional keyword args you want to also pass to plot
"""
function plot(
    model::Model;
    kwargs...,
)
    p = Plots.plot(layout = Plots.@layout(Plots.grid((NPhases(model)+1)÷2, 2)))
    p = Plots.plot!(;kwargs)

    return p
end # end plot

max_stars_repo_name: angus-lewis/SFFM

max_issues_repo_name: angus-lewis/SFFM

max_forks_repo_name: angus-lewis/SFFM


text:
import Tk

function drawingwindow(name, w, h, closecb=nothing)
    win = Tk.Window(name, w, h)
    c = Tk.Canvas(win, w, h)
    Tk.pack(c, expand = true, fill = "both")
    if !is(closecb,nothing)
        Tk.bind(win, "<Destroy>", closecb)
    end
    c
end

_saved_canvas = nothing

function tk(self::PlotContainer, args...)
    global _saved_canvas
    opts = Winston.args2dict(args...)
    width = get(opts, :width, Winston.config_value("window","width"))
    height = get(opts, :height, Winston.config_value("window","height"))
    reuse_window = isinteractive() #&& Winston.config_value("window","reuse")
    device = _saved_canvas
    if device === nothing || !reuse_window
        device = drawingwindow("Julia", width, height,
                               (x...)->(_saved_canvas=nothing))
        _saved_canvas = device
    else
        @osx_only begin
            device.initialized = false
            Tk.configure(device)
            device.initialized = true
        end
    end
    display(device, self)
    self
end

function display(c::Tk.Canvas, pc::PlotContainer)
    c.draw = function (_)
        ctx = getgc(c)
        set_source_rgb(ctx, 1, 1, 1)
        paint(ctx)
        Winston.page_compose(pc, Tk.cairo_surface(c))
    end
    Tk.draw(c)
    Tk.update()
end

function get_context(c::Tk.Canvas, pc::PlotContainer)
    device = CairoRenderer(Tk.cairo_surface(c))
    ext_bbox = BoundingBox(0,width(c),0,height(c))
    _get_context(device, ext_bbox, pc)
end

get_context(pc::PlotContainer) = get_context(_saved_canvas, pc)


text:
module Probability

#Binomial Theorem
function KSuccess(n, k, pSuccess)
    possibilities = Binomial(n,k)
    nCk =  n == k ? 1 : possibilities
    probability = nCk * pSuccess ^ k * (1 - pSuccess) ^ (n-k)

    return probability
end

function KorMoreSuccess(n, k, pSuccess)
    totalProb = Float64(0)
    for i in [k:n;]
        prob = KSuccess(n, i, pSuccess)
        totalProb = totalProb + prob
    end

    return totalProb
end

function Binomial(n,k)
    return factorial(BigInt(n))/(factorial(BigInt(n-k)) * factorial(BigInt(k)))
end

end

max_stars_repo_name: OICR/mp-biopath

max_issues_repo_name: OICR/mp-biopath

max_forks_repo_name: OICR/mp-biopath


text:
module Linear

    using RigidBodyDynamics
    import RigidBodyDynamics: configuration, velocity
    using ForwardDiff
    using JuMP: AbstractJuMPScalar, getvalue, Variable, AffExpr
    using LCPSim: StateRecord

    export set_current_configuration!,
           set_current_velocity!,
           set_linearization_configuration!,
           set_linearization_velocity!,
           current_configuration,
           current_velocity,
           LinearizedState,
           linearization_state,
           linearized

    qv(state::Union{MechanismState, StateRecord}) = vcat(Vector(configuration(state)), Vector(velocity(state)))

    struct LinearizedState{T, M, SLinear <: MechanismState{<:Number}, SDual <: MechanismState{<:ForwardDiff.Dual}}
        current_state::StateRecord{T, M}
        linearization_state::SLinear
        dual_state::SDual

        function LinearizedState{T}(linear::S) where {T, M, S <: MechanismState{<:Number, M}}
            mechanism = linear.mechanism
            nq = num_positions(mechanism)
            nv = num_velocities(mechanism)
            na = num_additional_states(mechanism)
            N = nq + nv
            D = typeof(ForwardDiff.Dual(0.0, ForwardDiff.Partials(ntuple(i -> 0.0, N))))
            xdiff = Vector{D}(N)
            ForwardDiff.seed!(xdiff, qv(linear), ForwardDiff.construct_seeds(ForwardDiff.Partials{N, Float64}))
            diffstate = MechanismState(mechanism, xdiff[1:nq], xdiff[nq + (1:nv)], zeros(D, na))
            current = StateRecord(mechanism, Vector{T}(N))
            new{T, M, S, typeof(diffstate)}(StateRecord(mechanism, Vector{T}(N)),
                                         linear,
                                         diffstate)
        end

        function LinearizedState{T}(linear::MechanismState{<:AbstractJuMPScalar}) where T
            q = getvalue(configuration(linear))
            v = getvalue(velocity(linear))
            s = getvalue(additional_state(linear))
            if any(isnan, q) || any(isnan, v) || any(isnan, s)
                throw(ArgumentError("To construct a linearized state, the given state must have a defined value (which you can provide with JuMP.setvalue() or JuMP.fix()"))
            end
            LinearizedState{T}(MechanismState(linear.mechanism, q, v, s))
        end
    end

    function LinearizedState(linear::MechanismState, current_state::Union{<:StateRecord{T}, <:MechanismState{T}}) where T
        state = LinearizedState{T}(linear)
        set_current_configuration!(state, configuration(current_state))
        set_current_velocity!(state, velocity(current_state))
        state
    end

    set_current_configuration!(state::LinearizedState, q::AbstractVector) = set_configuration!(state.current_state, q)
    set_current_velocity!(state::LinearizedState, v::AbstractVector) = set_velocity!(state.current_state, v)
    function set_linearization_configuration!(state::LinearizedState, q::AbstractVector)
        set_configuration!(state.linearization_state, q)
        qdual = configuration(state.dual_state)
        qdual .= ForwardDiff.Dual.(q, ForwardDiff.partials.(qdual))
        setdirty!(state.dual_state)
    end
    function set_linearization_velocity!(state::LinearizedState, v::AbstractVector)
        set_velocity!(state.linearization_state, v)
        vdual = velocity(state.dual_state)
        vdual .= ForwardDiff.Dual.(v, ForwardDiff.partials.(vdual))
        setdirty!(state.dual_state)
    end

    unwrap(p::Point3D) = (v -> Point3D(p.frame, v), p.v)
    unwrap(p::FreeVector3D) = (v -> FreeVector3D(p.frame, v), p.v)
    unwrap(p::Transform3D) = (v -> Transform3D(p.from, p.to, v), p.mat)
    unwrap(p) = (identity, p)

    current_configuration(s::LinearizedState, joint::Joint) =
        @view configuration(current_state(s))[parentindexes(configuration(s.dual_state, joint))...]
    current_velocity(s::LinearizedState, joint::Joint) =
        @view velocity(current_state(s))[parentindexes(velocity(s.dual_state, joint))...]

    linearization_state(s::LinearizedState) = s.linearization_state
    linearization_state_vector(s::LinearizedState) = Vector(s.linearization_state)
    current_state(s::LinearizedState) = s.current_state

    function linearized(f::Function, s::LinearizedState)
        wrapper, ydual = unwrap(f(s.dual_state))
        nx = num_positions(current_state(s)) + num_velocities(current_state(s))
        v = ForwardDiff.value.(ydual)
        Δx = qv(current_state(s)) .- qv(linearization_state(s))

        if isa(v, AbstractArray)
            J = similar(v, (length(v), nx))
            ForwardDiff.extract_jacobian!(Void, J, ydual, nx)
            wrapper(v .+ reshape(J * Δx, size(v)))
        else
            wrapper(v + ForwardDiff.partials(ydual)' * Δx)
        end
    end

    function jacobian(f::Function, s::LinearizedState)
        wrapper, ydual = unwrap(f(s.dual_state))
        nx = num_positions(current_state(s)) + num_velocities(current_state(s))
        v = ForwardDiff.value.(ydual)
        J = similar(v, (length(v), nx))
        ForwardDiff.extract_jacobian!(Void, J, ydual, nx)
        J
    end

    function linearized(f::Function, s::LinearizedState{Variable}, min_coefficient=1e-15)
        wrapper, ydual = unwrap(f(s.dual_state))
        nx = num_positions(current_state(s)) + num_velocities(current_state(s))
        v = ForwardDiff.value.(ydual)
        x_current = qv(current_state(s))
        x_linear = qv(linearization_state(s))

        if isa(v, AbstractArray)
            J = similar(v, (length(v), nx))
            ForwardDiff.extract_jacobian!(Void, J, ydual, nx)
            result = AffExpr.(v)
            for i in 1:length(v)
                for j in 1:length(x_current)
                    if abs(J[i, j]) >= min_coefficient
                        push!(result[i], J[i, j], x_current[j])
                        result[i].constant -= J[i, j] * x_linear[j]
                    end
                end
            end
            wrapper(result)
        else
            result = AffExpr(v)
            partials = ForwardDiff.partials(ydual)
            for j in 1:length(x_current)
                if abs(partials[j]) >= min_coefficient
                    push!(result, partials[j], x_current[j])
                    result.constant -= partials[j] * x_linear[j]
                end
            end
            wrapper(result)
        end
    end

end


text:
using Test
using Distributions, Random

rng = MersenneTwister(123)

@testset "Truncated normal, mean and variance" begin
    d = Distributions.truncated(Normal(0,1),100,115); @test mean(d) ≈ 100.00999800099926070518490239457545847490332879043
    d = Distributions.truncated(Normal(0,1),50,70); @test var(d) ≈ 0.00039904318680389954790992722653605933053648912703600
    d = Distributions.truncated(Normal(-2,3),50,70); @test mean(d) ≈ 50.171943499898757645751683644632860837133138152489
    d = Distributions.truncated(Normal(-2,3),50,70); @test var(d) ≈ 0.029373438107168350377591231295634273607812172191712
end
@testset "Truncated normal $trunc" begin
    trunc = truncated(Normal(0, 1), -2, 2)
    @testset "Truncated normal $trunc with $func" for func in
        [(r = rand, r! = rand!),
         (r = ((d, n) -> rand(rng, d, n)), r! = ((d, X) -> rand!(rng, d, X)))]
        repeats = 1000000

        @test abs(mean(func.r(trunc, repeats))) < 0.01
        @test abs(median(func.r(trunc, repeats))) < 0.01
        @test abs(var(func.r(trunc, repeats)) - var(trunc)) < 0.01

        X = Matrix{Float64}(undef, 1000, 1000)
        func.r!(trunc, X)
        @test abs(mean(X)) < 0.01
        @test abs(median(X)) < 0.01
        @test abs(var(X) - var(trunc)) < 0.01
    end
end


text:
using Test
using Languages
using ConceptnetNumberbatch

# Test file with just 2 entriesa (test purposes only)
const DATA_TYPE = Float32
const CONCEPTNET_TEST_DATA = Dict(
    # filename => output type
    (joinpath(string(@__DIR__), "data", "_test_file_en.txt.gz") =>
     ([Languages.English()],
      ["####_ish", "####_form", "####_metres"],
      ConceptNet{Languages.English, String, DATA_TYPE})),

    (joinpath(string(@__DIR__), "data", "_test_file_en.txt") =>
     ([Languages.English()],
      ["####_ish", "####_form", "####_metres"],
      ConceptNet{Languages.English, String, DATA_TYPE})),

    (joinpath(string(@__DIR__), "data", "_test_file.txt") =>
     (nothing,
      ["1_konings", "aaklig", "aak"],
      ConceptNet{Languages.Language, String, DATA_TYPE})),

    (joinpath(string(@__DIR__), "data", "_test_file.h5") =>
     (nothing,
      ["1", "2", "2d"],
      ConceptNet{Languages.Language, String, DATA_TYPE}))
)

@testset "Parser: (no arguments)" begin
    for (filename, (languages, _, resulting_type)) in CONCEPTNET_TEST_DATA
        conceptnet = load_embeddings(filename,
                                     languages=languages,
                                     data_type=DATA_TYPE);
        @test conceptnet isa resulting_type
    end
end

max_vocab_size=5
@testset "Parser: max_vocab_size=5" begin
    for (filename, (languages, _, _)) in CONCEPTNET_TEST_DATA
        conceptnet = load_embeddings(filename,
                                     max_vocab_size=max_vocab_size,
                                     languages=languages);
        @test length(conceptnet) == max_vocab_size
    end
end

max_vocab_size=5
@testset "Parser: max_vocab_size=5, 3 keep words" begin
    for (filename, (languages, keep_words, _)) in CONCEPTNET_TEST_DATA
        conceptnet = load_embeddings(filename,
                                     max_vocab_size=max_vocab_size,
                                     keep_words=keep_words,
                                     languages=languages)
        @test length(conceptnet) == length(keep_words)
        for word in keep_words
            @test word in conceptnet
        end
    end
end

@testset "Indexing" begin
    # English language
    filepath = joinpath(string(@__DIR__), "data", "_test_file_en.txt.gz")
    conceptnet = load_embeddings(filepath, languages=[Languages.English()])
    words = ["####_ish", "####_form", "####_metres", "not_found", "not_found2"]

    # Test indexing
    idx = 1
    @test conceptnet[words[idx]] == conceptnet[:en, words[idx]] ==
    conceptnet[Languages.English(), words[idx]]

    # Test values
    embeddings = conceptnet[words]
    for (idx, word) in enumerate(words)
        if word in conceptnet
            @test embeddings[:,idx] == conceptnet.embeddings[Languages.English()][word]
        else
            @test iszero(embeddings[:,idx])
        end
    end

    # Multiple languages
    filepath = joinpath(string(@__DIR__), "data", "_test_file.txt")
    conceptnet = load_embeddings(filepath, languages=nothing)
    words = ["1_konings", "aaklig", "aak", "maggunfully"]

    # Test indexing
    @test_throws MethodError conceptnet[words]  # type of language is Language, cannot directly search
    @test_throws KeyError conceptnet[:en, "word"]  # English language not present
    @test conceptnet[:nl, words[idx]] ==
    conceptnet[Languages.Dutch(), words[idx]]

    # Test values
    for (idx, word) in enumerate(words)
        @test_throws KeyError conceptnet[Languages.English(), word]
        if word in conceptnet
            @test vec(conceptnet[Languages.Dutch(), word]) ==
            conceptnet.embeddings[Languages.Dutch()][word]
        else
            @test iszero(conceptnet[Languages.Dutch(),word])
        end
    end
end

@testset "Fuzzy Indexing" begin
    filepath = joinpath(string(@__DIR__), "data", "_test_file_en.txt.gz")
    conceptnet = load_embeddings(filepath, languages=[Languages.English()])
    words_and_matches = Dict("aq" => "##",
                             "p'"=>"##",
                             "ab," =>"###",
                             "ddsaw_metres"=>"#####_metres")
    for (word, matching_word) in words_and_matches
        @test conceptnet[word] == conceptnet[matching_word]
    end
end

@testset "Document Embedding" begin
    filepath = joinpath(string(@__DIR__), "data", "_test_file_en.txt.gz")
    conceptnet = load_embeddings(filepath,
                                 languages=[Languages.English()],
                                 data_type=DATA_TYPE)
    # Document with no matchable words
    doc = "a aaaaa b"
    embedded_doc, missed = embed_document(conceptnet,
                                          doc,
                                          keep_size=false,
                                          max_compound_word_length=1)
    @test embedded_doc isa Matrix{DATA_TYPE}
    @test isempty(embedded_doc)
    @test length(missed) == 3
    embedded_doc, missed = embed_document(conceptnet,
                                          doc,
                                          keep_size=true,
                                          max_compound_word_length=1)
    @test embedded_doc isa Matrix{DATA_TYPE}
    @test size(embedded_doc, 2) == length(tokenize_for_conceptnet(doc))
    @test length(missed) == 3
    # Document with all words matchable
    doc_2 = "Five words: huge adapter, xxyyzish, 2342 metres ."
    embedded_doc_2, missed = embed_document(conceptnet,
                                            doc_2,
                                            keep_size=false,
                                            max_compound_word_length=2)
    @test embedded_doc_2 isa Matrix{DATA_TYPE}
    @test isempty(embedded_doc_2)
    @test length(missed) == length(tokenize_for_conceptnet(doc_2))
    embedded_doc_2, missed = embed_document(conceptnet,
                                            doc_2,
                                            keep_size=true,
                                            max_compound_word_length=2)
    @test embedded_doc_2 isa Matrix{DATA_TYPE}
    @test size(embedded_doc_2, 2) == length(tokenize_for_conceptnet(doc_2))
    @test length(missed) == length(tokenize_for_conceptnet(doc_2))
    embedded_doc_2, missed = embed_document(conceptnet,
                                            doc_2,
                                            keep_size=true,
                                            wildcard_matching=true,
                                            max_compound_word_length=2)
    @show missed
    @test length(missed) == 0
end

# show methods
@testset "Show methods" begin
    buf = IOBuffer()
    for (filename, (languages, _, _)) in CONCEPTNET_TEST_DATA
        try
            conceptnet = load_embeddings(filename, languages=languages)
            show(buf, conceptnet)
            @test true
        catch
            @test false
        end
    end
end