OHDSI / OmopViewer

https://ohdsi.github.io/OmopViewer/
Apache License 2.0
1 stars 0 forks source link

error for unexpected symbol #65

Open edward-burn opened 3 weeks ago

edward-burn commented 3 weeks ago
library(phenotypeR)
db <- DBI::dbConnect(RPostgres::Postgres(),
                     dbname = Sys.getenv("CDM5_POSTGRESQL_DBNAME"),
                     host = Sys.getenv("CDM5_POSTGRESQL_HOST"),
                     user = Sys.getenv("CDM5_POSTGRESQL_USER"),
                     password = Sys.getenv("CDM5_POSTGRESQL_PASSWORD"))
cdm <- CDMConnector::cdm_from_con(
  con = db,
  cdm_schema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA"),
  write_schema = c(schema =  Sys.getenv("CDM5_POSTGRESQL_SCRATCH_SCHEMA"),
                   prefix = "incp_"),
  achilles_schema = Sys.getenv("CDM5_POSTGRESQL_CDM_SCHEMA")
)
cdm$asthma <- CohortConstructor::conceptCohort(cdm = cdm,
                                               conceptSet = list("asthma" = 317009),
                                               name = "asthma")
drug_codes <- CodelistGenerator::getDrugIngredientCodes(cdm,
                                                        name = c("diclofenac", "metformin"))
cdm$drugs <- CohortConstructor::conceptCohort(cdm = cdm,
                                              conceptSet = drug_codes,
                                              name = "drugs")
cdm <- omopgenerics::bind(cdm$asthma, cdm$drugs, name = "my_cohort")

result_code_diag <- codelistDiagnostics(cdm$my_cohort)
omopViewer::exportStaticApp(result_all)
ℹ Processing data
✔ Data processed: 9 result types idenfied: `achilles_code_use`, `orphan_code_use`, `summarised_characteristics`, `cohort_attrition`, `cohort_code_use`, `cohort_overlap`, `cohort_timing`,
  `cohort_timing_density`, and `summarised_large_scale_characteristics`.
ℹ Creating shiny from provided data
Error in `parse_safely()`:
! <text>:1500:445824: unexpected symbol
1500: e or multiple trigger point(s), 1 or 2 muscle(s)", "Injection(s); single or multiple trigger point(s), 3 or more muscle(s)", "Injection(s); single tendon origin/insertion", "Injection(s); sing
edward-burn commented 3 weeks ago

Comes from https://github.com/oxford-pharmacoepi/omopViewer/blob/a180216ad6086afbf8f2a215e12442b5b802b300/R/styleCode.R#L4

styler::style_text("Martí Català Sabaté")
#> Error in `parse_safely()`:
#> ! <text>:1:7: unexpected symbol
#> 1: Martí Català
#>           ^
#> Backtrace:
#>      ▆
#>   1. ├─styler::style_text("Martí Català Sabaté")
#>   2. │ └─styler (local) transformer(text)
#>   3. │   └─... %>% ...
#>   4. ├─purrr::when(...)
#>   5. ├─styler:::parse_transform_serialize_r(...)
#>   6. │ └─styler::compute_parse_data_nested(text, transformers, more_specs)
#>   7. │   └─styler:::text_to_flat_pd(text, transformers, more_specs = more_specs)
#>   8. │     ├─... %>% drop_cached_children()
#>   9. │     └─styler:::tokenize(text)
#>  10. │       ├─... %>% enhance_mapping_special()
#>  11. │       └─styler:::get_parse_data(text, include_text = TRUE)
#>  12. │         └─styler:::parse_safely(text, keep.source = TRUE)
#>  13. │           └─rlang::abort(tried_parsing$message)
#>  14. ├─styler:::drop_cached_children(.)
#>  15. │ └─base::order(pd$line1, pd$col1, -pd$line2, -pd$col2, as.integer(pd$terminal))
#>  16. ├─styler:::add_attributes_caching(., transformers, more_specs = more_specs)
#>  17. │ └─base::nrow(pd_flat)
#>  18. ├─styler:::add_stylerignore(.)
#>  19. │ └─base::trimws(pd_flat$text)
#>  20. │   ├─base (local) mysub(...)
#>  21. │   │ └─base::sub(re, "", x, perl = TRUE)
#>  22. │   │   └─base::is.factor(x)
#>  23. │   └─base (local) mysub(paste0("^", whitespace, "+"), x)
#>  24. │     └─base::sub(re, "", x, perl = TRUE)
#>  25. │       └─base::is.factor(x)
#>  26. ├─styler:::add_terminal_token_after(.)
#>  27. │ └─pd_flat %>% filter(terminal) %>% arrange_pos_id()
#>  28. ├─styler:::arrange_pos_id(.)
#>  29. ├─styler:::filter(., terminal)
#>  30. │ └─base::subset(.data, ...)
#>  31. ├─styler:::add_terminal_token_before(.)
#>  32. │ └─pd_flat %>% filter(terminal) %>% arrange_pos_id()
#>  33. ├─styler:::arrange_pos_id(.)
#>  34. ├─styler:::filter(., terminal)
#>  35. │ └─base::subset(.data, ...)
#>  36. ├─styler:::enhance_mapping_special(.)
#>  37. └─styler:::ensure_correct_txt(., text)
#>  38.   └─styler:::is_insufficiently_parsed_string(pd)
#>  39.     └─base::grepl("^\\[", pd$text)
#>  40.       └─base::is.factor(x)

Created on 2024-09-23 with reprex v2.0.2

catalamarti commented 2 weeks ago

hi @edward-burn can you try again with the current version?, this should be fixed with the selects server side

catalamarti commented 1 week ago

is this now solved @edward-burn ?