Using data with surveys: FileStore

This notebook provides example EDSL code for methods for using data with an EDSL survey. In the steps below we show how to use the FileStore module to upload, share and retrieve data files at the Coop, and then create Scenario objects for the data to use it with a survey.

EDSL is an open-source library for simulating surveys, experiments and other research with AI agents and large language models. Before running the code below, please ensure that you have installed the EDSL library and either activated remote inference from your Coop account or stored API keys for the language models that you want to use with EDSL. Please also see our documentation page for tips and tutorials on getting started using EDSL.

What is a Scenario?

A Scenario is a dictionary of one or more key/value pairs representing data or content to be added to questions; a ScenarioList is a list of Scenario objects. Scenario keys are used as question parameters that get replaced with the values when the scenarios are added to the questions, allowing you to create variants of questions efficiently. Learn more about creating and working with scenarios here and here.

What is the Coop?

Coop is a platform for creating, storing and sharing LLM-based research. It is fully integrated with EDSL, allowing you to post, download and update objects directly from your workspace and at the Coop web app. The Coop also provides access to features for working with EDSL remotely at the Expected Parrot server. Learn more about these features in the remote inference and remote caching sections of the documentation page.

What is FileStore?

FileStore is a module for storing and sharing data files at the Coop to use in EDSL projects, such as survey data, PDFs, CSVs or images. In particular, it is designed for storing files to be used as as scenarios, and allows you to include code for easily retrieving and processing the files in your EDSL project, as we do in the examples below!

Example

In the example below we create scenarios for some data (a table at a Wikipedia page) and inspect them. Then we store the scenarios as a CSV and post it to the Coop using the file store. Then we retrieve the file and recreate the scenarios, and use them in a survey. We also post the survey, results and this notebook to the Coop for reference.

We start by creating importing the tools that we will use:

[1]:
from edsl import ScenarioList, Scenario
from edsl.scenarios.FileStore import CSVFileStore

Creating a scenario list for a Wikipedia table

EDSL comes with many methods for automatically generating scenarios for various data sources, such as PDFs, CSVs, docs, images, lists, dicts, etc. Here we use a method to automatically create a scenario list for a Wikipedia table, passing the URL and the number of the table on the page:

[2]:
s = ScenarioList.from_wikipedia("https://en.wikipedia.org/wiki/List_of_Billboard_Hot_100_number-one_singles_of_the_1980s",5)

We can inspect the scenario list that has been created:

[3]:
s.print(format="rich")
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Weeks at number one  Song                            Artist(s)                          ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 10                   "Physical"                      Olivia Newton-John                 │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 9                    "Bette Davis Eyes"              Kim Carnes                         │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 9                    "Endless Love"                  Diana Ross and Lionel Richie       │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 8                    "Every Breath You Take"         The Police                         │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 7                    "I Love Rock 'n' Roll"          Joan Jett and the Blackhearts      │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 7                    "Ebony and Ivory"               Paul McCartney and Stevie Wonder   │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 7                    "Billie Jean"                   Michael Jackson                    │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Call Me"                       Blondie                            │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Lady"                          Kenny Rogers                       │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Centerfold"                    The J. Geils Band                  │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Eye of the Tiger"              Survivor                           │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Flashdance... What a Feeling"  Irene Cara                         │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Say, Say, Say"                 Paul McCartney and Michael Jackson │
├─────────────────────┼────────────────────────────────┼────────────────────────────────────┤
│ 6                    "Like a Virgin"                 Madonna                            │
└─────────────────────┴────────────────────────────────┴────────────────────────────────────┘

We can rename the keys for convenience:

[4]:
s.parameters
[4]:
{'Artist(s)', 'Song', 'Weeks at number one'}
[5]:
s = s.rename({'Artist(s)':"artists", 'Song':"song", 'Weeks at number one':"weeks"})
[6]:
s.print(format="rich")
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ weeks  song                            artists                            ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 10     "Physical"                      Olivia Newton-John                 │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 9      "Bette Davis Eyes"              Kim Carnes                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 9      "Endless Love"                  Diana Ross and Lionel Richie       │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 8      "Every Breath You Take"         The Police                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "I Love Rock 'n' Roll"          Joan Jett and the Blackhearts      │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "Ebony and Ivory"               Paul McCartney and Stevie Wonder   │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "Billie Jean"                   Michael Jackson                    │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Call Me"                       Blondie                            │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Lady"                          Kenny Rogers                       │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Centerfold"                    The J. Geils Band                  │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Eye of the Tiger"              Survivor                           │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Flashdance... What a Feeling"  Irene Cara                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Say, Say, Say"                 Paul McCartney and Michael Jackson │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Like a Virgin"                 Madonna                            │
└───────┴────────────────────────────────┴────────────────────────────────────┘

