Skip to main content

Hi 

Im reading an API with health data that updates every week. The goal is to aumomatize the process so FME reads this API every week to take out the new data. Now this API has an attribute called “temporal” which has values like this: “2024-W30” or “2020-W10” which is just the year and the calendar week. 

The data goes back several years and each week the last week gets added.

I only want to use the latest data each week so what I need is somekind of a filter that looks at the attribute “temporal” and only takes the data from the current year with the highest numbered week which corresponds to the data that got added last week.  

Any suggestions on how I could do this? Thanks in advance

One idea would be to create an attribute “CurrentWeek” and then you can run the data through a Tester, Passing only the data which has a “temporal” value that equals the “CurrentWeek”. You could create this “CurrentWeek” attribute a couple of ways.

You could use a DateTimeStamper and DateTimeConverter, with the output format %Y-W%U.

Alternatively you could create that attribute in an AttributeCreator or AttributeManager by setting the value to

@DateTimeFormat(@DateTimeNow(),%Y-W%U)

.

If you are able to, you can create this attribute beforehand and use it to only read the data that matches that attribute.


Thanks Im new to FME so this is very helpful.

I understand correctly that this attirbute should change by itself every week?


Thanks Im new to FME so this is very helpful.

I understand correctly that this attirbute should change by itself every week?

Yes, the attribute created using the dedicated DateTimeStamper transformer or the “@DateTimeNow()” method will keep up to date with the current week. Both methods get the current date and time when they run, and then the formatting part changes it to only display the year and week.


Reply