oxford-pharmacoepi / MegaStudy

4 stars 2 forks source link

Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. #26

Closed AlvaroMartinezERPSS closed 7 months ago

AlvaroMartinezERPSS commented 8 months ago

Hi, we are getting this error when running IncidencePrevalence. Have you encountered the same issue before? Do you know how to solve it?

Captura image

Thanks

tiozab commented 8 months ago

Hi @AlvaroMartinezERPSS, the DUS code is not ready yet for running, we are currently testing it. You do not need to run it yet, but thanks for showing that it does not work for you. @ilovemane, what is the problem with addDemographics here? the DBMS is sql server @AlvaroMartinezERPSS however, you want to run the Incidence Prevalence Code

tiozab commented 8 months ago

@catalamarti I see that you are the maintainer of PatientProfiles, any suggestions?

ilovemane commented 8 months ago

@tiozab can you show me the study code?

tiozab commented 8 months ago

@AlvaroMartinezERPSS can you confirm which code you were running ? DUS or IncidencePrevalence? also whether you have used renv to have the appropriate package versions? And please send us the log.txt saved in the storgae folder, so we see where the error occured. Thank you!

AlvaroMartinezERPSS commented 8 months ago

Hello Theresa,

I'm running "IncidencePrevalence Code" > "CodeToRun.R" Yes, we have used renv to update the packages.

[cid:e424b6a5-f1db-4f55-a1e4-e0ac5345283b]

[cid:c9eaa6fb-10ef-4f8d-a9ee-4d3ee972859b] [cid:e020ad0d-ee21-4da8-8f3f-b7ba231dfef8]

Tell me if you need something else.

Thanks,

Álvaro

[cid:ce82c23a-f3c7-4fa2-864f-5f98d3228b29]


De: Theresa Burkard @.> Enviado: miércoles, 28 de febrero de 2024 14:36 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

@AlvaroMartinezERPSShttps://github.com/AlvaroMartinezERPSS can you confirm which code you were running ? DUS or IncidencePrevalence? also whether you have used renv to have the appropriate package versions? And please send us the log.txt saved in the storgae folder, so we see where the error occured. Thank you!

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-1969001376, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCCYSFXNJEYSWGO5YUDYV4XHLAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGAYDCMZXGY. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

INFO [2024-02-27 15:02:40] CREATE CDM OBJECT INFO [2024-02-27 15:02:45] CREATE SNAPSHOT INFO [2024-02-27 15:02:47] GENERATE DRUG CONCEPTS INFO [2024-02-27 15:03:13] GENERATE DRUG COHORTS INFO [2024-02-28 09:11:25] CREATE CDM OBJECT INFO [2024-02-28 09:11:46] CREATE SNAPSHOT INFO [2024-02-28 09:11:57] GENERATE DRUG CONCEPTS INFO [2024-02-28 09:12:25] GENERATE DRUG COHORTS INFO [2024-02-28 09:16:15] GENERATE DENOMINATOR COHORT INFO [2024-02-28 09:16:27] GENERATE DRUG COHORTS INFO [2024-02-28 09:18:26] GENERATE DRUG CONCEPTS INFO [2024-02-28 09:18:48] GENERATE DRUG COHORTS INFO [2024-02-28 09:26:20] CREATE CDM OBJECT INFO [2024-02-28 09:26:24] CREATE SNAPSHOT INFO [2024-02-28 09:26:26] GENERATE DRUG CONCEPTS INFO [2024-02-28 09:26:34] GENERATE DRUG COHORTS INFO [2024-02-28 09:27:10] CREATE CDM OBJECT INFO [2024-02-28 09:27:13] CREATE SNAPSHOT INFO [2024-02-28 09:27:14] GENERATE DRUG CONCEPTS INFO [2024-02-28 09:27:23] GENERATE DRUG COHORTS

tiozab commented 8 months ago

@ilovemane the error occurs here