We can save the scenarios to a CSV:

[7]:
s.to_csv("billboard_100_1980s.csv")

Storing data at the Coop using the file store

Here we use the CSV file store to store the file that we just created:

[8]:
fs = CSVFileStore("billboard_100_1980s.csv")

We can post a FileStore object to the Coop by calling the push() method on it. We can optionally pass a description and a visibility setting - public, unlisted (by default) or private:

[9]:
info = fs.push(description = "Wikipedia: List of Billboard Hot 100 number-one singles of the 1980s")

We can print the details of the posted object, including the URL and Coop uuid that we will need to retrieve it later:

[10]:
info
[10]:
{'description': 'Wikipedia: List of Billboard Hot 100 number-one singles of the 1980s',
 'object_type': 'scenario',
 'url': 'https://www.expectedparrot.com/content/add0b8ee-b127-4b5e-82ad-cd00ddaf2552',
 'uuid': 'add0b8ee-b127-4b5e-82ad-cd00ddaf2552',
 'version': '0.1.33',
 'visibility': 'unlisted'}

Retrieving a file and recreating scenarios

Here we retrieve the file from the file store and recreate scenarios:

[11]:
csv_file = CSVFileStore.pull("add0b8ee-b127-4b5e-82ad-cd00ddaf2552", expected_parrot_url="https://www.expectedparrot.com")
[12]:
s = ScenarioList.from_csv(csv_file.to_tempfile())
[13]:
s.print(format="rich")
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ weeks  song                            artists                            ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 10     "Physical"                      Olivia Newton-John                 │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 9      "Bette Davis Eyes"              Kim Carnes                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 9      "Endless Love"                  Diana Ross and Lionel Richie       │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 8      "Every Breath You Take"         The Police                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "I Love Rock 'n' Roll"          Joan Jett and the Blackhearts      │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "Ebony and Ivory"               Paul McCartney and Stevie Wonder   │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 7      "Billie Jean"                   Michael Jackson                    │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Call Me"                       Blondie                            │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Lady"                          Kenny Rogers                       │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Centerfold"                    The J. Geils Band                  │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Eye of the Tiger"              Survivor                           │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Flashdance... What a Feeling"  Irene Cara                         │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Say, Say, Say"                 Paul McCartney and Michael Jackson │
├───────┼────────────────────────────────┼────────────────────────────────────┤
│ 6      "Like a Virgin"                 Madonna                            │
└───────┴────────────────────────────────┴────────────────────────────────────┘

Using scenarios in a survey

We can use the scenarios with a survey by creating placeholders in the questions for the scenario keys, and adding the scenarios to the survey when we run it:

[14]:
from edsl import QuestionFreeText, QuestionMultipleChoice, QuestionCheckBox, QuestionList, Survey

q1 = QuestionFreeText(
    question_name = "topic",
    question_text = "What is the topic of the song {{ song }} by {{ artists }}?"
)

q2 = QuestionMultipleChoice(
    question_name = "sentiment",
    question_text = "What is the sentiment of the song {{ song }} by {{ artists }}?",
    question_options = [
        "Happy",
        "Sad",
        "Angry",
        "Romantic",
        "Nostalgic",
        "Empowering",
        "Melancholic",
        "Hopeful"
    ]
)

q3 = QuestionCheckBox(
    question_name = "themes",
    question_text = "What themes are present in the song {{ song }} by {{ artists }}?",
    question_options = [
        "Love",
        "Loss",
        "Struggle",
        "Celebration",
        "Social issues",
        "Other"
    ]
)

q4 = QuestionList(
    question_name = "other_themes",
    question_text = "What other themes are present?"
)

survey = (
    Survey(questions = [q1, q2, q3, q4])
    .add_targeted_memory(q4, q3)
    .add_stop_rule(q3, "'Other' not in themes")
)

results = survey.by(s).run()

We can filter, sort, select and print any components of the results that are generated. Note that the results include columns for all scenario keys, whether used in question texts or not:

[15]:
results.sort_by("song").select("song", "artists", "topic").print(format="rich")
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ scenario                        scenario                            answer                                    ┃
┃ .song                           .artists                            .topic                                    ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ "Bette Davis Eyes"              Kim Carnes                          "Bette Davis Eyes" by Kim Carnes is a     │
│                                                                     song that describes a woman who is        │
│                                                                     captivating, alluring, and somewhat       │
│                                                                     mysterious. The lyrics paint a picture of │
│                                                                     her as someone who has a magnetic charm   │
│                                                                     and a certain allure, much like the       │
│                                                                     iconic actress Bette Davis, known for her │
│                                                                     distinctive eyes and strong screen        │
│                                                                     presence. The song highlights her ability │
│                                                                     to enchant and mesmerize those around her │
│                                                                     with her unique and striking qualities.   │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Billie Jean"                   Michael Jackson                     The song "Billie Jean" by Michael Jackson │
│                                                                     is about a woman named Billie Jean who    │
│                                                                     claims that the narrator is the father of │
│                                                                     her child, which he denies. The lyrics    │
│                                                                     describe the emotional turmoil and        │
│                                                                     confusion caused by her accusations, as   │
│                                                                     well as the impact on his life and        │
│                                                                     reputation. The song addresses themes of  │
│                                                                     false accusations, infidelity, and the    │
│                                                                     consequences of fame. "Billie Jean" is    │
│                                                                     one of Michael Jackson's most famous      │
│                                                                     tracks and is known for its distinctive   │
│                                                                     bassline and compelling narrative.        │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Call Me"                       Blondie                             The song "Call Me" by Blondie is about a  │
│                                                                     passionate, whirlwind romance and the     │
│                                                                     excitement of a new relationship. The     │
│                                                                     lyrics convey a sense of urgency and      │
│                                                                     desire, with the protagonist inviting     │
│                                                                     their lover to call them anytime, day or  │
│                                                                     night. The song captures the intensity    │
│                                                                     and immediacy of falling in love and the  │
│                                                                     thrill of a deep, emotional connection.   │
│                                                                     It was released in 1980 and became one of │
│                                                                     Blondie's biggest hits, known for its     │
│                                                                     energetic beat and catchy chorus.         │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Centerfold"                    The J. Geils Band                   The song "Centerfold" by The J. Geils     │
│                                                                     Band, released in 1981, is about a man    │
│                                                                     who is shocked to discover that a girl he │
│                                                                     had a crush on in high school has become  │
│                                                                     a centerfold model in an adult magazine.  │
│                                                                     The lyrics describe his mixed emotions of │
│                                                                     surprise, nostalgia, and disillusionment  │
│                                                                     as he grapples with the image of the girl │
│                                                                     he once admired now being portrayed in a  │
│                                                                     provocative manner. The song combines     │
│                                                                     these themes with a catchy, upbeat        │
│                                                                     melody, making it a memorable hit from    │
│                                                                     the early '80s.                           │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Ebony and Ivory"               Paul McCartney and Stevie Wonder    The song "Ebony and Ivory" by Paul        │
│                                                                     McCartney and Stevie Wonder addresses     │
│                                                                     themes of racial harmony and unity. The   │
│                                                                     title metaphorically refers to the black  │
│                                                                     and white keys on a piano, symbolizing    │
│                                                                     how different races can come together to  │
│                                                                     create something beautiful. The lyrics    │
│                                                                     emphasize the importance of living        │
│                                                                     together in perfect harmony, despite      │
│                                                                     differences, and promoting mutual         │
│                                                                     understanding and cooperation.            │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Endless Love"                  Diana Ross and Lionel Richie        The song "Endless Love" by Diana Ross and │
│                                                                     Lionel Richie is about a deep, unwavering │
│                                                                     romantic love between two people. The     │
│                                                                     lyrics express a profound and enduring    │
│                                                                     affection, with the singers declaring     │
│                                                                     their eternal devotion and commitment to  │
│                                                                     each other. It's a classic love ballad    │
│                                                                     that celebrates the timeless and          │
│                                                                     unbreakable bond between lovers.          │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Every Breath You Take"         The Police                          The song "Every Breath You Take" by The   │
│                                                                     Police, released in 1983, is often        │
│                                                                     interpreted as a love song due to its     │
│                                                                     mellow and melodic tune. However, the     │
│                                                                     lyrics reveal a much darker theme. The    │
│                                                                     song is about obsession and surveillance, │
│                                                                     with the narrator expressing an intense   │
│                                                                     fixation on someone, watching their every │
│                                                                     move. Phrases like "Every breath you      │
│                                                                     take, every move you make, I'll be        │
│                                                                     watching you" suggest a sense of          │
│                                                                     possessiveness and control rather than    │
│                                                                     romantic love. The song has been widely   │
│                                                                     discussed and analyzed for its portrayal  │
│                                                                     of unhealthy obsession masked by a        │
│                                                                     seemingly gentle melody.                  │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Eye of the Tiger"              Survivor                            "Eye of the Tiger" by Survivor is a song  │
│                                                                     about perseverance, determination, and    │
│                                                                     fighting spirit. It was famously used as  │
│                                                                     the theme song for the movie "Rocky III," │
│                                                                     and its lyrics convey the idea of rising  │
│                                                                     up to challenges, staying focused, and    │
│                                                                     maintaining the will to succeed despite   │
│                                                                     obstacles. The "eye of the tiger"         │
│                                                                     metaphor represents a sharp, unyielding   │
│                                                                     focus and readiness to face and overcome  │
│                                                                     adversity.                                │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Flashdance... What a Feeling"  Irene Cara                          The song "Flashdance... What a Feeling"   │
│                                                                     by Irene Cara is about the exhilaration   │
│                                                                     and fulfillment that comes from pursuing  │
│                                                                     one's dreams with passion and             │
│                                                                     determination. The lyrics convey a sense  │
│                                                                     of empowerment and the joy of achieving   │
│                                                                     one's goals, capturing the essence of     │
│                                                                     following one's heart and experiencing    │
│                                                                     the euphoria that comes with realizing    │
│                                                                     one's ambitions. The song was prominently │
│                                                                     featured in the 1983 film "Flashdance,"   │
│                                                                     which tells the story of a young woman    │
│                                                                     aspiring to become a professional dancer. │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "I Love Rock 'n' Roll"          Joan Jett and the Blackhearts       The song "I Love Rock 'n' Roll" by Joan   │
│                                                                     Jett and the Blackhearts is about the     │
│                                                                     excitement and passion for rock and roll  │
│                                                                     music. The lyrics describe a scene where  │
│                                                                     the narrator spots someone attractive at  │
│                                                                     a jukebox, and they bond over their       │
│                                                                     shared love for rock music. The song      │
│                                                                     captures the rebellious and energetic     │
│                                                                     spirit of rock and roll, emphasizing how  │
│                                                                     it brings people together and creates a   │
│                                                                     sense of fun and freedom.                 │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Lady"                          Kenny Rogers                        The song "Lady" by Kenny Rogers is a      │
│                                                                     romantic ballad that expresses deep love  │
│                                                                     and devotion. Written by Lionel Richie,   │
│                                                                     the song's lyrics convey a man's          │
│                                                                     heartfelt emotions and admiration for the │
│                                                                     woman he loves. He describes her as the   │
│                                                                     light in his life, his inspiration, and   │
│                                                                     someone who has filled his life with joy  │
│                                                                     and meaning. The song is celebrated for   │
│                                                                     its tender and sincere portrayal of love  │
│                                                                     and commitment.                           │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Like a Virgin"                 Madonna                             The song "Like a Virgin" by Madonna,      │
│                                                                     released in 1984, is about the feeling of │
│                                                                     starting fresh in a new romantic          │
│                                                                     relationship. The lyrics describe the     │
│                                                                     excitement and emotional renewal that     │
│                                                                     come with falling in love again after     │
│                                                                     experiencing past relationships. The      │
│                                                                     metaphor of feeling "like a virgin"       │
│                                                                     suggests a sense of purity and newness,   │
│                                                                     as if experiencing love for the first     │
│                                                                     time. The song's catchy melody and        │
│                                                                     provocative theme contributed to its      │
│                                                                     widespread popularity and iconic status   │
│                                                                     in pop music.                             │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Physical"                      Olivia Newton-John                  The song "Physical" by Olivia             │
│                                                                     Newton-John, released in 1981, is         │
│                                                                     primarily about physical attraction and   │
│                                                                     desire. The lyrics suggest a strong,      │
│                                                                     almost irresistible urge to engage in     │
│                                                                     physical intimacy. The song's upbeat      │
│                                                                     tempo and catchy melody complement its    │
│                                                                     playful and somewhat provocative theme.   │
│                                                                     When it was released, "Physical" was      │
│                                                                     considered quite bold and even            │
│                                                                     controversial due to its overt references │
│                                                                     to physical relationships. Despite or     │
│                                                                     perhaps because of this, it became one of │
│                                                                     Olivia Newton-John's most successful      │
│                                                                     hits, topping charts and becoming an      │
│                                                                     iconic song of the early 1980s.           │
├────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────────┤
│ "Say, Say, Say"                 Paul McCartney and Michael Jackson  The song "Say, Say, Say" by Paul          │
│                                                                     McCartney and Michael Jackson primarily   │
│                                                                     revolves around themes of love and        │
│                                                                     longing. The lyrics depict a conversation │
│                                                                     between two people, with one expressing   │
│                                                                     their feelings and pleading for the       │
│                                                                     other's affection and attention. The song │
│                                                                     explores the emotional dynamics of a      │
│                                                                     romantic relationship, with the singers   │
│                                                                     conveying their desires and the           │
│                                                                     challenges they face in trying to win     │
│                                                                     over the object of their affection.       │
└────────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────────┘
[16]:
results.sort_by("weeks", reverse=True).select("weeks", "song", "artists", "sentiment", "themes", "other_themes").print(format="rich")
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
┃ scenario  scenario             scenario             answer       answer                answer              ┃
┃ .weeks    .song                .artists             .sentiment   .themes               .other_themes       ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
│ 10        "Physical"           Olivia Newton-John   Happy        ['Love', 'Other']     ['Desire',          │
│                                                                                        'Seduction',        │
│                                                                                        'Empowerment',      │
│                                                                                        'Fun', 'Exercise']  │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 9         "Endless Love"       Diana Ross and       Romantic     ['Love']              None                │
│                                Lionel Richie                                                               │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 9         "Bette Davis Eyes"   Kim Carnes           Nostalgic    ['Love', 'Other']     ['Manipulation',    │
│                                                                                        'Seduction',        │
│                                                                                        'Mystery', 'Power', │
│                                                                                        'Intrigue']         │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 8         "Every Breath You    The Police           Melancholic  ['Love', 'Loss',      ['Obsession',       │
│           Take"                                                  'Struggle', 'Other']  'Surveillance',     │
│                                                                                        'Loneliness',       │
│                                                                                        'Control']          │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 7         "I Love Rock 'n'     Joan Jett and the    Empowering   ['Love',              None                │
│           Roll"                Blackhearts                       'Celebration']                            │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 7         "Ebony and Ivory"    Paul McCartney and   Hopeful      ['Love', 'Social      None                │
│                                Stevie Wonder                     issues']                                  │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 7         "Billie Jean"        Michael Jackson      Melancholic  ['Love', 'Struggle',  ['Deception',       │
│                                                                  'Other']              'Guilt', 'Fame',    │
│                                                                                        'Responsibility']   │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Call Me"            Blondie              Romantic     ['Love',              None                │
│                                                                  'Celebration']                            │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Lady"               Kenny Rogers         Romantic     ['Love']              None                │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Centerfold"         The J. Geils Band    Nostalgic    ['Love', 'Loss']      None                │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Eye of the Tiger"   Survivor             Empowering   ['Struggle']          None                │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Flashdance... What  Irene Cara           Empowering   ['Struggle',          None                │
│           a Feeling"                                             'Celebration']                            │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Say, Say, Say"      Paul McCartney and   Romantic     ['Love', 'Struggle']  None                │
│                                Michael Jackson                                                             │
├──────────┼─────────────────────┼─────────────────────┼─────────────┼──────────────────────┼─────────────────────┤
│ 6         "Like a Virgin"      Madonna              Romantic     ['Love',              None                │
│                                                                  'Celebration']                            │
└──────────┴─────────────────────┴─────────────────────┴─────────────┴──────────────────────┴─────────────────────┘

Posting a notebook to the Coop

Here we post the contents of this notebook to the Coop for anyone to access:

[17]:
from edsl import Notebook
[18]:
n = Notebook(path = "scenarios_filestore_example.ipynb")
[19]:
n.push(description = "Example code for using data files for scenarios via file store and Coop", visibility = "public")
[19]:
{'description': 'Example code for using data files for scenarios via file store and Coop',
 'object_type': 'notebook',
 'url': 'https://www.expectedparrot.com/content/0b0c86b4-7629-428c-8346-03d69a6a76f9',
 'uuid': '0b0c86b4-7629-428c-8346-03d69a6a76f9',
 'version': '0.1.33',
 'visibility': 'public'}

To update an object:

[20]:
n = Notebook(path = "scenarios_filestore_example.ipynb") # resave
[21]:
n.patch(uuid = "0b0c86b4-7629-428c-8346-03d69a6a76f9", value = n)
[21]:
{'status': 'success'}