Feed Manager ordering

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
8/11/2010 9:44:57 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Feed Manager ordering

Hi Joe, we have a situation with one of our feeds. The RSS feed is not providing a separate pubDate field, but the items are actually ordered ascending in the XML, and it's important that that order be kept. Since there are no dates, our displayed feed is coming up randomly scrambled. Here's the feed in question if you want to take a look at it: http://host7.evanced.info/escondido/lib/eventsxml.asp?ag=&et=&lib=ALL&nd=30&dm=rss2&LangType=0

So, our request is that the Feed Manager display items in the same order they came down in the feed, if there is no provided date. Alternatively, maybe this should be a setting on the feed itself--sort by date (ascending/descending) or by received order.

Thanks!

Jamie

8/12/2010 9:00:44 AM
Gravatar
Total Posts 18439

Re: Feed Manager ordering

Hi  Jaime,

The items are sorted ascending by what, title?

Maybe you could pre-process the feed, Does yahoo pipes have a way to add a sequential timestamp as the pubDate?

How would we sort if some feeds have dates and some do not?

The only thing in the database currently that could possibly be used as a sort is the cache time of the item which should correspond to the sequence in which items were refreshed from the feed. But it seems like attempts to use that may affect the sort of other feeds.

Best,

Joe

8/12/2010 10:22:49 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

Hey Joe, as far as I can tell, it's not sorting at all--it looks completely random. This is a sample of how they appear on our test site:


Holiday Closure
When: Monday, September 06, 2010 - All Day
Where: All Branches
Labor Day holiday closure

Rhymes and Reading with Mrs. Cox
When: Monday, August 16, 2010 - 11:00 AM
Where: Escondido Public Library - Main at Children's Storytime
Stories, Songs and Fingerplays prepare your young children for reading.

Cowboy Charlie
When: Thursday, September 02, 2010 - 10:30 AM
Where: Escondido Public Library - Main at Children's Room
Sing along with classic campfire songs!

Chess Club for Kids
When: Monday, August 23, 2010 - 3:30 PM
Where: Escondido Public Library - Main at Childrens
A hands-on learning experience for kids with the goal of having fun, gaining knowledge and enjoying true sportsmanship. This program is FREE and for kids of all ages. Learn to Win or Play for Fun!

Library Board of Trustees
When: Thursday, August 12, 2010 - 2:00 PM
Where: Escondido Public Library - Main at Board Room


The CachedTimeUTC field is a good idea, but I don't think it would work, at least for those of us using MySQL. I'm fairly new to MySQL, and after querying the database and searching this morning, I just found (to my shock) that date fields only capture precision to the second (microseconds are truncated). This is a MySQL bug/enhancement request that's been open more than five years!

So, my wish is that there could be a numerical sequence database field added that holds the received order of the entries for each feed, and a Feed Manager instance setting that lets the user choose the sorting method (date or sequence). Of course, the chosen sort order would be applied to all feeds in the instance.

I'll try Yahoo Pipes as a backup too, but I'm not sure if I'll be able to reliably translate that "When" date to a pubDate. "When" is actually in the description of the item, and it looks like it might vary per entry.

Thanks,
Jamie

8/12/2010 10:33:10 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

Hi Joe, I was just thinking that maybe you wouldn't need a new feature setting at all. If you sorted first by date, then by sequence, that should be enough to keep everything in the right order.

Jamie

8/12/2010 10:37:13 AM
Gravatar
Total Posts 18439

Re: Feed Manager ordering

Hi Jamie,

You said:

The RSS feed is not providing a separate pubDate field, but the items areactually ordered ascending in the XML, and it's important that that order be kept.

so I was asking what they are sorted ascending by in the original feed?

With Yahoo pipes I would not try to parse the date out of the content I would just try to add a sequential date in the same sequence as the original feed like DateTime.Now + some incrementing factor

then the output field would have a pubdate in the correct order.

That is very interesting and surprising about MySql, I did not know it had this limitation. It hasn't caused any noticeable problems in the years I've used it until now but a very bad bug indeed for a database platform.

Best,

Joe

8/12/2010 10:40:18 AM
Gravatar
Total Posts 18439

Re: Feed Manager ordering

There is no integer id in the table so it has no natural sort or sequence. It may go into the database in a specific sequence but it is not captured other than the cache time and it may come out in any sequence if we can't order by something specific.

8/12/2010 11:38:20 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

so I was asking what they are sorted ascending by in the original feed?

They appear in the XML ascending by the "When:" date/time that's shown in the description field. This is an RSS feed translation of an online calendaring application.

There is no integer id in the table so it has no natural sort or sequence

Yep, I understand that this is the source of the problem. Can an integer sequence field be added and used as an enhancement, or would that cause too many problems?

With Yahoo pipes I would not try to parse the date out of the content I would just try to add a sequential date in the same sequence as the original feed like DateTime.Now + some incrementing factor

That makes sense. I'll see if I can figure out a way to do that.

Thanks!

Jamie

8/16/2010 3:23:00 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

Hi Joe. I had no luck trying to build up a date with Yahoo! Pipes (it's surprisingly limited in some ways), but I did manage to parse out the date from the description field and assign it to y:published (which then becomes pubDate). That, combined with sorting the feed manager instance ascending gives us a serviceable workaround for now. I'd still appreciate it if you'd consider adding this request to your future to-do list, maybe when you happen to be revisiting Feed Manager. Relying on the parsing we're doing now kind of seems like a house of cards!

Thanks a bunch,

Jamie

1/26/2012 12:19:29 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

Hi Joe, I wanted to revive this thread, since it seems there may be a better solution on the horizon for this. According to the changelog for MySQL 5.6.4, they are adding fractional second precision to date fields (up to microseconds). This version won't hit general availability for awhile, but I wanted to give you a heads-up so you can hopefully add an option to sort feeds by cached time instead of pubDate in an upcoming version.

Thanks,
Jamie

1/26/2012 1:04:42 PM
Gravatar
Total Posts 18439

Re: Feed Manager ordering

Hi Jamie,

Adding a setting to sort by cache time seems like a very arbitrary thing to do that no-one else would use so I'd rather not add it.

However if the feed has no pubdate then we are assigning a pubdate of DateTime.UtcNow and since they are processed in the order that they appear in the feed, that should result in what you want once MySql is storing dates at higher resolution because DateTime.UtcNow that we assign should be slightly different for each one and really is equivalent to the cache time anyway.

Best,

Joe

1/26/2012 1:35:13 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Feed Manager ordering

Perfect Joe, that sounds like what we need. I'll follow up here when the time comes I can actually test this!

Jamie

You must sign in to post in the forums. This thread is closed to new posts.