Page MenuHomePhabricator

Reader gets page references
Closed, DeclinedPublic

Description

"As a Reader, I want to have a list of all references on a page, so that I can review and compare them in different ways."

Probably a paginated list. Contents of the reference TBD, but probably fair to say it would be a "short" version, with longer version. Should include the anchor(s) in the page.


GET /page/{title}/references?(before={before}|after={after})

Return one section of the list of references for the page.

Parameters:

  • title: title of the page
  • before: if provided, only show references strictly before this id (non-inclusive). This is primarily for segmenting the list.
  • after: if provided, only show references strictly after this id (non-inclusive). Also for segmentation. Only one of before or after are allowed.

Notable headers: none

Request body: none

Status codes:

  • 200: OK
  • 404: No such title
  • 400: No such id, or wrong parameters (both before and after)

Notable response headers: none

Response body: JSON object, with these properties:
next: full url of the next segment of the list, null if no more segments
prev: full url of the previous segment of the list, null if this is the first segment
first: full url of the first segment of the list
references: array of Reference objects from the Schema, up to 100. In the order that they appear in the page

Done Criteria
  • One section of the list of references is returned for a given page;
  • The proper status code is returned for each of three conditions/cases:
    • 200 - Title is valid and exists (It would be great to add an example)
    • 404 - Title is valid but doesn't exist (It would be great to add an example)
    • 400 - Title is invalid (Example)
  • Returned list must be segmented based on a LIMIT of 100 items;
  • Response object should match examples:;
  • Response object must contain the following fields:
    • next: full url of the next segment of the list, null if no more segments;
    • prev: full url of the previous segment of the list, null if this is the first segment;
    • first: full url of the first segment of the list.
    • references: array of Reference objects, in the order that they appear in the page
  • Reference object must contain the following fields:
    • id;
    • work;
    • pages;
  • Unit tests should cover 100% of code
  • Integration tests should automatically verify acceptance criteria.
Examples (assuming en.wikipedia.org):

Request:
GET: /page/Mars/references
Response:
Code:200
Body:

{
  "next":  "/page/Mars/references/?after=100",
  "prev": null,
  "first": "???",
  "refs": 
  [ //array of Reference 
    { 
    "id": "ISBN 978-1-4614-2302-7",
    "work": // Work
    { 
      "id": "some-title",
      "creator": //array of Persons
      [ 
        { 
          "id": "some-person-id", 
          "name": "Grego, Peter" 
        }
      ],
      "contributor": //array of Persons
      [ 
        { 
          "id": "some-person-id", 
          "name": "person-name" 
        }
      ],
      "publisher": // Publisher
      { 
        "id": "publisher-id",
        "name": "Springer Science+Business Media"
      },
      "date": "June 6, 2012",
      "description": "",
      "isPartOf": "???" //Propose to remove from PoC
    },
    "pages": //Page Range
    {
      "from": 1,
      "to": 25
    }
  },
  
... 99 more
  ]
}
Sources:
Plain text
Grego, Peter (June 6, 2012). Mars and How to Observe It. Springer Science+Business Media. p. 3. ISBN 978-1-4614-2302-7 – via Internet Archive.
Wikitext
<ref>{{cite book |first1=Peter |last1=Grego |title=Mars and How to Observe It |url=https://archive.org/details/marshowtoobserve0000greg |url-access=registration |page=[https://archive.org/details/marshowtoobserve0000greg/page/3 3] |publisher=[[Springer Science+Business Media]] |date=June 6, 2012 |isbn=978-1-4614-2302-7 |via=Internet Archive}}</ref>
Raw HTML
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7" aria-label="Jump up" title="Jump up">^</a></b></span> <span class="reference-text"><cite id="CITEREFGrego2012" class="citation book">Grego, Peter (June 6, 2012). <span class="cs1-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/marshowtoobserve0000greg"><i>Mars and How to Observe It</i></a></span>. <a href="/wiki/Springer_Science%2BBusiness_Media" title="Springer Science+Business Media">Springer Science+Business Media</a>. p.&nbsp;<a rel="nofollow" class="external text" href="https://archive.org/details/marshowtoobserve0000greg/page/3">3</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<a href="/wiki/Special:BookSources/978-1-4614-2302-7" title="Special:BookSources/978-1-4614-2302-7"><bdi>978-1-4614-2302-7</bdi></a> – via Internet Archive.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Mars+and+How+to+Observe+It&amp;rft.pages=3&amp;rft.pub=Springer+Science%2BBusiness+Media&amp;rft.date=2012-06-06&amp;rft.isbn=978-1-4614-2302-7&amp;rft.aulast=Grego&amp;rft.aufirst=Peter&amp;rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fmarshowtoobserve0000greg&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AMars" class="Z3988"></span><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r951705291"></span>
</li>
<ref name="tesla01">{{cite magazine |url=https://babel.hathitrust.org/cgi/pt?id=uiug.30112109670726;view=1up;seq=157 |title=Talking with the Planets |magazine=[[Collier's]] |first=Nikola |last=Tesla |volume=26 |issue=19 |pages=4–5 |date=February 9, 1901}}</ref>

Related Objects

StatusSubtypeAssignedTask
DeclinedNone
DeclinedNone
DeclinedNone

Event Timeline

eprodromou updated the task description. (Show Details)

@eprodromou Working out the requirements and acceptance criteria I've got a couple of questions:

  1. What should be an order of references? Is it how they appear in the text?
  2. Related to 1. : before / after what is going to be there? Number, date, some id?
  3. Pagination and next / prev fields: correct me if I'm wrong, that urls should be formed using before / after parameters?
  4. Usually, clients want to specify page_size (in our ) on their side, isn't it worth to specify this functionality in advance?
  5. Schema sais that reference object consists of fields:
    • id;
    • work;
    • pages;

Are they do we need them all to be provided by this request:

  • pages - it looks to be very expensive to find cross-pages for every ref. Shouldn't it be empty?
  • work name sounds a little bit confusing for me. Do we have a such term in Mediawiki already? Could you point pls?
Peter.ovchyn updated the task description. (Show Details)
Peter.ovchyn updated the task description. (Show Details)

@Peter.ovchyn I'll try to answer as best as I can.

  1. Ideally in order by appearance in the page, but I think that's loose. Most important is that it's a stable order, so that we can segment the list.
  2. Some kind of cursor; probably a reference ID. I think ID number as an index of references on the page, similar to how the footnote number comes up, would work, but I'm open to other options.
  3. Yes, correct.
  4. No, it's not. My experience working on APIs is that only a tiny minority of developers use this kind of feature, and it vastly complicates the code for segmenting lists. Until we have a client that actually needs it, we'll use a fixed segment size. Also, because "page" is a term in our problem domain, I use "segment" for dividing up lists, rather than "page". Otherwise things get too confusing!
  5. Yes, all three fields. "work" is a term in English that covers most creative expression or references, including video, audio, journal articles, books, web pages, etc. "source" might also be a good term here. We do not have a representation for this term in MediaWiki already. The "pages" is the page numbers for a reference, which is typical for bibliographic entries. A good example would be references 10-14 of the enwp article on the Barbary Wars, which refer to different page numbers in the same book (the "work"). I realise that "pages" is confusing, but I'm not sure how to rectify that. I'd like to leave it as "pages" for now.
Restricted Application added a subscriber: Liuxinyu970226. · View Herald Transcript

Adding Platform Engineering as the "Platform Team Workboards (User Stories)" project was archived and as its open tasks should not linger without any active project tag

matmarex subscribed.

Placeholder task from 2020. I don't think this project is happening.