• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions! Dokkio, a new product from the PBworks team, integrates and organizes your Drive, Dropbox, Box, Slack and Gmail files. Sign up for free.


SL AMEE Integration Notes

Page history last edited by PBworks 11 years, 9 months ago
Andrew Conway: 12:16:51

    hi Jim

Jim Purbrick: 12:23:00

    hi andrew

Jim Purbrick: 12:23:12

    thanks for getting in touch :-D

Andrew Conway: 12:23:29

    no probs - just sorry I couldn't make it in person

Jim Purbrick: 12:24:30

    so, how do i find the URL for the co2 emitted by a kettle/month in amee?

Jim Purbrick: 12:25:01

    i've set up  wiki page: http://sldataviz.pbwiki.com/Carbon-Goggles

Jim Purbrick: 12:25:13

    with all the questions from the email on

Andrew Conway: 12:25:26

    go to http://stage.co2.dgen.net in your browser

Jim Purbrick: 12:25:44


Jim Purbrick: 12:26:45

    signed in now

Andrew Conway: 12:27:01

    click profiles

Jim Purbrick: 12:27:12


Andrew Conway: 12:27:31

    click Create profile

Jim Purbrick: 12:27:43


Andrew Conway: 12:28:38

    so profile with UID B7BBC6BB115C would represent a person, group or any entity

Andrew Conway: 12:28:54

    click the edit icon to its right, under action (pencil)

Jim Purbrick: 12:29:08


Andrew Conway: 12:29:29

    descend down to home/appliances/kitchen

Andrew Conway: 12:29:36

    then generic

Andrew Conway: 12:30:18

    then select from the drop down

Andrew Conway: 12:30:48

    hit Add (ignore "valid from" just now)

Jim Purbrick: 12:31:43


Jim Purbrick: 12:32:24

    so, i can see the kgCO2 Per Month

Jim Purbrick: 12:32:37

    is there a way to do this without profiles

Jim Purbrick: 12:32:51

    and to get just the value without HTML,JSON or XML?

Andrew Conway: 12:33:47

    yes, it can be down without profiles

Jim Purbrick: 12:33:52


Andrew Conway: 12:34:06

    but all repsonse are in JSON or XML

Andrew Conway: 12:34:09


Jim Purbrick: 12:34:25

    <3s REST and CSV

Jim Purbrick: 12:34:38

    (LSL scripts only have 16KB of memory...)

Andrew Conway: 12:35:29

    we have code for java, php (and more) clients

Andrew Conway: 12:35:54

    we could create an app that serves SL with something simpler

Jim Purbrick: 12:36:09


Jim Purbrick: 12:36:26

    so, the plan is to use a django app

Jim Purbrick: 12:36:38

    to map between SL UUIDs and CO2 data

Jim Purbrick: 12:37:23

    so, when someone tags an object, we could have the django app fetch the C02 data from AMEE

Jim Purbrick: 12:37:37

    and store it

Jim Purbrick: 12:37:48

    so it can be sent to SL as a float in a CSV response

Andrew Conway: 12:38:52

    ok, sounds good

Andrew Conway: 12:39:02

    where will it be stored?

Andrew Conway: 12:39:16

    could it be stored in AMEE's profile system?

Jim Purbrick: 12:39:31

    in mysql on the web server running django

Jim Purbrick: 12:39:52

    it needs to be stored somewhere that can give CSV responses

Jim Purbrick: 12:39:55

    so, not in AMEE

Jim Purbrick: 12:40:26

    the django app will map SL Object UUID to <tags, AMEE URL, co2/month>

Jim Purbrick: 12:40:46

    then you will be able to do an HTTP GET to /<UUID>/

Jim Purbrick: 12:40:53

    to get a single float back

Jim Purbrick: 12:41:01

    for the co2/month

Jim Purbrick: 12:41:22

    or an HTTP PUT to /<UUID>/ to associate an object with a tag and URL

Jim Purbrick: 12:41:34

    so, next question

Jim Purbrick: 12:41:53

    how do people using SL find the URLs in AMEE to give to the SL HUD?

Jim Purbrick: 12:42:03

    do they all need user names passwords?

Jim Purbrick: 12:42:15

    do they browse stage.co2.dgen?

Andrew Conway: 12:42:16

    how about a small php app that took standard AMEE requests and return CSVs to you in a format of your spec?

Jim Purbrick: 12:42:29

    that would work

Jim Purbrick: 12:43:00

    could you build that for us?

Andrew Conway: 12:43:01

    then you've got AMEE's storage system at your disposal (time profiles, stats etc.)

Andrew Conway: 12:43:52

    yes, would be a pleasure!

Jim Purbrick: 12:44:18


Andrew Conway: 12:45:08

    it'll probably please many other folk too :)

Andrew Conway: 12:45:11

    to your other qns...

Jim Purbrick: 12:46:15

    TOYOTA, Prius, 1.5 VVT-i Hybrid, E-CVT, 1497, Petrol Hybrid  0.000

Jim Purbrick: 12:46:22

    what went wrong there?