https://github.com/oxford-pharmacoepi/MegaStudy/blob/b9ca48f8abc89a48007374e9cdb0da677e4aff71/IncidencePrevalence%20Code/RunIncidencePrevalence.R#L48C1-L60C1

tiozab commented 8 months ago

@AlvaroMartinezERPSS is your concept_drugs object a list with lists of integers? It seems like your drugs.R file is not processed properly because it only took some seconds to generate 58 drug cohorts which is unlikely.

AlvaroMartinezERPSS commented 8 months ago

Hello @tiozab, Yes, it looks like a list of lists of integers. Is there any way to visualize the temporary tables?

image

tiozab commented 8 months ago

they are not temporary tables, you can just type concept_drugs into the console and it will display it, but you they do look okay at a first glance. @ilovemane any suggestions?

tiozab commented 8 months ago

if you only want to display one you can put concept_drugs$ganirelix e.g.

tiozab commented 8 months ago

@AlvaroMartinezERPSS can you please run the following

cdm <- generateDrugUtilisationCohortSet( cdm = cdm, name = "drug_cohorts", conceptSet = concept_drugs[1:5], durationRange = c(1, Inf), imputeDuration = "none", gapEra = 0, priorUseWashout = 0, priorObservation = 0, cohortDateRange = as.Date(c("2010-01-01",NA)), limit = "all" )

and separately cdm <- generateDrugUtilisationCohortSet( cdm = cdm, name = "drug_cohorts", conceptSet = concept_drugs[6], durationRange = c(1, Inf), imputeDuration = "none", gapEra = 0, priorUseWashout = 0, priorObservation = 0, cohortDateRange = as.Date(c("2010-01-01",NA)), limit = "all" )

because it seems that the error occurs in the 6th concept_drug

AlvaroMartinezERPSS commented 8 months ago

Hello @tiozab ,

I get still the same error when running both codes. Could we have a meeting to solve it? Thanks

image image

tiozab commented 8 months ago

@AlvaroMartinezERPSS I am afraid that github may be the best approach, can you please update patientprofiles to 0.5.1 this may resolve the issue in sql server

tiozab commented 8 months ago

you told me via email that is was not working have you tried to install patientprofiles 0.5.1? What you have to do is go to packages and remove that package on the little x on the most right hand side image

then type the following in the console install.packages("PatientProfiles@0.5.1") library(PatientProfiles) packageVersion("PatientProfiles")

to double check the version.

let us know how it goes

AlvaroMartinezERPSS commented 8 months ago

Good morning Theresa,

I have followed your steps, but I can't load the DrugUtilisation package now because it requires a PatientsProfiles version higher than 0.6.0

[cid:5e38fb7f-1385-4805-b011-762709225594]

Which version of DrugUtilisation should we have?

Thanks,

Álvaro

[cid:b293641a-29bb-44e6-9159-36db357c621b]


De: Theresa Burkard @.> Enviado: jueves, 29 de febrero de 2024 16:09 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

you told me via email that is was not working have you tried to install patientprofiles 0.5.1? What you have to do is go to packages and remove that package on the little x on the most right hand side image.png (view on web)https://github.com/oxford-pharmacoepi/MegaStudy/assets/94674809/80074f43-8dbd-46e5-86b9-ccfcb2431b4e

then type the following in the console @.***") library(PatientProfiles) packageVersion("PatientProfiles")

to double check the version.

let us know how it goes

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-1971346519, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCGSKZVQEPLKRUOX7P3YV5CEDAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZRGM2DMNJRHE. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

tiozab commented 8 months ago

DrugUtilisation is 0.4.1and requires patientProfiles of at least 0.4.0 so should work fine, the only package that you need to change from the renv is patientProfiles nothing else

tiozab commented 8 months ago

basically, here is a new renv that includes the patientprofiles 0.5.1 while everything else stayed the same, please use this renv.lock instead (rename please) and hope it solves the issues sql server renv.lock.txt

AlvaroMartinezERPSS commented 8 months ago

Hello Theresa,

