-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup PETL with jobs "diagnosis," "services," and "visit" #28
Conversation
@MiguelAHPpih was this PR supposed to just have the PETL reports in it? It seems to have a bunch of other stuff as well. |
@mogoodrich It should be only about petl, but looks like it merged with the sample-collection branch. This was unexpected. |
Ah... is the sample-collection branch something we want to merge as well, or does the PR need to be reworked? |
You can |
I'm going to clear any issues it has and then merge it, if that's okay with you. |
Sure, that's fine. Me? I don't remember, can you link to the PR you're talking about? |
I was refering to @mogoodrich , since he mentioned it in the sample-collection PR #26 |
Oh yeah, right, we already have a PR for that, and there are a bunch of JavaScript issues we were talking about there: #26 . It would be great if we could deal with that separately from all this PETL stuff. |
@MiguelAHPpih If you just |
@MiguelAHPpih Now this branch is deleting files, while master is editing those same files, causing conflicts. Instead of deleting those files, you can |
@brandones All done!. Thanks for the help |
(count(encounter_type)/(WEEK(MAX(encounter_datetime)) - WEEK(MIN(encounter_datetime))+1)) as frecuencia_mes, | ||
(count(encounter_type)/(MONTH(MAX(encounter_datetime))-MONTH(MIN(encounter_datetime))+1)) as frecuencia_mes, | ||
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 01 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, | ||
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 12 AND 23 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 ) as frecuencia_tarde |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tal vez queriras excluyir 00:00 y 23:59, que son horas associadas con encuentros sin hora exacto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incluyo las 24 horas para contar todos los encuentros que se hayan hecho, ya que por motivos de red algunas citas puede que no se registren ese mismo día en que se realizo el registro y tenga que hacerlo el siguiente.
No se si eso te parece correcto.
select 'tuberculosis',(count(encounter_type))/251 as frecuencia_dia, | ||
(count(encounter_type)/(WEEK(MAX(encounter_datetime)) - WEEK(MIN(encounter_datetime))+1)) as frecuencia_mes, | ||
(count(encounter_type)/(MONTH(MAX(encounter_datetime))-MONTH(MIN(encounter_datetime))+1)) as frecuencia_mes, | ||
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 01 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 01 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, | |
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 00 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, |
no? Para la hora despues de medianoche?
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 01 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, | ||
(select count(encounter_type)/251 from encounter where HOUR (encounter_datetime) BETWEEN 12 AND 23 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 ) as frecuencia_tarde | ||
from encounter | ||
where encounter_type=@tb_general and YEAR(encounter_datetime) = @YEAR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El calculacion que quieres es para este año del calendario?
En este caso, debes adaptar el numero de dias de trabajo (251) para ser el numero aproximo de estos dias que han pasado, no? Algo como DATEDIFF(NOW(), YEAR(NOW) + "-1-1") / 365 * 251
?
O quieres calcular por los ultimos 365 dias?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Que hace el "-1-1"(puedes explicarlo en ingles para mayor precisión)?
PD: Gracias por el tip, la idea era al principio esa pero no encontré un modo de aplicarla en el momento..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YEAR(NOW) + "-1-1"
debe producir 2021-1-1
, la fecha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Se supone que arroja un null en lugar de un decimal o un integer ?. Además, ejecutar YEAR (NOW) +" -1-1 "
, muestra solo el año 2020 en lugar del formato de fecha completo y el año correcto. Quizás sería mejor dejarlo con "2021-01-01" por ahora.¿?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh noooo, SQL es un fracaso. Hace CONCAT(YEAR(NOW()), '-01-01')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All done!
@MiguelAHPpih Hay unos errores y unas preguntas. |
Co-authored-by: Brandon Istenes <[email protected]>
Co-authored-by: Brandon Istenes <[email protected]>
Co-authored-by: Brandon Istenes <[email protected]>
Co-authored-by: Brandon Istenes <[email protected]>
select 'covid',(count(encounter_type))/@diaslaborales as frecuencia_dia, | ||
(count(encounter_type)/(WEEK(MAX(encounter_datetime)) - WEEK(MIN(encounter_datetime))+1)) as frecuencia_semana, | ||
(count(encounter_type)/(MONTH(MAX(encounter_datetime))-MONTH(MIN(encounter_datetime))+1)) as frecuencia_mes, | ||
(select count(encounter_type)/@diaslaborales from encounter where HOUR (encounter_datetime) BETWEEN 01 AND 11 AND MINUTE (encounter_datetime) BETWEEN 00 AND 59 )as frecuencia_manana, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still missing the hour after midnight, from 0:00 to 0:59. But you might want to just do 0:01 to 0:59 to exclude dates with no actual time associated with them.
Co-authored-by: Brandon Istenes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @MiguelAHPpih , thanks!
No description provided.