Jim Purbrick: 12:46:30

    0 CO2/month sounds wrong

Andrew Conway: 12:47:12

    ah, I see you've figured it out

Andrew Conway: 12:47:26

    kettle is very simple

Andrew Conway: 12:47:58

    most profile items have values that needs set, usually just one describing usage

Jim Purbrick: 12:48:25

    that's going to be tricky

Jim Purbrick: 12:48:39

    i'd like to be able to have people fly around SL

Jim Purbrick: 12:48:45

    click an object

Jim Purbrick: 12:48:50

    find it in AMEE

Jim Purbrick: 12:48:56

    paste the URL in to SL

Jim Purbrick: 12:49:13

    and then be able to query that URL to get a single CO2/month value

Jim Purbrick: 12:49:30

    it might be nice to be able to parameterise things at some point

Andrew Conway: 12:49:31

    ok, I see

Jim Purbrick: 12:49:35

    but that sounds complicated

Andrew Conway: 12:50:01

    well, you wouldn't want SL users actually coming to stage.co2.dgen.net in their browsers

Andrew Conway: 12:50:17

    that's really a developer's interface for the API

Andrew Conway: 12:50:37

    it can all be down behind the scenes and so transparent to the SL user

Andrew Conway: 12:51:24

    here are the steps as I see them:

Andrew Conway: 12:51:31

    1. SL user finds an object

Andrew Conway: 12:51:58

    2. we need to determine the AMEE URL, e.g. /transport/car/generic

Andrew Conway: 12:53:04

    3. we need to determine the choices in the AMEE drill down (analogous  to those drop down boxes prior to creating profile items)

Andrew Conway: 12:53:32

    4. we need to assume usage figures, or get them from the user

Jim Purbrick: 12:55:59


Jim Purbrick: 12:56:20

    how many choices are there per category max?

Andrew Conway: 12:57:02

    usually one or two

Jim Purbrick: 12:57:10

    ok, how about this

Andrew Conway: 12:57:11

    max is for house types - 5

Andrew Conway: 12:57:23

    but again we can cut those down with assumptions

Jim Purbrick: 12:57:31

    you build 3 services in PHP

Jim Purbrick: 12:58:00

    GET /subcategory/URL

Jim Purbrick: 12:58:08

    where URL is the taxonomy

Jim Purbrick: 12:58:17

    so, I say GET /subcategory/

Jim Purbrick: 12:58:31

    you return a CSV of transport,home,...

Jim Purbrick: 12:58:51

    then I say GET /subcategory/home/kitchen/kettle

Jim Purbrick: 12:59:01

    and you return something to say that we've reached an actual item

Jim Purbrick: 12:59:25

    then I say GET /co2permonthurl/category

Jim Purbrick: 12:59:40

    and you return a URL which will return a single float when requested

Jim Purbrick: 13:00:17

    then I say GET  on that URL with a query string giving the current parameters

Jim Purbrick: 13:00:43

    GET URL&kpermonth=1000 for example

Jim Purbrick: 13:00:46

    and you return a float

Jim Purbrick: 13:01:10

    I store the results of the GET /co2permonthurl/ queries in my web service

Jim Purbrick: 13:01:19

    associating them with SL UUIDs

Jim Purbrick: 13:01:26

    then when people fly around with the HUD on

Jim Purbrick: 13:01:42

    I request those URLs to get the CO2 data

Jim Purbrick: 13:02:14

    with the current parameters the wearer has set

Jim Purbrick: 13:02:16

    sound OK?

Andrew Conway: 13:03:12

    yes, overall sounds like a plan

Andrew Conway: 13:03:27

    I might have to deviate from being as RESTful as you describe above

Jim Purbrick: 13:03:56


Andrew Conway: 13:03:57

    but still offer the same functions, e.g. ?device=kettle

Jim Purbrick: 13:04:20

    i can generate most URLs from SL scripts

Jim Purbrick: 13:04:37

    if we can do the catagory browsing

Jim Purbrick: 13:04:45

    with the subcategory service

Jim Purbrick: 13:04:52

    then i can build in interface in SL

Jim Purbrick: 13:05:13

    which will allow people to browse the AMEE tree without having to go to the staging page

Andrew Conway: 13:05:45

    also, if you store a profile item uid locally, rather than /co2permonthurl/...

Andrew Conway: 13:06:16

    then you get more flexibility for the future as well as easy access to the kgco2 value

Jim Purbrick: 13:06:39


Jim Purbrick: 13:06:59

    so the django service stores <SL UUID, AMEE profile UID> pairs?

Andrew Conway: 13:07:07

    yes, exactly

Jim Purbrick: 13:07:29

    then the SL HUD requests /<SL UUID>/ from the django web service

Jim Purbrick: 13:07:46

    and the web service redirects it to /co2permonth/<AMEE UID>

Jim Purbrick: 13:07:55

    which returns a float

Jim Purbrick: 13:07:56


Andrew Conway: 13:08:00


Andrew Conway: 13:08:20

    you'll also need the profile uid for the user