I have used the new renv, but I get the same error:

Error: package or namespace load failed for ‘DrugUtilisation’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘PatientProfiles’ 0.5.1 is being loaded, but >= 0.6.0 is required

[cid:90470084-4ffb-4e54-bfa5-acbbe9ce5e2e]


De: Theresa Burkard @.> Enviado: viernes, 1 de marzo de 2024 10:21 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

basically, here is a new renv that includes the patientprofiles 0.5.1 while everything else stayed the same, please use this renv.lock instead (rename please) and hope it solves the issues sql server renv.lock.txthttps://github.com/oxford-pharmacoepi/MegaStudy/files/14458897/sql.server.renv.lock.txt

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-1972816529, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCDFYDNWLCLAB46WAODYWBCAHAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZSHAYTMNJSHE. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

tiozab commented 8 months ago

@AlvaroMartinezERPSS can you show me the result of this? I try to find out where the dependency you mentioned comes from because DrugUtilisation 0.4.1 as from the renv only requires PatientProfiles 0.4.0

packageVersion("CDMConnector") packageVersion("CodelistGenerator") packageVersion("DrugUtilisation") packageVersion("IncidencePrevalence") packageVersion("PatientProfiles") packageVersion("dbplyr") packageVersion("odbc") packageVersion("purrr") packageVersion("rlang") packageVersion("testthat") packageVersion("tidyr") packageVersion("tidyselect") packageVersion("usethis")

AlvaroMartinezERPSS commented 8 months ago

@Theresa @.***> these are the versions we have

[cid:2087e7af-0443-4ec1-8575-8c6d6a39ac80]

[cid:2a17479b-7667-460c-bbac-5f79b99e8639]


De: Theresa Burkard @.> Enviado: viernes, 1 de marzo de 2024 12:54 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

@AlvaroMartinezERPSShttps://github.com/AlvaroMartinezERPSS can you show me the result of this? I try to find out where the dependency you mentioned comes from:

packageVersion("CDMConnector") packageVersion("CodelistGenerator") packageVersion("DrugUtilisation") packageVersion("IncidencePrevalence") packageVersion("PatientProfiles") packageVersion("dbplyr") packageVersion("odbc") packageVersion("purrr") packageVersion("rlang") packageVersion("testthat") packageVersion("tidyr") packageVersion("tidyselect") packageVersion("usethis")

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-1973053849, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCE2HFMUIAUPRDYZKYLYWBT6ZAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZTGA2TGOBUHE. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

tiozab commented 8 months ago

Hi @AlvaroMartinezERPSS I think the renv did not work properly because it would get you different version of the following packages: CDMConnector 1.2.1, Codelistgenerator 2.1.1, IncidencePrevalence 0.6.0, PatientProfiles 0.5.1 or 0.4.0 depending which lock file, and testthat 3.1.10. Please try again and make sure the renv is properly deployed, maybe try with the initial lock file that stores PatientProfiles 0.4.0, if that does not work, please try the lock file from this thread that stores PatientProfiles 0.5.1

image

AlvaroMartinezERPSS commented 8 months ago

Hi Theresa, we just have updated these packages:

[cid:ebe27877-a140-4aa7-ae70-8c9e30c3272d]

We have tried both PatientProfiles 0.5.1 or 0.4.0, but we get still the same error.

[cid:89b687b5-818a-4bf7-a06c-91ab51726e18]


De: Theresa Burkard @.> Enviado: viernes, 1 de marzo de 2024 14:59 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

Hi @AlvaroMartinezERPSShttps://github.com/AlvaroMartinezERPSS I think the renv did not work properly because it would get you different version of the following packages: CDMConnector 1.2.1, Codelistgenerator 2.1.1, IncidencePrevalence 0.6.0, PatientProfiles 0.5.1 or 0.4.0 depending which lock file, and testthat 3.1.10. Please try again and make sure the renv is properly deployed, maybe try with the initial lock file that stores PatientProfiles 0.4.0, if that does not work, please try the lock file from this thread that stores PatientProfiles 0.5.1

