PASSWORD = os.environ["FLUID_PASSWORD"]

if not USERNAME:
    raise Exception("Please supply a fluid account username")

if not PASSWORD:
    raise Exception("Please supply a fluid account password")

conn = Connection.connect(USERNAME, PASSWORD)

print conn.username
print conn.user_info()
print conn.user_id()

# Adding an example of a video, i.e. a canonical work
videoWork = Work.create(conn)
videoWork.SetCanonicalTag("url", "http://www.youtube.com/watch?v=AaabJdRI3pE")
videoWork.SetCanonicalTag("title", "FET11 Instant Communities tool")
videoWork.SetCanonicalTag("author", ["Marcos Baez", "Lyubov Kolosovskaya"])
videoWork.SetPersonalTag("publisher", "mbaezpy")
videoWork.SetCanonicalTag("is_video", 1)

# Adding an example of a webpage
webpageWork = Work.create(conn)
webpageWork.SetCanonicalTag("url", "http://www.fet11.eu/instantcommunities#/panel/332")
webpageWork.SetCanonicalTag(
    "title", "Science Cafe with Robert Madelin: What more should be done to empower Young Scientists in Europe?"
)

# An example of a blog post
blogpostWork = Work.create(conn)
import os

USERNAME = os.environ["FLUID_USERNAME"]
PASSWORD = os.environ["FLUID_PASSWORD"]

if not USERNAME:
    raise Exception("Please supply a fluid account username")

if not PASSWORD:
    raise Exception("Please supply a fluid account password")

conn = Connection.connect(USERNAME, PASSWORD)

print conn.username
print conn.user_info()
print conn.user_id()

mylist = Collection(conn, 'mylistx1')
assert mylist.exists_in_fluid()

work = Work.create(conn)
print "Created new work", work.object_id
mylist.add_work(work)
print mylist.list_works()

work.set_canonical_tag('title', "Abc")
print work.get_canonical_tag('title')
work.set_personal_tag('title', "Def")
print work.get_personal_tag('title')
print work.title()
Example #3
0
PASSWORD = os.environ["FLUID_PASSWORD"]

if not USERNAME:
    raise Exception("Please supply a fluid account username")

if not PASSWORD:
    raise Exception("Please supply a fluid account password")

conn = Connection.connect(USERNAME, PASSWORD)

print conn.username
print conn.user_info()
print conn.user_id()

# Adding an example of a video, i.e. a canonical work
videoWork = Work.create(conn)
videoWork.SetCanonicalTag('url', 'http://www.youtube.com/watch?v=AaabJdRI3pE')
videoWork.SetCanonicalTag('title', 'FET11 Instant Communities tool')
videoWork.SetCanonicalTag('author', ['Marcos Baez', 'Lyubov Kolosovskaya'])
videoWork.SetPersonalTag('publisher', 'mbaezpy')
videoWork.SetCanonicalTag('is_video', 1)

# Adding an example of a webpage
webpageWork = Work.create(conn)
webpageWork.SetCanonicalTag(
    'url', 'http://www.fet11.eu/instantcommunities#/panel/332')
webpageWork.SetCanonicalTag(
    'title',
    'Science Cafe with Robert Madelin: What more should be done to empower Young Scientists in Europe?'
)
USERNAME = os.environ["FLUID_USERNAME"]
PASSWORD = os.environ["FLUID_PASSWORD"]

if not USERNAME:
    raise Exception("Please supply a fluid account username")

if not PASSWORD:
    raise Exception("Please supply a fluid account password")

conn = Connection.connect(USERNAME, PASSWORD)

print conn.username
print conn.user_info()
print conn.user_id()


mylist = Collection(conn, "mylistx1")
assert mylist.exists_in_fluid()

work = Work.create(conn)
print "Created new work", work.object_id
mylist.add_work(work)
print mylist.list_works()

work.set_canonical_tag("title", "Abc")
print work.get_canonical_tag("title")
work.set_personal_tag("title", "Def")
print work.get_personal_tag("title")
print work.title()
# prepare f100 articles to create objects in biar

file_location = "/Users/ian/sandbox/f1000/small-f1000.xml"
xml = open(file_location, "r").read()
soup = BeautifulStoneSoup(xml)

articles = soup.findAll("article")
for article in articles:
    doi =  article.doi.contents[0]
    title = article.title.contents[0]
    rating = article.rating.contents[0]
    pmid = doi2pmid(doi)

    print doi, pmid, rating
    # Adding an example of a video, i.e. a canonical work
    articleWork = Work.create(conn)
    articleWork.set_canonical_tag('title', str(title))
    articleWork.set_canonical_tag('doi', str(doi))
    articleWork.set_canonical_tag('pmid', str(pmid))
    # now I want to add the f000 tag, which if I need to I can, I can do with a call to the fluidinfo API
    articleWork.set_personal_tag('f1000rating', str(rating))


# prepare grant info and add objects into biar

file_location = "/Users/ian/sandbox/Beyond-Impact-Attribution-Repository/UKPMC+_Grants.xml"
xml = open(file_location, "r").read()
soup = BeautifulStoneSoup(xml)

records = soup.findAll("record")
for grant in records: