Version: 2011.01.25

Krames StayWell External Web Service Documentation

Using Collections For Web Site Layout

The UCR has two types of collections: standard and dynamic.

Dynamic collections are, as the name implies, a constantly changing list of content that meet the criteria of the dynamic collection. Example criteria would be “all English content in the Daily News content type” or “All content that has the MeSH code for ‘cancer' assigned.” There is no order or organization to a dynamic collection other than the fact that all content in the dynamic collection matches the criteria; this makes dynamic collections unsuitable for website layout.

Standard collections, on the other hand, are structured by assigning specific content to subtopics within the collection. Standard collections can have one or more subtopics, and subtopics may be nested within other subtopics. This kind of organization is also known as a tree-view structure.

The UCR Web Services has two methods related to standard collections: ListCollections and GetCollectionContents.

The ListCollections method simply returns all standard collections assigned to your license in an XML document formatted as follows:

<CollectionList xmlns="http://ws.staywell.com">
	<Collection>
		<CollectionId>1111</CollectionId>
		<RootSubtopicId>12345</RootSubtopicId>
		<CollectionName>a collection</CollectionName>
	</Collection>
	...
	<Collection>
		<CollectionId>2222</CollectionId>
		<RootSubtopicId>23456</RootSubtopicId>
		<CollectionName>documents about</CollectionName>
	</Collection>
</CollectionList>

There will be one “Collection” element for each standard collection assigned to your license. Each element contains child elements with the ID's necessary to get detailed information of each collection using the GetCollectionContents method.

If you think of a standard collection as a tree, the Collection Id is a reference to the tree as a whole, the Root Subtopic Id is the trunk of the tree, Subtopic Ids are the branches, and Content Ids are the leaves.

The GetCollectionContents method can be called with the RootSubtopicId only, which results in an XML document similar to this:

<Subtopic SubtopicId="8700" xmlns="http://ws.staywell.com">
	<Name>About Cancer</Name>
	<SubtopicList>
		<Subtopic SubtopicId="8704">
			<Name>Basics</Name>
		</Subtopic>
		<Subtopic SubtopicId="8702">
			<Name>Learn About Your Diagnosis</Name>
		</Subtopic>
		<Subtopic SubtopicId="8707">
			<Name>Treatment</Name>
			<SubtopicList>
				<Subtopic SubtopicId="9675">
					<Name>Advanced Reading About Treatment</Name>
				</Subtopic>
			</SubtopicList>
		</Subtopic>
		<Subtopic SubtopicId="8703">
			<Name>Managing Side Effects</Name>
		</Subtopic>
		<Subtopic SubtopicId="8706">
			<Name>Living With</Name>
		</Subtopic>
		<Subtopic SubtopicId="8705">
			<Name>Prevention, Risk, and Screening</Name>
		</Subtopic>
	</SubtopicList>
</Subtopic>

This XML can be transformed by you to act as a menu, in a section of your site about cancer, for example. It would look something like this:

About Cancer
	Basics
	Learn About Your Diagnosis
	Treatment
		Advanced Reading About Treatment
	Managing Side Effects
	Living With
	Prevention, Risk, and Screening

Each of the subtopic names in blue above would be links to other areas of your site. For example, the “Basics” link would take you to a page about the basics of cancer, something like this:

<a href="/cancer/DisplaySubtopic.aspx?SubtopicId=8704">Basics</a>

The destination page can list the content that is assigned to this subtopic by again calling GetCollectionContents, this time using the SubtopicId passed to the page and adding the parameter: IncludeContent=”true”. This results in an XML document similar to this:

<Subtopic SubtopicId="37683">
	<Name>Test Collection</Name>
	<ContentList>
		<ContentObject ViewCount="0" ContentTypeId="1" ContentId="2523" IsCustom="false" Blocked="false" ContentObjectId="58804" ContentObjectType="Document">
			<Language Code="en">English</Language>
			<RegularTitle>Migraines No Match for Monica Seles</RegularTitle>
			<GenderCode>A</GenderCode>
			<AgeGroups>
				<AgeGroup>Adult (18+)</AgeGroup>
			</AgeGroups>
			<AdditionalTitles>
				<AdditionalTitle />
			</AdditionalTitles>
		</ContentObject>
		<ContentObject ViewCount="0" ContentTypeId="6" ContentId="636044" IsCustom="false" Blocked="false" ContentObjectId="184316" ContentObjectType="Document">
			<Language Code="en">English</Language>
			<RegularTitle>Ibuprofen May Help Stave Off Parkinson's</RegularTitle>
			<GenderCode>A</GenderCode>
			<AgeGroups>
				<AgeGroup>Infant (0 - 11 mo)</AgeGroup>
				<AgeGroup>Childhood (11 mo - 12 yrs)</AgeGroup>
				<AgeGroup>Teen (12 - 18 yrs)</AgeGroup>
				<AgeGroup>Adult (18+)</AgeGroup>
				<AgeGroup>Senior</AgeGroup>
			</AgeGroups>
			<AdditionalTitles>
				<AdditionalTitle />
			</AdditionalTitles>
		</ContentObject>
	</ContentList>
</Subtopic>

This would be transformed into a menu on your site, like this:

Basics
	What Is Cancer?
	Statistics About Cancer
	What Are the Symptoms of Cancer?

The titles in blue above would link to a page in the cancer/basics area of your site that displays that specific content, using the ContentTypeId and ContentId attributes of the Content element. Similar to this:

<a href="/cancer/basics/displaydocument.aspx?ContentTypeId=999&ContentId=12345">What Is Cancer?</a>

As you can see, there is a lot of other information included with each content object in the GetCollectionContents result. You could, for example, display the InvertedTitle and/or AdditionalTitle values instead of (or in addition to) the RegularTitle:

Basics
	Cancer, What Is?
	Cancer, Statistics About
	Cancer, What Are the Symptoms of?

or

Basics
	Cancer, What Is?
	Cancer, Statistics About
	Cancer, What Are the Symptoms of?
	Statistics About Cancer
	Symptoms of Cancer, What Are They?
	What Is Cancer?
	What Are the Symptoms of Cancer?

You could filter the list of content based on Language and/or AgeBins (age categories):

	Adult Cancer Basics
	Cancer, What Is?
	Cancer, Statistics About

You could choose to display only the first three or four content objects in a subtopic that has too many objects to display in the area you've designated, or display a few random content objects from the list each time the page is refreshed.