changeset 0:f1b99ddda256

Origination.
author Atul Varma <varmaa@toolness.com>
date Thu, 31 Dec 2009 11:38:15 -0800
parents
children 8721d49f46be
files README.txt interfaces.py test.py
diffstat 3 files changed, 158 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt	Thu Dec 31 11:38:15 2009 -0800
@@ -0,0 +1,42 @@
+The Daily Edition is created anew each morning. It contains a number
+of articles from a variety of RSS feeds.
+
+Each issue can only contain a maximum number of articles, as
+specified by the reader. Optionally, the reader may also specify
+a maximum number of articles by the same author, to ensure
+diversity of sources.
+
+The RSS feeds drawn from each issue are found by querying whoisi.com
+for the names of various individuals called "influencers", which are
+an ordered list provided by the reader.  The list is ordered from
+"most influential" to "least influential".
+
+The program creating each issue is "aware" of what previous issues
+have contained, so as to ensure that no two issues have the same
+article.
+
+Whether an influencer's article is included in an issue should take
+into account:
+
+ * Influence
+   the author's rank, from 0 (highest) to [of authors] (lowest).
+   (lower -> higher likelihood of inclusion)
+
+ * Recency
+   time passed since the article was first written.
+   (more recent -> higher likelihood of inclusion)
+
+ * Diversity
+   time passed since the author was last featured in an issue.
+   (less recent -> higher likelihood of inclusion)
+
+data stores:
+
+* a collection of AUTHORS, each AUTHOR has a NAME and RANK. The
+  NAME is a unique identifier.
+
+* a collection of ARTICLES, each ARTICLE has an AUTHOR, TITLE, DATE,
+  CONTENT, and URL.  The URL is a unique identifier.
+
+* a collection of ISSUES, each ISSUE has a NUMBER, DATE and a list
+  of ARTICLES. The NUMBER is a unique identifier.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/interfaces.py	Thu Dec 31 11:38:15 2009 -0800
@@ -0,0 +1,111 @@
+class IArticle(object):
+    """
+    Represents an article written by someone; usually a blog post.
+    """
+
+    @property
+    def url(self):
+        """
+        The URL for the article, as a Unicode string.
+        """
+
+        raise NotImplementedError()
+
+    @property
+    def title(self):
+        """
+        The article's title, as a Unicode string.
+        """
+
+        raise NotImplementedError()
+
+    @property
+    def content(self):
+        """
+        The article's content, as a Unicode HTML string.
+        """
+
+        raise NotImplementedError()
+
+    @property
+    def pub_date(self):
+        """
+        The article's publication date, as a datetime.datetime object.
+        """
+
+        raise NotImplementedError()
+
+    @property
+    def author(self):
+        """
+        The article's author; an object that exposes an IAuthor
+        interface.
+        """
+
+        raise NotImplementedError()
+
+class IAuthor(object):
+    """
+    Represents someone who writes articles.
+    """
+
+    @property
+    def name(self):
+        """
+        The author's full name, as a Unicode string.
+        """
+
+        raise NotImplementedError()
+
+    @property
+    def aliases(self):
+        """
+        The author's aliases; a tuple of Unicode strings.
+        """
+
+        raise NotImplementedError()
+
+class IArticleRepository(object):
+    """
+    Represents a library of articles.
+    """
+
+    def get_articles(self, author, start_date, end_date):
+        """
+        Return a tuple of IArticle objects by the given IAuthor that
+        were published between the given datetime.datetime dates
+        (inclusive).
+        """
+
+        raise NotImplementedError()
+
+class IIssue(object):
+    """
+    Represents an issue, or edition, that captures a number of
+    articles published between two dates (inclusive).
+    """
+
+    def articles(self):
+        """
+        Return a tuple of IArticle objects representing the
+        articles in the issue.
+        """
+
+        raise NotImplementedError()
+
+    def start_date(self):
+        """
+        A datetime.datetime object representing the starting date
+        of the period that this issue encapsulates.
+        """
+
+        raise NotImplementedError()
+
+    def pub_date(self):
+        """
+        A datetime.datetime object representing the publication
+        date of the issue, as well as the end date of the period
+        that this issue encapsulates.
+        """
+
+        raise NotImplementedError()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test.py	Thu Dec 31 11:38:15 2009 -0800
@@ -0,0 +1,5 @@
+import unittest
+
+class Tests(unittest.TestCase):
+    def testBasic(self):
+        raise NotImplementedError()