jim-easterbrook / pywws

Python software for USB Wireless WeatherStations
https://pywws.readthedocs.io/
GNU General Public License v2.0
204 stars 62 forks source link

A service that uploads data to your Solid Pod #110

Closed MyForest closed 1 year ago

MyForest commented 1 year ago

Hi @jim-easterbrook,

Not sure if this is interesting to you.

Full disclosure: I work at Inrupt who are very much pushing Solid because it's the vision our CTO (Sir Tim Berners-Lee) has to put the web the right way up.

I'm building this in a personal capacity though, not as part of Inrupt.

My pywws installation is currently merrily tweeting away but it's about time to do something about that.

This is my first attempt to build a pywws service. I'm quite familiar with Python so it's all quite natural. As you're expecting me to say, I'm trying to wrap my head around the templating.

In this commit I have rdflib generating the text. I'm a little wary of pywws users having another thing to install so I'm trying to see if I can direct it to use a file-based template. I believe it would give them more options about what they want to upload.

I'm making some progress, but thought it would be a reasonable time to share what I've got so far so you can tell me to stop if this isn't likely to make it into master.

One quite reasonable concern would be the lack of Pod providers. It's actually my team's job to run PodSpaces, but there are other providers. We're working at multiple levels with organizations to get them hosting Pods too (such as the BBC).

Of course I'm happy to chat in detail about the actual implementation of the service. I believe it's following along the general pattern of the other services so I don't believe it's doing anything particularly interesting.

Let me know what you think and I'll follow your guidance.

MyForest commented 1 year ago

Here's an example of a file uploaded to a Pod (which I've made wide open by choice).

curl https://storage.inrupt.com/957bd805-d991-45e1-8538-17b59d808012/pywws/latest.ttl

@prefix qudt-unit-1-1: <http://qudt.org/vocab/unit/> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<Observation/latest#rain_1h> a sosa:Observation ;
    sosa:hasSimpleResult "1321.2"^^qudt-unit-1-1:MilliM ;
    sosa:madeBySensor <https://github.com/jim-easterbrook/pywws> ;
    sosa:phenomenonTime "2022-11-12T20:59:01+00:00"^^xsd:dateTime ;
    sosa:resultTime "2022-11-19T19:39:13.991856+00:00"^^xsd:dateTime .

<Observation/latest#temperature> a sosa:Observation ;
    sosa:hasSimpleResult "9.7"^^qudt-unit-1-1:DEG_C ;
    sosa:madeBySensor <https://github.com/jim-easterbrook/pywws> ;
    sosa:phenomenonTime "2022-11-12T20:59:01+00:00"^^xsd:dateTime ;
    sosa:resultTime "2022-11-19T19:39:13.991856+00:00"^^xsd:dateTime .

If you're into the semantic web you can see how things like SOSA fit perfectly well with pywws.

Here's an incredibly scrappy page that shows some ways to use the data once it's published.

image

MyForest commented 1 year ago

Here's another use-case, this is an example of querying the published data using SPARQL which allows the user to query across multiple data sets.

image

MyForest commented 1 year ago

Here's a whole different take on it where the user it doing very fine-grained things with their data in the lovely Penny app. Specifically, this is all about giving people control of their data. I'm certainly not proposing that we'd use Solid as a backend store for pywws, but it may be yet one more way to help people share the data they want to share.

image

jim-easterbrook commented 1 year ago

As far as I'm concerned pywws is now in maintenance mode - I have no plans to add new features without good cause (especially if I won't be using said features and don't want to maintain them). It might be interesting to discuss this on the pywws mailing list to see what interest there is.

You can, of course, distribute your service module as a stand alone file that users can put in their modules directory.

MyForest commented 1 year ago

That makes perfect sense @jim-easterbrook, thanks for getting back to me so quickly.