image.png (view on web)https://github.com/oxford-pharmacoepi/MegaStudy/assets/94674809/4569726b-1bdd-46b6-8011-123a83659a37

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-1973256217, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCCPNG6ISVLWV5WCRZTYWCCVVAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZTGI2TMMRRG4. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

ilovemane commented 7 months ago

hey, I have the problem is some of the drug cohort are empty. hence you get error. I got someone in another project with the same error.

tiozab commented 7 months ago

@AlvaroMartinezERPSS thanks for your patience. In the file RunIncidencePrevalence.R, in line 79 before estimating Incidence, can you add these lines please and try whether that resolves the issue? With this code we are removing the cohorts that are empty (in other database management systems empty cohorts have not been a problem to date).

cdi <- cohortCount(cdm$drug_cohorts) |> filter(number_records > 0) |> dplyr::pull(cohort_definition_id)

cdm$drug_cohorts <- cdm$drug_cohorts |> omopgenerics::newCohortTable(cohortSetRef = settings(cdm$drug_cohorts) |> dplyr::filter(cohort_definition_id %in% cdi), cohortAttritionRef = NULL)

AlvaroMartinezERPSS commented 7 months ago

Hi @tiozab I have tried the code lines you provided me, but it still doesn't work. I have added these lines before line 79, but the error occurs when generating drug cohorts in line 48. Therefore, perhaps we should add or remove something in this "Generate drugs cohort" code.

image

tiozab commented 7 months ago

@AlvaroMartinezERPSS thank you, that is true. can you run this line and try from line 48 again? concept_drugs <- lapply(concept_drugs, function(x) as.integer(x)) because I see now that your list contains doubles and not integers, maybe this is the problem

AlvaroMartinezERPSS commented 7 months ago

I have just tried it and the same error occurs. In function addDemographics there are two paramethers (age and sex) which are set to FALSE. Could we define them manually as TRUE?

tiozab commented 7 months ago

@AlvaroMartinezERPSS you cannot interact with addDemographics, it is an internal function and some checks are performed, here is the function that throws the error in patientProfiles, like the ouput says, it is not happy with some dates. https://github.com/darwin-eu-dev/PatientProfiles/blob/d516c80a821d64cd135f9298b357e67811a0a02f/R/addDemographics.R#L151

Since the error is related to a date, maybe s.th. is wrong with a date formatting for some of the drugs. I am not sure it is a general sql server problem any more, because in the meantime other sql server databases were able to run the code.

So let's try this: for (i in seq_along(concept_drugs)){ cdm <- generateDrugUtilisationCohortSet( cdm = cdm, name = "drug_cohorts", conceptSet = concept_drugs[i], durationRange = c(1, Inf), imputeDuration = "none", gapEra = 0, priorUseWashout = 0, priorObservation = 0, cohortDateRange = as.Date(c("2010-01-01",NA)), limit = "all" )

print(cdm$drug_cohorts) }

however, it seems that it already occurs at the first instance right?

AlvaroMartinezERPSS commented 7 months ago

@tiozab This solution doesn't work either... Is it possible that the problem is in our DB? What should we check or review in our data?

tiozab commented 7 months ago

@AlvaroMartinezERPSS but you have Run other Studies using our packages right? @catalamarti I really need your help here, please. Dus package Version 0.5.0

tiozab commented 7 months ago

@AlvaroMartinezERPSS we need to do some very basic checks:

can you verify that cdm$drug_exposure has drug_exposure_start_date and drug_exposure_end_date as date format in yyyy-mm-dd ?

image

AlvaroMartinezERPSS commented 7 months ago

Hi Theresa,

Yes, we have this format.

[imagen]

Kind regards,

Álvaro [cid:fae815e9-41ad-42c0-886c-8d3ac1bd9a0c]


De: Theresa Burkard @.> Enviado: martes, 26 de marzo de 2024 10:04 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

