From: Argbert <ar...@gm...> - 2013-04-25 19:30:05
|
Hi Tac, http://www.mediawiki.org/wiki/Extension:MyVariables proved well for me to get the username. Regards Argi -----Ursprüngliche Nachricht----- Von: Tac Tacelosky [mailto:ta...@gm...] Gesendet: Donnerstag, 25. April 2013 20:29 An: Yaron Koren Cc: Semantic MediaWiki users Betreff: Re: [Semediawiki-user] Use (overusing?) Semantic Media Wiki as a database Thanks. I was able to get the pages returned, along with the phone number and call time, using /api.php?action=ask&query=[[Category:Coffee%20Study]]|?Has%20Phone|?Has%20Ca llTime&format=json I was thinking about the user pages, because then users could maintain their own accounts and participation, plus track their usage. So the home page could have customized chart of their coffee consumption. I thought there was a magic word for the name of the logged in user, but I can't seem to find it. I think there's a way to configure the user page so that only admin's and the individual user can edit their page, which is what I want, since I don't want other people setting up new users or modifying their settings. I was thinking about Special:GetData, and will probably use it just to see what I can learn. Any ideas on how to get the logged in user to pass to an #ask query? Thanks, Tac On Thu, Apr 25, 2013 at 2:03 PM, Yaron Koren <ya...@wi...> wrote: > Hi Tac, > > Overall that approach sounds fine. A few comments: > > - Having default values (like "3PM") in the template seems risky - I > would just have a blank default value, or the word "unknown" or something. > > - I wouldn't put such templates in "User:" pages, unless these are > actual users of the wiki. Instead of "User:John Doe", I would just > make it "John Doe". > > - Instead of a database, you could just store the SMS data as CSV rows > in a single wiki page; then you could use the page Special:GetData, > defined by External Data, to "query" that information - it functions > like a mini-API for the data. > > -Yaron > > > On Thu, Apr 25, 2013 at 1:16 PM, Tac Tacelosky <ta...@gm...> wrote: > >> I got a call from a client today, who wants a quick-and-dirty proof >> of concept for a demo. This is often how projects start, more than >> half of them don't go anywhere but some turn into contracts. >> >> Normally I put together a relational database and shoehorn the test >> code into an existing project. But since I'm a new fan of SMW, I'm >> thinking I might be able to do the majority of this project using it >> as a framework, and get the benefit of cool maps and charts and such. >> >> Briefly, the demo task is to show that we can set up an SMS/IVR >> system that interacts with a user and saves their responses. It will >> eventually grow into something more complicated, but for now the demo >> task is to send a message to a list of users every day at a >> user-defined time and ask them how many cups of coffee they've had, >> and to store their response. >> >> The easiest part of this whole task is sending the message using Twilio. >> Normally I'd set up a database of users and phone numbers, a log of >> messages sent and a database of daily responses. Then I'll start figure >> out how users log in and and create their accounts, change their >> phone numbers and call time, stuff that's a pain to do in a custom >> system, but should be easy in SMW. >> >> My approach as a novice SMW: >> >> Add Template:CoffeeStudy, which is added to User: pages, something >> like >> >> {{CoffeeStudy >> |method=sms >> |phone=202-555-1212 >> |call_time=15:00 >> |timezone=EST >> }} >> >> And the text of the template would be something like >> >> This user participates in the coffee study. Every day at [[Has >> CallTime::{{{call_time|3PM}}}]], a message is sent to [[Has >> Phone::{{{phone|202-555-1212}}}]] [[Category:Coffee Study]] >> >> Now my external application simply needs to make an api query, >> something like >> >> /api.php?action=ask&query=[[Category::Coffee%20Study]] >> >> (Although this isn't working -- I think I need to specify the User: >> namespace) >> >> If I add the time to the query above, I can create a cron job that >> sends the SMS every hour. >> >> Does that approach sound right for the first part, which is storing >> the database of users and their preferences? >> >> The second part is to actually store the SMS log and their response. >> Easiest way is to store it to an external database, then use the >> #external_data extension. This would certainly work, but I'm open to >> other ideas here, including learning how to write an extension with a >> custom table, or storing the results in a special CSV or JSON page >> within SMW. >> >> Anyway, I appreciate the insights of this group, this problem is a >> good exercise for me to learn more about SMW. >> >> Thanks, >> >> Tac >> >> --------------------------------------------------------------------- >> --------- Try New Relic Now & We'll Send You this Cool Shirt New >> Relic is the only SaaS-based application performance monitoring >> service that delivers powerful full stack analytics. Optimize and >> monitor your browser, app, & servers with just a few lines of code. >> Try New Relic and get this awesome Nerd Life shirt! >> http://p.sf.net/sfu/newrelic_d2d_apr >> _______________________________________________ >> Semediawiki-user mailing list >> Sem...@li... >> https://lists.sourceforge.net/lists/listinfo/semediawiki-user >> > > > > -- > WikiWorks · MediaWiki Consulting · http://wikiworks.com > ---------------------------------------------------------------------------- -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Semediawiki-user mailing list Sem...@li... https://lists.sourceforge.net/lists/listinfo/semediawiki-user |