I would like to create a variable that defines certain weeks. Community
health workers in the program do an active sweep of their village to seek
out patients every week. I would like to create a variable that defines
what week of the program the data gathering occurred in. I would also like
to create a variable that defines the epidemiological week of data
collection. How do I do this? I tried to do some math with the dates but I
couldn't make it work.This is what I wrote:
if(double(today)>=16621 and double(today)<=16627,"Ratissage
1",if(double(today)>=16628 and double(today)<=16634,"Ratissage
2",if(double(today)>=16635 and double(today)<=16641,"Ratissage
3",if(double(today)>=16642 and double(today)<=16648,"Ratissage
4",if(double(today)>=16649 and double(today)<=16655,"Ratissage 5","Pas
Commencer")))))
If you know the date that the enrollment started, the easiest thing to do
is likely to make a computed string to capture this.
You can use a hidden value to calculate the week post enrollment (I'm
pretending that '2015-06-05' is the "start date" here, you can either use a
different date or collect this somewhere else)
week_of_program = int((today() - date("2014-06-05")) div 7)
and then use a string join to actually get the displayable week (this will
round down, so week 1.3 = week 1, you can move the start date 7 days back
to make the 'first' week week 1 instead of week 0)
Does that seem like it would work with your use case?
-Clayton
···
On Thu, Jun 4, 2015 at 11:36 AM, Sarah Mollenkopf wrote:
I would like to create a variable that defines certain weeks. Community
health workers in the program do an active sweep of their village to seek
out patients every week. I would like to create a variable that defines
what week of the program the data gathering occurred in. I would also like
to create a variable that defines the epidemiological week of data
collection. How do I do this? I tried to do some math with the dates but I
couldn't make it work.This is what I wrote:
if(double(today)>=16621 and double(today)<=16627,"Ratissage
1",if(double(today)>=16628 and double(today)<=16634,"Ratissage
2",if(double(today)>=16635 and double(today)<=16641,"Ratissage
3",if(double(today)>=16642 and double(today)<=16648,"Ratissage
4",if(double(today)>=16649 and double(today)<=16655,"Ratissage 5","Pas
Commencer")))))
Yes, it does! I will try it out! Thank you for the prompt response!
···
On Thu, Jun 4, 2015 at 4:16 PM, Clayton Sims wrote:
Sarah,
If you know the date that the enrollment started, the easiest thing to do
is likely to make a computed string to capture this.
You can use a hidden value to calculate the week post enrollment (I'm
pretending that '2015-06-05' is the "start date" here, you can either use a
different date or collect this somewhere else)
week_of_program = int((today() - date("2014-06-05")) div 7)
and then use a string join to actually get the displayable week (this will
round down, so week 1.3 = week 1, you can move the start date 7 days back
to make the 'first' week week 1 instead of week 0)
Does that seem like it would work with your use case?
-Clayton
On Thu, Jun 4, 2015 at 11:36 AM, Sarah Mollenkopf smollenk@gmail.com wrote:
I would like to create a variable that defines certain weeks. Community
health workers in the program do an active sweep of their village to seek
out patients every week. I would like to create a variable that defines
what week of the program the data gathering occurred in. I would also like
to create a variable that defines the epidemiological week of data
collection. How do I do this? I tried to do some math with the dates but I
couldn't make it work.This is what I wrote:
if(double(today)>=16621 and double(today)<=16627,"Ratissage
1",if(double(today)>=16628 and double(today)<=16634,"Ratissage
2",if(double(today)>=16635 and double(today)<=16641,"Ratissage
3",if(double(today)>=16642 and double(today)<=16648,"Ratissage
4",if(double(today)>=16649 and double(today)<=16655,"Ratissage 5","Pas
Commencer")))))
-- Preventative Health Educator US Peace Corps Senegal MPH Epidemiology Candidate Tulane University School of Public Health and Tropical Medicine Master's International Program E:smollenk@gmail.com P: +221.77.673.0087
Are you also trying to detect the week of the year for a specific date input, or are you trying to detect how many weeks have passed since a given date?