@AlvaroMartinezERPSShttps://github.com/AlvaroMartinezERPSS we need to do some very basic checks:

can you verify that cdm$drug_exposure has drug_exposure_start_date and drug_exposure_end_date as date format in yyyy-mm-dd ?

image.png (view on web)https://github.com/oxford-pharmacoepi/MegaStudy/assets/94674809/664d3574-b284-4750-bcb1-0bdd0bd841a0

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-2019875169, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCF3EPUOV2BDTO67ARTY2ETX5AVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJZHA3TKMJWHE. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/

AlvaroMartinezERPSS commented 7 months ago

@tiozab when running cdm$drug_exposure, we get this error: image But it works when accessing to other tables

tiozab commented 7 months ago

thanks @AlvaroMartinezERPSS can you let us know your db <- DBI::dbConnect(....) statement especially with regards to the driver?

and also run the following library(odbc) sort(unique(odbcListDrivers()[[1]]))

tiozab commented 7 months ago

@AlvaroMartinezERPSS your connection should look like this , please scroll down to SQL Server https://darwin-eu.github.io/CDMConnector/articles/a04_DBI_connection_examples.html

AlvaroMartinezERPSS commented 7 months ago

@tiozab, we are using the connection as it appears in the link:

From our code:

                  db <- DBI::dbConnect(odbc::odbc(),
                                       Driver = "SQL Server",
                                       Server = '',
                                       Database = 'OMOP',
                                       UID = '',
                                       PWD = '',
                                       TrustServerCertificate="yes",
                                       Port = 
                  )

And when running the code you sent

sort(unique(odbcListDrivers()[[1]])) [1] "ODBC Driver 17 for SQL Server" "SQL Server" "SQL Server Native Client 11.0"

AlvaroMartinezERPSS commented 7 months ago

@tiozab we modified the Driver from "SQL Server" to "ODBC Driver 17 for SQL Server" and the error was solved. The code continued running but we are getting now a different one:

image

tiozab commented 7 months ago

thanks @AlvaroMartinezERPSS the denominator was created how do your cdm$drug_cohorts look like ? image

AlvaroMartinezERPSS commented 7 months ago

@tiozab cohort_definition_id is double and subject_id is int:

image

tiozab commented 7 months ago

@AlvaroMartinezERPSS , what about your cdm$denominator?

AlvaroMartinezERPSS commented 7 months ago

@tiozab image

tiozab commented 7 months ago

@AlvaroMartinezERPSS ok, great. Despite your drug_cohorts and denominator looking good and you are using "Package": "IncidencePrevalence", "Version": "0.6.0", this is where it crashes, right?

inc <- estimateIncidence( cdm = cdm, denominatorTable = "denominator", outcomeTable = "drug_cohorts", interval = "years", completeDatabaseIntervals = FALSE, outcomeWashout = 30, repeatedEvents = TRUE, minCellCount = 10, temporary = TRUE )

AlvaroMartinezERPSS commented 7 months ago

@tiozab I think it crashes in the previous line: cdm$drug_cohorts <- cdm$drug_cohorts |> omopgenerics::newCohortTable(cohortSetRef = settings(cdm$drug_cohorts) |> dplyr::filter(cohort_definition_id %in% cdi), cohortAttritionRef = NULL)

image

tiozab commented 7 months ago

ah. my bad. @AlvaroMartinezERPSS please delete these lines that we have added in the course of debugging, sorry, these are not relevant any more _cdi <- cohortCount(cdm$drug_cohorts) |> filter(number_records > 0) |> dplyr::pull(cohort_definition_id)

cdm$drug_cohorts <- cdm$drug_cohorts |> omopgenerics::newCohortTable(cohortSetRef = settings(cdm$drug_cohorts) |> dplyr::filter(cohort_definitionid %in% cdi), cohortAttritionRef = NULL)

AlvaroMartinezERPSS commented 7 months ago

Hi Theresa,

