IRC Chat : 2009-08-23 - OpenMRS

00:06:20 *** oys has joined #openmrs
00:06:27 <oys> hallo
00:09:19 <bwolfe> hi oys
00:09:36 <oys> hey dude!!!
00:10:10 <oys> i'm looking at trying to programmatically query a couple of things
00:10:38 <oys> pls are you available to answer questions?
00:10:47 <oys> Ben?
00:11:57 <oys> suppose I register a pregnant woman as patient
00:12:30 <oys> how would I query for her next scheduled encounter
00:12:48 <oys> how do I store it in the first place?
00:16:57 <bwolfe> oys: sure, I'm in and out, but will try to answer. :-)
00:17:08 <bwolfe> Context.getEncounterByPatient(patient);
00:17:10 <oys> k, thanks
00:17:11 <bwolfe> where patient is:
00:17:46 <bwolfe> Context.getPatientService().getPatientByIdentifier("123MT-2");
00:17:50 <oys> but can I store a future encounter...how???
00:18:00 <bwolfe> ah, I see what you are saying
00:18:20 <bwolfe> I should have read more carefully :-)
00:18:47 <bwolfe> there isn't a built-in way for openmrs to do this
00:18:59 <oys> oh!!!
00:19:10 <bwolfe> we usually store an observation on the person's last encounter with a concept named "RETURN VISIT DATE"
00:19:13 <bwolfe> so you could do
00:19:28 <bwolfe> Context.getObsService().getObsByPersonAndConcept(person, concept);
00:19:41 <oys> hmmm...how do I query for that then
00:20:20 <bwolfe> concept = Context.getConceptService().getConceptByName("RETURN VISIT DATE");
00:20:23 <bwolfe> and person ==
00:20:43 <bwolfe> person = Context.getPatientService().getPatientByIdentifier("123MT-2")
00:20:50 <bwolfe> (because a Patient extends the Person object)
00:21:03 <oys> so if I created a new concept say "scheduled visit", i could try that too
00:21:27 <bwolfe> yeah
00:21:34 <oys> concept = Context.getConceptService().getConceptByName("scheduled visit");
00:22:20 <oys> so is this generally how one could get the answer for any stored concept in openmrs???
00:22:49 <oys> stored values...as in answer to concept
00:24:11 <bwolfe> yeah
00:24:31 <bwolfe> An obs is one question and answer pair
00:24:36 <bwolfe> an encounter has a list of observations (obs)
00:24:45 <bwolfe> so you could also do:
00:25:25 <bwolfe> List<Obs> obsListForFirstEncounter = Context.getEncounterService().getEncounterByPatient(patient)[0].getObs(); ([0] isn't legal, just doing that for shortness here)
00:27:00 <oys> so, when u get the observation how do you get the answer out pls?
00:30:05 <oys> any link to online APIs?
00:30:55 <oys> k...http://resources.openmrs.org/doc/
00:43:51 <bwolfe> oys: yeah, thats the javadoc for the latest trunk release (those javadocs are built every 8 hours I think)
00:44:31 <bwolfe> oys: the downloads page: http://openmrs.org/wiki/Downloads also links to the latest stable javadocs: http://resources.openmrs.org/doc-1.4
00:44:56 <bwolfe> (to answer your question) an Obs object has getValueAsString() which will give you the answer
00:45:19 <bwolfe> or if you want a specific object answer to the Obs, it has getValueCoded(), getValueNumeric(), getValueText(), etc, etc
00:45:23 <oys> hmmm...just looked at the API
00:45:47 <oys> this means I must know in advance the datatype of the value??
00:46:55 <oys> whether text, numeric or...
00:47:51 <oys> cant find any getAnswer()...looks like someone wanted to change that
00:48:57 <bwolfe> getValueAsString is the closest you will get to that oys
00:50:49 <oys> thanks...you've been very helpful!!!
00:51:26 <bwolfe> oys: what are you working on?
00:53:51 <oys> I'm looking to see where I can read on the data model
00:54:08 <oys> gush...trying to navigate this wiki
00:54:26 <bwolfe> oys: just use the search
00:54:30 <bwolfe> search for data model
00:54:45 <oys> aha!!!
00:55:06 <oys> I'm working on a mobile solution
00:55:39 <oys> and is the webservice kicking?
00:55:58 <oys> can I work through your webservice too?
00:56:49 <bwolfe> oys: we do not publish any web services
00:56:56 <bwolfe> we publish a way for web services to be written
00:57:17 <bwolfe> there is a module that adds web service _ability_ (search for webservices on the wiki)
00:57:37 <bwolfe> there is a module that adds a few REST calls too. but it only has stuff for Patient right now I think
00:58:04 <oys> k...will see how I can write a webservice for retrieving obs answers
00:58:26 <oys> is that easily possible through your 'steriod' module
00:58:59 <bwolfe> steroid?
00:59:04 <bwolfe> what do you mean?
00:59:20 <bwolfe> it definitely would be possible, yes
00:59:38 <oys> i mean your 'base' module that gives steroids to webservices
00:59:39 <oys> lol
01:00:00 <oys> just read through that
01:00:09 <oys> on the module doc page
01:00:22 <oys> has anybody used that?
01:00:44 <oys> used your module as the basis for such work? an examples?
01:03:44 <oys> any example?
01:06:41 <oys> see you are busy
01:06:49 <oys> thanks much for your help
01:06:56 <bwolfe> oys, ping my username to get my attention :-)
01:07:04 <bwolfe> oys there is the examplewebservice module
01:07:15 <bwolfe> oys and examplepatientstub
01:07:41 <oys> oh...thanks
01:07:47 <bwolfe> I'm running down to grab some dinner, bbl
01:08:27 <oys> k...tnx its alomst morning here (yawns)
01:08:53 <oys> catch you later...you'll see my work in a week
01:08:57 <oys> bye
01:09:01 <oys> and thanks!
01:15:04 *** oys has quit IRC
01:33:50 *** atomicturtle has joined #openmrs
04:22:18 *** jmiranda_ has quit IRC
05:34:58 *** jmiranda has joined #openmrs
05:34:58 *** ChanServ sets mode: +o jmiranda
06:34:39 *** bwolfe has quit IRC
09:23:15 *** jmiranda has quit IRC
14:02:42 *** jmiranda has joined #openmrs
14:02:42 *** ChanServ sets mode: +o jmiranda
15:15:13 *** hene has joined #openmrs
15:15:26 <hene> hi there
15:15:36 <hene> anyone in?
15:16:16 <hene> help!!!
15:25:57 <hene> ?
15:45:41 *** hene has quit IRC
16:12:49 *** jmiranda has quit IRC
17:30:02 *** andrewaclt has quit IRC
17:55:00 *** bwolfe has joined #openmrs
17:55:00 *** ChanServ sets mode: +o bwolfe
19:14:35 *** amogha has joined #openmrs
19:36:58 <amogha> bwolfe you about?
21:22:49 *** amogha has quit IRC
21:43:16 *** jmiranda has joined #openmrs
21:43:16 *** ChanServ sets mode: +o jmiranda
21:46:23 <bwolfe> amoha, I am now...but seems you're gone :-/
22:06:40 <r0bby> bwolfe: i'm here
22:06:45 <r0bby> I guess now you can run
22:06:55 <r0bby> since that's the cue -- see r0bby. see ben run
22:52:15 *** r0bby has quit IRC
23:00:39 *** robbyoconnor has joined #openmrs
23:00:39 *** ChanServ sets mode: +v robbyoconnor
23:00:43 <robbyoconnor> hai