Andrew Conway: 13:08:51

    to retrieve it goes like this:

Andrew Conway: 13:09:11


Jim Purbrick: 13:10:20

    so, when tagging objects, I call /profileitemuid/<catagory>

Jim Purbrick: 13:10:35

    and you return a newly minted AMEE UID for me?

Jim Purbrick: 13:10:56

    or even /profileitem/<category>

Jim Purbrick: 13:11:27

    i'm not sure that profiles make sense here, as people are browsing objects in SL, rather than objects they own

Jim Purbrick: 13:11:57

    the goal is to make people ambiently aware of carbon costs as they fly around SL, rather than calculating their pesonal carbon emissions

Andrew Conway: 13:12:30

    ah ok, I see, misunderstood that

Andrew Conway: 13:12:46

    ok, that simplifies things a bit then

Jim Purbrick: 13:12:55


Andrew Conway: 13:13:08


Andrew Conway: 13:13:32

    ok, here's the url for profile-less access

Andrew Conway: 13:13:44

    for example

Andrew Conway: 13:14:37


Andrew Conway: 13:15:15

    I'll then return the kgCO2 to you and you store that and no profile uids

Andrew Conway: 13:15:41

    the data_item_uid uniquely defines an object, e.g. there's one for a kettle

Andrew Conway: 13:16:32

    it's the product of making those drill down choices

Andrew Conway: 13:16:57

    so your user sees a car

Andrew Conway: 13:17:15

    url is /data/transport/car/generic/

Andrew Conway: 13:17:46

    I return a CSV of choices, say fuel: petrol or diesel

Andrew Conway: 13:17:49

    you say petrol

Andrew Conway: 13:18:04

    I return a CSV of sizes: small, medium or large

Andrew Conway: 13:18:27

    you choose large

Andrew Conway: 13:18:40

    I return the data item uid

Andrew Conway: 13:18:51

    you can then do: /transport/car/generic/data_item_uid/?value=amount

Andrew Conway: 13:19:00

    to get the CSV with the kgCO2 amount

Andrew Conway: 13:19:22

    you store that locally

Jim Purbrick: 13:21:47


Jim Purbrick: 13:22:22

    we will be starting with /data though

Andrew Conway: 13:22:30


Jim Purbrick: 13:22:48

    so people will browse down through the taxonomy

Jim Purbrick: 13:23:08

    then get a UID

Jim Purbrick: 13:23:15

    stored in django

Jim Purbrick: 13:23:24

    and requested when people browse that object in SL

Andrew Conway: 13:24:26

    so you'd maintain a cache of AMEE data item uids?

Jim Purbrick: 13:24:36


Andrew Conway: 13:24:54

    that's fine

Andrew Conway: 13:25:11

    our aim is to keep data item uids the same,

Jim Purbrick: 13:25:28

    I map SL UUIDs to AMEE data item uids

Andrew Conway: 13:25:30

    but for future-proofing it's recommended to have a way to update the cache of them at your end

Andrew Conway: 13:27:20

    how much do you want to achieve and by when?

Jim Purbrick: 13:27:48

    we have 24 hours :-)

Jim Purbrick: 13:27:57

    starting 27 minutes ago

Jim Purbrick: 13:28:00


Jim Purbrick: 13:28:22

    we already have a very similar app

Jim Purbrick: 13:28:32

    which we're going to hack around and mostly reuse

Jim Purbrick: 13:28:38


Andrew Conway: 13:28:39

    so you need the csv thing asap

Jim Purbrick: 13:28:47

    yes please :-)

Jim Purbrick: 13:28:59

    first step would be data item URL to float co2permonth service

Andrew Conway: 13:29:11


Jim Purbrick: 13:29:17

    then we can get data item UIDs from staging to test

Andrew Conway: 13:29:26

    I've got the code lying around for that

Jim Purbrick: 13:29:35

    once that works we can work on the taxonomy browsing and UID finding bit

Andrew Conway: 13:30:09

    ok, I'll get onto the "data item URL to float co2permonth service" right now

Jim Purbrick: 13:30:15


Jim Purbrick: 13:30:33

    it would be good to have the data item browsing service done by the end of today

Jim Purbrick: 13:30:41

    so i can ask people in SL to tag objects while we sleep

Andrew Conway: 13:30:44

    will be offline from 3-6ish, so will do my best to get that bit done by 3

Jim Purbrick: 13:30:54

    and then demo it tomorrow morning :-)

Jim Purbrick: 13:31:15

    please add notes and API documentation to http://sldataviz.pbwiki.com/Carbon-Goggles

Andrew Conway: 13:31:16

    then the browsing bit this evening

Jim Purbrick: 13:31:20


Jim Purbrick: 13:31:26

    that would be awesome andrew :-)

Andrew Conway: 13:31:35

    i like a challenge :)

Andrew Conway: 13:31:40

    ok, head going down now

Jim Purbrick: 13:32:11

    talk to you later :-)

Andrew Conway: 13:32:18


Comments (0)

You don't have permission to comment on this page.