We have managed to execute it successfully. We have just uploaded the results in the Teams folder IncidencePrevalence < Uploads from datapartners > New results We are very grateful for all your help.

Kind regards,

Álvaro

[cid:02960959-41a8-4e3a-9216-f7e0e89d9e2b]


De: Theresa Burkard @.> Enviado: miércoles, 3 de abril de 2024 12:46 Para: oxford-pharmacoepi/MegaStudy @.> Cc: ÁLVARO MARTÍNEZ PÉREZ @.>; Mention @.> Asunto: Re: [oxford-pharmacoepi/MegaStudy] Error in PatientProfiles::addDemographics(cohort, sex = FALSE, age = FALSE) : Assertion on 'inherits(x %>% utils::head(1) %>% dplyr::pull(indexDate), c("Date", "POSIXt"))' failed: Must be TRUE. (Issue #26)

ADVERTENCIA: Este correo proviene de una fuente externa a la organización. No abra el contenido ni los enlaces a no ser que confíe en el remitente y sepa que el contenido es seguro.

ah. my bad. please delete these lines that we have added in the course of debugging, sorry, these are not relevant any more _cdi <- cohortCount(cdm$drug_cohorts) |> filter(number_records > 0) |> dplyr::pull(cohort_definition_id)

cdm$drug_cohorts <- cdm$drug_cohorts |> omopgenerics::newCohortTable(cohortSetRef = settings(cdm$drug_cohorts) |> dplyr::filter(cohort_definitionid %in% cdi), cohortAttritionRef = NULL)

— Reply to this email directly, view it on GitHubhttps://github.com/oxford-pharmacoepi/MegaStudy/issues/26#issuecomment-2034226841, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6UFUCG3YXEJJY3BKCTTKVLY3PMWVAVCNFSM6AAAAABD5ZNR6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZUGIZDMOBUGE. You are receiving this because you were mentioned.Message ID: @.***>

Este correo electrónico y la información contenida en el mismo es de carácter confidencial y está sometida al secreto profesional, dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si el receptor de la comunicación no fuera el destinatario, le informamos que cualquier divulgación, copia, distribución o utilización no autorizada de la información contenida en la misma está prohibida por la legislación vigente. Asimismo, le informamos de que, de conformidad con la Ley 3/2018, de 5 de diciembre, de Protección de Datos Personales, sus datos de carácter personal serán tratados por la Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, en cumplimiento de la relación existente, y/o para el envío de información institucional. Igualmente le informamos de que mantendremos sus datos durante toda la relación contractual o negocial existente con Ud., mientras no revoque el consentimiento ni ejerza su derecho de supresión u oposición, y sin perjuicio del plazo durante el cual los datos deberán conservarse para cumplir con las obligaciones legales aplicables. Sus datos no serán cedidos a terceros salvo que fuera necesario por obligación legal. Asimismo, le informamos de que cuenta con los derechos de acceso, rectificación, supresión, limitación del tratamiento, oposición y portabilidad, así como la posibilidad de revocar su consentimiento, los cuales puede ejercitar remitiendo un correo electrónico a @.*** Para más información puede acceder a nuestra Política de Privacidad https://www.iislafe.es/es/privacidad/

We inform you that, in accordance with Law 3/2018, of December 5, on the Protection of Personal Data, your personal data will be processed by the Fundación para la Investigación del Hospital Universitario y Politécnico La Fe de la Comunidad Valenciana, in compliance with the existing relationship, and / or for sending institutional information. Likewise, we inform you that we will keep your data throughout the existing contractual or business relationship with you, as long as you do not revoke the consent or exercise your right to cancel or oppose, and without prejudice to the period during which the data must be retained to comply with the applicable legal obligations. Your data will not be disclosed to third parties unless it is necessary due to legal obligation. Likewise, we inform you that you are entitled to access, rectify, delete, limit, oppose and port, as well as revoke your consent, being able to enforce them by contacting @.*** For further information, you can access to our Privacy Policy https://www.iislafe.es/es/privacidad/