ARS-toscana / ConcePTIONAlgorithmPregnancies

Repository of the script of the ConcePTION Algorithm for Pregnancies
GNU Affero General Public License v3.0
5 stars 3 forks source link

EUROCAT cases overwritten by PROMPT in step_07_01_create_aggregated_tables.R #68

Closed alexcoldea closed 1 year ago

alexcoldea commented 1 year ago

Hello,

The script is producing wrong outputs (very small numbers) in the TableStream_2015_2019.csv file for the EUROCAT data for each year.

After troubleshooting I noticed the numbers are getting overwritten as the stream gets assigned to a different value each time (e.g "CONCEPTSETS", "ITEMSETS", "EUROCAT", "PROMPTS") when each of these values is "yes" in the table. This means that when a "PROMPT" is "no" but "EUROCAT" is set to "yes" for that specific pregnancy the result will not be taken into consideration. As soon as I changed the order:

D3_pregnancy_reconciled_valid <- D3_pregnancy_reconciled_valid[EUROCAT == "yes", stream:= "EUROCAT"] D3_pregnancy_reconciled_valid <- D3_pregnancy_reconciled_valid[PROMPT == "yes", stream:= "PROMPT"]

to

D3_pregnancy_reconciled_valid <- D3_pregnancy_reconciled_valid[PROMPT == "yes", stream:= "PROMPT"] D3_pregnancy_reconciled_valid <- D3_pregnancy_reconciled_valid[EUROCAT == "yes", stream:= "EUROCAT"]

the table returned the correct results.

This can be found in step_07_01_create_aggregated_tables.R in step_07_01_create_aggregated_tables.R between lines 25-30. Was this the intended behaviour?

Thank you. Best, Alex

GiorgioLimoncella commented 1 year ago

Hi @alexcoldea,

thanks a lot for reporting and fixing the bug, I will include the changes you suggest in the release 5.0.

Best, Giorgio