Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS »
Discussion: OpenMRS Talk »
Real-Time: IRC Chat

IRC Logs

Child pages
  • 2009-06-18 - OpenMRS
Skip to end of metadata
Go to start of metadata
00:12:52 *** Glen_ has quit IRC
00:17:46 *** atomicturtle has joined #openmrs
00:20:44 <OpenMRSBot> Recent updates in the world of openmrs: Joao Portela: GSOC Weekly Blog Entry (2009-06-18) <> || OpenMRS Changesets: Changeset [8587]: htmlformentrydesigner: Core module ready. Extension points with the … <> || OpenMRS Changesets: Changeset [8586]: mdrtb14. fixes order of htmlform encounters on dashboard to desc. <>
00:22:33 *** Agnor has quit IRC
00:23:17 *** atomicturtle has left #openmrs
01:24:46 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8588]: perufitnessstudy. fixed transmission of UTF-8 characters to the … <>
01:39:50 <r0bby> bwolfe: does skype ever act up where it doesn't seem to send the messages?
02:00:13 *** Keelhaul has quit IRC
02:36:01 *** upul has joined #openmrs
02:36:01 *** ChanServ sets mode: +v upul
02:48:03 *** Mkop has joined #openmrs
03:18:57 *** Mkop has quit IRC
04:04:46 *** bwolfe has quit IRC
07:18:33 *** pascal` has joined #openmrs
07:48:57 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8589]: reporting: Implement user stories and fixed a few bugs in reporting … <>
10:48:23 *** kane77 has joined #openmrs
10:53:01 *** Keelhaul has joined #openmrs
10:53:01 *** ChanServ sets mode: +v Keelhaul
11:24:02 *** upul has quit IRC
11:30:47 *** james_regen has joined #openmrs
11:30:47 *** ChanServ sets mode: +v james_regen
11:43:51 <pascal`>
12:08:21 *** bwolfe has joined #openmrs
12:08:21 *** ChanServ sets mode: +o bwolfe
12:43:23 <pascal`> woohoo, finally got my kubuntu installation up and running
12:44:30 <pascal`> openmrs installation, not OS installation
13:04:54 *** jmiranda_ has joined #openmrs
13:07:40 *** jmiranda_ has quit IRC
13:11:14 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Forum: Re: OpenMRS version vs. DB Version <> || OpenMRS Changesets: Changeset [8590]: htmlformentrydesigner: It finally connects with the htmlformentry module. … <>
13:12:59 *** Agnor has joined #openmrs
13:13:13 <Agnor> Hi
13:13:29 <Agnor> bwolfe, you'll be happy to know that I almost solved the problems in my module
13:13:48 <Agnor> I've sent an email to the dev-list explaining the "almost" part
13:14:17 <bwolfe> exellent joao
13:14:42 <Agnor> it wouldn't be possible with your help
13:14:49 <Agnor> I quite don't know what I did
13:15:19 <Agnor> but it definitely connects to the htmlformentry module
13:25:53 <Agnor> darius already explained what was wrong
13:29:32 <bwolfe> yeah, I see that
13:29:44 <bwolfe> /web-inf/view/index.jsp
13:30:02 <bwolfe> but the patientDashboard.jsp file is using it. I don't get it
13:32:27 <Agnor> maybe it's a boxext?
13:33:26 <bwolfe> its neither, its a PatientDashboardTabExt
13:41:23 *** catechu has joined #openmrs
13:41:33 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8591]: serialization: give a sample unit test for testing what ids will be … <>
13:42:34 <catechu> james_regen: hello
13:43:02 <james_regen> hi
13:44:07 <catechu> do you have any ideas about James Arbaugh's serialization bug?
13:44:16 *** sdefabbiakane has joined #openmrs
13:44:18 <james_regen> james's problem is happening in the DedupmatchResultList class. that's where the objects are being serialized
13:45:20 <catechu> have you replicated the bug?
13:45:31 <james_regen> not yet
13:46:01 <catechu> he said he was only having that issue on Linux -- do you have any ideas why it might be a platform-specific issue?
13:47:59 <james_regen> nope. the link test machine is ubuntu linux, so it's working on linux. i've had it working on solaris. i'm guessing some file path assumptions are being made that aren't valid for james's setup
13:49:00 <james_regen> in case you haven't found it yet, the report is generated in an oddly named method "doAnalysis()" in the matchingReportUtils class
13:51:18 <catechu> do you know anything about his machine's setup, or any oddities about the records being serialized?
13:52:00 <james_regen> not yet, just know where the code that's failing is
13:55:49 <catechu> ok
13:56:30 <catechu> what would you do to isolate the bug?
14:00:00 <catechu> (that is, how would you go about replicating it)
14:01:37 <james_regen> i'd look at the code that's failing more. i know what it does, but since nribeka wrote it and it worked fine for the other places we've run the module, i haven't really looked to see how it works, exactly. it'd be helpful to see how james's machine differs from our link test machine to see if all the constants defined for the module is there. as far as replicating . . . i don't know how to replicate it right now. i can probably come up with
14:04:22 *** bwolfe_ has joined #openmrs
14:04:22 *** ChanServ sets mode: +o bwolfe_
14:06:27 *** bwolfe has quit IRC
14:06:35 *** bwolfe_ is now known as bwolfe
14:09:12 <catechu> james_regen: ok
14:13:24 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8592]: serialization: reverted to the previous version which use thread local … <>
14:13:58 <catechu> james_regen: I will ask james arbaugh for his patientmatching config.xml, then. are there any other locations where constants would be defined?
14:15:16 *** djazayeri has joined #openmrs
14:15:16 *** ChanServ sets mode: +o djazayeri
14:16:02 <james_regen> MatchingConstants class has the directory where the config file is stored as well as the dirctory where the records are serialized
14:21:15 *** luzhuangwei has joined #openmrs
14:30:21 *** pascal` has quit IRC
14:31:37 <catechu> james_regen: he would have the same parameters in it, right? since it is already compiled
14:31:51 *** nimanthab has joined #openmrs
14:33:02 <james_regen> yeah, but maybe something in his setup is causing a problem, like no write access to the directory. i don't know, but that's where the directory names come from that we need to make sure exists, for example
14:40:54 <catechu> ok
15:05:03 <catechu> james_regen: is it significant that "PatientMatchingActivator doesn't have a serial version uid"?
15:06:29 <james_regen> i don't know
15:13:45 <catechu> ok
15:46:10 *** bwolfe_ has joined #openmrs
15:46:10 *** ChanServ sets mode: +o bwolfe_
15:46:37 *** bwolfe has quit IRC
15:46:39 *** bwolfe_ is now known as bwolfe
15:47:13 *** luzhuangwei has quit IRC
15:49:32 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8594]: patientmatching module: in RecordSerializer and DedupMatchResultList, … <> || OpenMRS Changesets: Changeset [8593]: patientmatching module: in PatientMatchingActivator, added default serial … <>
16:21:33 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Tickets: Ticket #1577 (task created): Option to configure how many incorrect password attempts before lock out <>
16:33:32 *** atomicturtle has joined #openmrs
16:33:59 *** atomicturtle has left #openmrs
16:43:21 *** nimanthab has quit IRC
16:47:12 *** Mkop has joined #openmrs
17:07:06 <r0bby> eh bwolfe
17:07:08 <r0bby> I have a class
17:07:15 <r0bby> which is a List and i need to persist it
17:19:25 <bwolfe> that isn't a question. did you intend it to be?
17:19:48 <r0bby> I have to map a list in hibernate
17:19:55 <r0bby> i was going to use composite-elements
17:19:59 <r0bby> but here's the hitch
17:20:24 <r0bby> one of the properties of the class in the composite element is a list itself :|
17:20:58 <bwolfe> sounds like a bad schema
17:21:41 <r0bby> the list needs to go in its own list no?
17:21:51 <r0bby> s/own list/own table/
17:22:06 <r0bby> well
17:22:24 <r0bby> FacilityDataFormSchema has a List of FacilityDataFormSections;
17:22:40 <r0bby> FacilityDataFormSections then has a List of FacilityDataFormQuestions
17:23:01 <bwolfe> I suggest you make primary keys where you can. don't mess with composite-elements.
17:23:29 <r0bby> let me pastebin my schema
17:23:40 <bwolfe> I did composite-elements for patient_identifier back in the day. I discovered it was more about the .equals/.hashCode methods than anything
17:23:41 <r0bby> composite elements seemed easier
17:23:48 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Forum: Re: OpenMRS version vs. DB Version <>
17:23:58 <r0bby> aka a pain?
17:25:18 <bwolfe> it wasn't a pain once I realized I just needed to set up the equals/hashcode methods and a simple composite key. I didn't have any lists in my composite-key though
17:25:51 <r0bby> then do I need to join them via a FK or something?
17:25:56 <r0bby> :(
17:26:02 <r0bby> :/
17:27:55 <bwolfe> use a primary key
17:28:09 <bwolfe> it makes everyone happier in the end
17:28:35 <r0bby>
17:28:40 <r0bby> i do
17:29:19 <r0bby> then how do I add to teh list :(
17:29:19 <r0bby> it
17:29:19 <r0bby> s not many to one or one to many :X
17:30:47 <r0bby>
17:33:04 <bwolfe> you're making this more difficult than it really is
17:33:43 <bwolfe> why does sections.section_id FK to form_section.form_section_id ?
17:33:55 <r0bby> I have no clue
17:33:57 <bwolfe> a form has a list of sections and each section has a list of questions, right ?
17:34:24 <r0bby> yes
17:35:18 <bwolfe> here's your schema: form--id, name. section--id, postition, question--id, section_id, position.
17:35:29 <bwolfe> question.section_id FK to
17:35:36 <bwolfe> err section--id, form_id, position
17:35:42 <bwolfe> section.form_id FK to
17:35:46 <bwolfe> done
17:36:02 <r0bby> (I was trying to do this on my own for once w/o constanttlHUH
17:36:04 <r0bby> HUH
17:36:51 <r0bby> wouldn't I have multiple rows for EACH element of the list
17:36:55 <r0bby> UGH
17:37:20 <bwolfe> which list ?
17:38:08 <r0bby> HUH
17:38:14 <r0bby> NO FK needed?
17:38:49 <r0bby> :(
17:38:58 <bwolfe> two FKs, from question.section_id --> and section.form_id -->
17:39:11 <r0bby> AGH
17:39:15 <bwolfe> you don't have to specify FKs in the hbm mappings
17:39:43 <r0bby> but there is no property in the class....
17:40:11 <bwolfe> no property in what class ?
17:40:25 <r0bby> UGH
17:40:40 <r0bby>
17:40:44 <r0bby> there's the section
17:40:44 <OpenMRSBot> <> (at
17:41:00 <r0bby>
17:41:02 <OpenMRSBot> <> (at
17:41:04 <r0bby> the schema
17:41:08 <r0bby> my two PITAs
17:41:23 <Mkop> yummm, pita
17:41:24 <r0bby> so you get an idea
17:41:43 <bwolfe> schema == form ?
17:42:38 <r0bby> let me show you my _ENTIRE_ schema
17:42:43 <bwolfe> these are not PITAs at all r0bby (sorry Mkop)
17:42:49 <bwolfe> they are standard many-to-ones
17:42:50 <r0bby> I got it :)
17:42:57 <r0bby> I dont see it :(
17:43:19 <r0bby> here's form question
17:43:25 <bwolfe> I don't want to see your entire schema...because if its like what you posted before, its wrong. :-p
17:43:42 <r0bby>
17:43:45 <OpenMRSBot> <> (at
17:44:07 <bwolfe> still not a PITA
17:44:12 <r0bby> :(
17:44:31 <r0bby> I dont know how to f'en map this using an f'en schema :|
17:44:38 <r0bby> I _HATE_ it :|
17:44:46 <bwolfe> look at person --> person_name
17:44:58 <bwolfe> look at concept --> concept_name
17:45:01 <bwolfe> encounter --> obs
17:45:15 <r0bby> it's one_to_many :(
17:45:17 <bwolfe> almost ALL objects in openmrs use many-to-ones
17:46:03 <bwolfe> are you reusing questions on different sections ?
17:46:18 <r0bby> yes
17:46:24 <r0bby> wait no
17:46:31 *** omart13x has joined #openmrs
17:46:32 <r0bby> well not on the same schema
17:46:47 <r0bby> I'm gonna switch to set
17:47:17 <r0bby> OLHH SHIT
17:47:33 <r0bby> FormSection -> FormQuestion is many-to-one!!!!!
17:48:11 <r0bby> how is FormSchema -> FormSection many to one?
17:48:23 <r0bby> what field on FormSection am I referencing in my mappoing
17:48:30 <r0bby> I looked at the OpenMRS mappings :(
17:48:44 <r0bby> they all have a back reference :X
17:49:17 <bwolfe> section.form_id -->
17:49:20 <bwolfe> thats your FK
17:49:30 <bwolfe> concept_name.concept_id --> concept.concept_id
17:49:46 <bwolfe> person_name.person_id --> person.person_id
17:49:50 <r0bby> doesn
17:49:56 <r0bby> t that need a property on the class?
17:50:22 <bwolfe> qualify your statements. which property. what class?
17:50:28 <r0bby> Okay
17:50:47 <r0bby> FormSection contains two properties: a List of sections and a displayName.
17:51:01 <r0bby> no back reference to its schema
17:51:33 <r0bby> so i dont need this extra table? or do i
17:52:09 <bwolfe> why does FormSection contain a list of sections ?
17:52:33 <r0bby> hrm list of form questions rather
17:52:41 <bwolfe> ah
17:53:15 <r0bby>
17:53:22 <bwolfe> you are right. no, FormSection does not necessarily need a property called Schema
17:53:30 <Keelhaul> whats a section =o
17:53:30 <r0bby> so it's not really many to one
17:53:44 <r0bby> that the rest of my schema (the other parts mike designed and they work)
17:54:36 <bwolfe> facilitydata_form_section needs a column pointing at schema_id
17:54:45 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Forum: Re: OpenMRS version vs. DB Version <> || OpenMRS Changesets: Changeset [8595]: perufitnessstudy. added validation preventing ingression of errors without … <>
17:55:02 <r0bby> even if no property exists
17:55:04 <r0bby> ?
17:55:13 <r0bby> (on the mapped class?
17:55:31 <bwolfe> right. the column is used so that you can make a list of sections on a schema
17:55:49 <r0bby> that'll be a foreign key?
17:56:04 <bwolfe> (I would suggest adding the Schema property on Section though). again, look at ConceptName and Concept for this EXACT mapping
17:56:28 <djazayeri> Presumably Form and FormField have another example of this exact mapping.
17:57:20 <bwolfe> form/form_field is different because fields are reused
17:57:31 <djazayeri> Hey, bwolfe or anyone else, do you know where the user's session timeout happens? Is that handled by tomcat?
17:57:36 <bwolfe> I would suggest to r0bby that questions are not reused
17:57:42 <bwolfe> yes
17:57:47 <r0bby> they're not...
17:57:50 <r0bby> it makes no sense
17:58:03 <r0bby> questions are *CAN* be used on another report
17:58:07 <r0bby> but not the same one
17:58:07 <djazayeri> So to increase the timeout I'd go to the tomcat configuration. thanks.
17:58:20 <djazayeri> r0bby: that means that questions *are* reused.
17:58:23 <djazayeri> :-)
17:58:30 <r0bby> djazayeri: hrm perhaps
17:58:39 <r0bby> I was thinking in the same report sense
17:58:57 <r0bby> what Did i get myself into !
17:59:59 <r0bby> GC pause :D
18:01:41 <r0bby> bwolfe: questions can be reused -- what if a report with a different period exists?
18:02:15 <bwolfe> r0bby: I suggest the data model does NOT reuse questions. you can allow the user to search for old questions to "reuse" them...but in the background its just copying and making a new one
18:03:11 <bwolfe> the problem we ran into with Field was that if the user changes the on one form, it changed it for all forms. so we had to put in a note for the user that this will effect all Forms...
18:04:46 <r0bby> hrm WHAT
18:05:05 <r0bby> OHH ok
18:05:28 <r0bby> the question id will be used on multiple forms :)
18:05:50 <r0bby> hrm...
18:06:06 <r0bby> is that what you're getting at?
18:06:31 <r0bby> schema and section both have a FK to eachother
18:06:38 <sdefabbiakane> djazayeri: I believe session timeout time can be adjusted in the web.xml of the webapp
18:06:44 <r0bby> so they're now many to one at the schema level
18:07:11 <bwolfe> why do schema and section FK to each other?? that would make them one-to-one
18:08:00 <bwolfe> schema knows which sections are its by looking for its schema_id in the section.schema_id column
18:09:35 <r0bby> WAIITI
18:09:36 <bwolfe> r0bby: I suggest the question_id NOT be used on multiple forms.
18:09:49 <r0bby> djazayeri: ^^
18:10:09 <r0bby> (mike said basically you'll be the backseat driver w/ heavy influence)
18:10:12 <Keelhaul> bwolfe: if the name was saved in form_field instead of field, it would fix that problem
18:10:35 *** catechu has quit IRC
18:10:50 <bwolfe> Keelhaul: yeah, for name. but the same thing happens for any of the Field attributes.
18:11:22 <Keelhaul> true
18:12:15 <r0bby> bwolfe: my idea was this: a section can be re-used
18:12:39 <djazayeri> bwolfe: I believe that questions (like concepts) are intentionally used on multiple schemas (like forms)
18:14:15 <r0bby> bwolfe: so facilitydata_sections would have a FK to the sections table
18:14:28 <r0bby> er form questions rather
18:14:55 <r0bby> HRM
18:15:05 <r0bby> damn it i suck at explaining things
18:15:13 <bwolfe> r0bby: think and type slower. it helps
18:15:32 <Keelhaul> bwolfe: what's a typical number of forms in an installation
18:15:47 <r0bby> facilitydata_sections has a reference to the sections table via a FK
18:16:01 <r0bby> faciliydata_questions has a reference to the form_questions table via a FK
18:16:03 <bwolfe> djazayeri: hmm, sounds like form + formField + field. we discussed at some point that formfield + field was the wrong way to go. I thought the core point behind that discussion was because reusing the fields was rare
18:16:07 <r0bby> is that what you were saying
18:16:49 <bwolfe> Keelhaul: I dunno. we have 60+ active forms in AMPATH in kenya right now
18:17:14 <Keelhaul> bwolfe: and hardly any field reuse?
18:17:17 <bwolfe> r0bby: um, what are facilitydata_questions and form_questions tables ?
18:17:18 <Keelhaul> i see your point
18:17:21 <djazayeri> bwolfe: reusing fields is rare, but reusing concepts is frequent.
18:17:31 <r0bby> bwolfe: holding the elements of the two lists
18:17:35 <Keelhaul> are there plans to get rid of form_field in the long run?
18:17:36 <r0bby> (that i mentioned prior)
18:18:12 <bwolfe> Keelhaul: there is a lot of field reuse. but rarely do we need to change a field across ALL forms. if one field needs to change, it gets copied/remade (the UI helps the user with this)
18:18:19 <djazayeri> facilitydata combines concept+formfield together
18:18:55 <r0bby> Basically: each question has a datatype
18:19:15 <r0bby> either: coded,numeric, (boolean coded, yes no, na) or freetext(just added this one)
18:19:17 <bwolfe> r0bby: I would guess that its the other way around. form_questions has an FK on it that poitns at facilitydata_questions.
18:19:46 <Keelhaul> !gsoc2009
18:19:46 <OpenMRSBot> Keelhaul: "gsoc2009" ---
18:19:49 <r0bby> my head is spinning right now
18:20:07 <r0bby> bwolfe: to explain how it works
18:20:49 <r0bby> actually stockquestion is a coded question -- but we could theoretically define more coded questions if we wanted just extend the abstract CodedQuestion class and override getCodedOptions()
18:23:04 <bwolfe> that doesnt' help at all. no where in our conversation ahs the words stockquestion or codedOptions come up. :-p
18:25:04 <r0bby> eh Im just explaining how it works :P
18:25:13 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8596]: -- dss * removed static designation from Loggers that don't need it <> || OpenMRS Forum: trouble with chica / dss module <> || OpenMRS Forum: Re: OpenMRS version vs. DB Version <>
18:25:24 <r0bby> first: I take over the world
18:25:31 <r0bby> after that the rest falls in place
18:28:04 <Keelhaul> oh now i see what the module is about
18:28:51 <r0bby> Keelhaul: it's a reporting tool
18:29:03 <Keelhaul> yea
18:29:17 <r0bby> ultimately they wanna integrate htmlformentry (we can't w/o making some modifications ot the module itself)
18:29:18 <Keelhaul> but for data thats usually not in the system
18:29:22 <Keelhaul> so you gotta collect it too =P
18:29:41 <Keelhaul> heh
18:29:50 <Keelhaul> so many projects need to make changes to htmlformentry
18:30:10 <r0bby> this is what it will look like minus "Measles" showing up
18:30:12 <r0bby>
18:30:20 <r0bby> I'm gonna gut it for groovyforms
18:30:37 <r0bby> so much of it isn't necessar
18:30:38 <r0bby> y
18:30:49 <r0bby> i just want the widgets :)
18:31:08 <r0bby> no html parts :D
18:31:33 <r0bby> actually the html parts is so much better than the god damn scriptlets burke envisioned
18:31:53 <Keelhaul> in facilitydata_sections, do you even need an auto increment id when it's not used as the primary key
18:31:57 <r0bby> anyweays back to my project :)
18:32:22 <r0bby> it is.
18:32:30 <Keelhaul> oh ic
18:32:33 <Keelhaul> missed a word
18:32:36 <r0bby> primary key (`id`,`position_id`),
18:33:08 <bwolfe> the primary key shouldn't depend on the sorting of it...
18:33:31 <r0bby> I took this from one of the sites
18:33:41 <r0bby> I've googled this left, right, and center
18:33:51 <Keelhaul> maybe you should call the field retire_reason isntead of retired_reason, since the property is called retireReason too
18:34:03 <Keelhaul> not sure whether there's a convention for the table field though
18:34:41 <bwolfe> r0bby: if you want to reuse questions, you'll want to look at Form-->FormField-->Field objects and tables
18:35:37 <bwolfe> Fields are used on multiple forms (like your questions). FormField says where on a specific form a specific Field goes (like your sections). Form is, well, like your form
18:36:12 <r0bby> so maybe model it like that?
18:36:23 <Keelhaul> does a schema contain multiple sections?
18:36:25 <r0bby> djazayeri: are you opposed?
18:36:29 <r0bby> Keelhaul: yes
18:36:37 <r0bby> List<FacilityDataFormSection> sections;
18:36:40 <djazayeri> r0bby: on a phone call, not paying attention
18:36:52 <Keelhaul> r0bby: how do you map it in the db
18:37:00 <r0bby> seperate table Keelhaul
18:37:14 <r0bby> as for mapping it -- that's the current problem
18:37:32 <Keelhaul> i cant say i understand your way of mapping =/
18:37:47 <r0bby> I dont know how else to do it
18:37:58 <r0bby> I've _NEVER_ worked with a DB
18:38:13 <Keelhaul> does a section belong to one schema or can it belong to many
18:38:22 <r0bby> many
18:38:36 <r0bby> think of it this way: a schema has a period its valid from and to.
18:39:00 <r0bby> you can have a schema that is valid for say this month, then for the month prior and so forth
18:39:05 <Keelhaul> if you dont need to store any additional info about the mapping, a normal many to many mapping should do
18:39:13 <Keelhaul> dont need a pojo in that case
18:39:25 <r0bby> we do.
18:39:34 <r0bby> HRM WHAT
18:40:00 <r0bby> my head is spinning w/ all this association crap; makes me wish i paid attention in my discrete class Wrt to set theory
18:40:02 <Keelhaul> so a schema expires
18:40:14 <Keelhaul> but the sections are permanently there to be reused?
18:40:19 <r0bby> you can have a schema but the periods cant overlap
18:41:10 <Keelhaul> i didnt pay much attention in my discrete class and passed the exam because we were allowed to bring an A4 sheet of paper filled with whatever we wanted...
18:41:42 <Keelhaul> anyway
18:41:56 <Keelhaul> are sections reusable?
18:42:30 <r0bby> yes
18:42:43 <r0bby> Keelhaul: I wasn't able to do it
18:42:44 <Keelhaul> if i understood it correctly, then a schema has m sections, each of which has n questions
18:43:02 <r0bby> but many to many requires a field on the pojo no?
18:43:06 <r0bby> :<
18:43:12 <r0bby> my head is SPINNING
18:43:26 <Keelhaul> yes, you need a List/Set<Section> in the Schema class
18:43:57 <Keelhaul> a List/Set<Question> in the Section class, respectively
18:44:07 <Keelhaul> (dont know the correct class names)
18:45:21 <bwolfe> Keelhaul: he wants to use lists
18:45:30 <Keelhaul> oh
18:45:41 <Keelhaul> so he wants them to be stored in an order D=
18:46:02 <Keelhaul> hence the position_id, i see
18:47:34 <Keelhaul> shouldnt there still be a field in the mapping table that references the schema
18:47:54 <djazayeri> r0bby: what exactly were you asking if I agree with?
18:47:58 <djazayeri> I've lost the thread.
18:48:58 <r0bby> nevermind
18:49:11 <r0bby> Keelhaul: I need them to be stored in the order they're inserted
18:49:30 <r0bby> section 1 is section 1 when it's pulled and so forth
18:50:57 <Keelhaul> ok
18:51:22 <Keelhaul> so for each schema, you have a section A at position 1, section B at position 2, etc
18:51:39 <Keelhaul> shouldnt there be a field referencing the schema id in the mapping table, though?
18:52:57 <r0bby> <composite-element> would have eliminated that
18:53:03 <r0bby> but doing that is a PITA
18:53:06 <r0bby> right now.
18:53:16 <Keelhaul> whats PITA
18:53:21 <Keelhaul> pain in the ass?
18:53:24 <r0bby> Pain in the ass :P
18:53:27 <Keelhaul> ok
18:54:14 <r0bby> in theory: id=1 position_id=0 section_id=1
18:54:19 <r0bby> is what i WANT it to look like
18:54:49 <r0bby> so I need a FK to section
18:54:56 <Keelhaul> and how does it know the schema?
18:55:05 <r0bby> but does section need to have a FK back to the original :(
18:55:22 <r0bby>
18:55:26 <r0bby> the schema
18:55:32 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Forum: Re: trouble with chica / dss module <> || OpenMRS Forum: Re: OpenMRS version vs. DB Version <> || OpenMRS Tickets: Ticket #1578 (task closed): Cannot Create a new FormField element <> || OpenMRS Changesets: Changeset [8601]: 1.5.x: Fixing cascade of save to fields when saving a form field - #1578 <> || OpenMRS Changesets: Changeset [8600]: Fixing cascade of save to fields when saving a form field - #1578 <> || OpenMRS Changesets: Changeset [8599]: ncd: Updates for condition detection using ICD-9 codes. <> || OpenMRS Forum: Re: OpenMRS version vs. DB Version <> || OpenMRS Forum: Re: OpenMRS version vs. DB Version <> || OpenMRS Tickets: Ticket #1578 (task created): Cannot Create a new FormField element <> || OpenMRS Changesets: Changeset [8598]: -- atd * removed unneeded static designations <> || OpenMRS Changesets: Changeset [8597]: -- chica * removed unneeded static designations <>
18:55:45 <Keelhaul> i mean in the mapping table
18:56:49 <Keelhaul> r0bby: is this composite voodoo the only way to map a list?
18:57:12 <r0bby> if it's of a class type and not Strings it's handy yes
18:57:23 <r0bby> it allows you to put instances directly in
18:57:26 <r0bby> a nd get em out
18:58:09 <Keelhaul> r0bby: does it work?
18:59:12 <r0bby> it should
18:59:40 <Keelhaul> r0bby: can you show me the xml mapping files?
19:00:24 <r0bby> sure hodl
19:00:26 <r0bby> hold
19:03:42 <r0bby>
19:03:45 <OpenMRSBot> <> (at
19:04:27 <Keelhaul> thx
19:05:39 <r0bby> they're not in subversion yet
19:05:44 <r0bby> it works...mostly
19:05:58 <Keelhaul> why is question_id the id field of schema =o
19:08:57 <r0bby> that's removed
19:10:02 <r0bby>
19:10:04 <OpenMRSBot> <> (at
19:10:12 <r0bby> my entire schema
19:12:14 <Keelhaul> hm
19:12:42 <Keelhaul> it would be easier to read if you put all the auditing metadata to the bottom of the fields list
19:15:25 <Keelhaul> dinner, bbl
19:21:18 <djazayeri> r0bby: check your email
19:22:25 * r0bby slaps his system
19:22:34 <r0bby> it's laggy
19:23:52 <r0bby> djazayeri: AHHHHHH
19:23:55 <r0bby> it makes sense now
19:24:17 <r0bby> djazayeri: form_section is used
19:24:27 <r0bby> but i get where you're going
19:24:54 <djazayeri> whenever you have a many-to-many, you need a mapping table
19:24:59 <r0bby> ok
19:25:02 <r0bby> i did that
19:25:09 <r0bby> lemme show you what i have now
19:25:20 <r0bby> actually see what i showed Keelhaul
19:25:34 <djazayeri> I see 800 links above. which one?
19:25:44 <r0bby>
19:25:44 <OpenMRSBot> <> (at
19:27:09 <r0bby> sections don't need an extra table
19:27:23 <r0bby> thanks for the help darius, i appreciate it
19:28:32 <r0bby> okay lemme see if i get this: the schema -> section is many to many
19:28:41 <r0bby> extra table necessary
19:29:03 <r0bby> I have everything
19:29:26 <r0bby> form question, section and form schema is what we need
19:31:43 <djazayeri> So, from the top down, what tables do you have? (Ignore the mapping tables, just the real tables)
19:33:59 <djazayeri> (top = schema, bottom = question)
19:35:07 <r0bby> facilitydata_form_schema, facilitydata_form_section, facilitydata_question facilitydata_form_question, facilitydata_value
19:35:33 <r0bby> the order is important due to the FK dependencies
19:37:36 <r0bby> lemme print ouy what you wrote so i have it handy hold
19:38:07 <r0bby> so a mapping table isn't necessary for form_questions?
19:39:26 <r0bby> djazayeri: hold up -- form_question the way you laid it out is gonna be insane -- it needs to be done in a mapping table
19:39:31 <r0bby> for the list anyways
19:39:41 <r0bby> it's the only sane way i can think of
19:40:03 <djazayeri> Can a form_question occur in multiple sections?
19:40:14 <r0bby> no
19:40:20 <r0bby> here's my beef
19:40:27 <djazayeri> so it's 1 section -to- many form_questions
19:40:36 <djazayeri> Therefore you don't need a mapping table.
19:40:38 <djazayeri> Period.
19:40:43 <r0bby> okay
19:41:21 <djazayeri> If you need to sort the list then you add a sort-weight column to form_questions
19:41:43 <r0bby> the list needs to be sorted by position
19:41:52 <r0bby> insertion order matters
19:42:29 <r0bby> will that still be honored :(
19:44:06 <r0bby> This is where im getting tripped up
19:44:20 <r0bby> *HOW* is the one to many mapped using the *List*
19:44:33 <bwolfe> r0bby: theres an order-by attribute on the one-to-many element. set that to "sort_weight". in your api, make sure sortWeight is in the order you want
19:44:49 <bwolfe> (the one-to-many returns a SortedSet if order-by is non-null)
19:45:24 <r0bby> so I need to use a set
19:46:23 <r0bby> okay
19:46:24 <r0bby> thanks
19:46:55 <djazayeri> I'm pretty sure you can use a list here
19:47:00 <djazayeri> Looking at the hibernate docs now
19:47:06 <r0bby> you can't
19:47:13 <r0bby> I saw *NO* one-to-many
19:47:23 <r0bby> Im just gonna use a Set and set a order-by
19:47:42 <r0bby> and use position as the sortweight entry
19:47:44 <djazayeri> Have you looked at the hibernate docs?
19:47:49 <r0bby> yes
19:47:52 <djazayeri> Section 6.2.3 Indexed collections
19:48:00 <r0bby> yeh
19:48:07 <r0bby> why do you think I designed the schema as i did?
19:48:39 <r0bby> that's for Lists
19:49:08 <r0bby> insertion order matters :(*
19:49:16 <r0bby> the docs _SUCK_
19:49:36 <djazayeri> what do you mean by "insertion order matters"?
19:49:44 <djazayeri> the actual order of elements in the list matters.
19:49:46 <bwolfe> I actually love the hbm docs. between that single_html page and the javadocs I can do everything. :-)
19:49:50 <djazayeri> Insertion order doesn't matter.
19:49:56 <r0bby> yes it does
19:50:11 <r0bby> create section 1
19:50:18 <r0bby> set up all the stuff
19:50:19 <r0bby> add it
19:50:23 <r0bby> That should be section 1
19:50:26 <r0bby> not section 4
19:50:29 <r0bby> etc
19:50:33 <djazayeri> I mean: you have a list.
19:50:38 <r0bby> yes
19:50:43 <djazayeri> the order that matters is what is at list[0], list[1], list[2], etc.
19:50:46 <r0bby> Look at the docs -- hell look at the DTD
19:51:15 <djazayeri> It isn't insertion order that matters, it's the order of the list. (You can insert things out of order, e.g. insert a new element in the middle of a list)
19:51:27 <r0bby> ah right
19:51:31 <r0bby> yeh
19:51:44 <r0bby>
19:51:52 <r0bby> DTD for the list element
19:52:58 <r0bby> it's f'en hell
19:53:00 <r0bby> :|
19:53:22 <r0bby> I'm picturing the gold fish with the sack on a stick and a suit case
19:53:32 <r0bby> and i feel like becoming that gold fish :(
19:55:41 <r0bby> I'm gonna walk away for a bit -- this is counter productive -- i can't think clearly right now
19:55:55 <r0bby> I'll set a sort-weight like ben said
19:56:07 <r0bby> sets are the only way i can do one to many
19:56:13 <r0bby> which is annoying
19:56:20 <djazayeri> r0bby: that is definitely not true.
19:56:26 <djazayeri> How would lists work otherwise?
19:56:32 <djazayeri> I mean: what else would you use lists for?
19:56:39 <r0bby> i dont know
19:56:43 <r0bby> but look at the dtd
19:56:47 <djazayeri> replace "definitely" with "probably"
19:56:49 <r0bby> I just showed you
19:56:59 <r0bby> look at the DTD
19:57:29 <djazayeri> <list ...>...<list-index column="sort_weight"/></list>
19:57:44 <r0bby> okay
19:57:52 <r0bby> we're back at square one
19:58:10 <r0bby> it can't specify to one to many.
19:58:12 <djazayeri> Ultimately I don't think it matters much if it's a List or a SortedSet
19:58:24 *** james_regen has quit IRC
19:58:51 <r0bby> again -- that's not the issue -- i know how to do that: the issue is we can't specify it as one-to-many but a <set> can.
20:00:38 <bwolfe> r0bby: darius is right. if you want a list, just change your sort_weight column to postion_id like you had and point the list item at that column. now hbm manages the position_id instead of you managing sortWeight. no other changes are necessary to go from SortedSet to List
20:00:59 <r0bby> that is what i'm f'en doing
20:01:14 <bwolfe> but you're also doing odd things with position_id in the primaryKey
20:01:17 <r0bby> I can't be any clearer than I've been ONE TO MANY CANNOT BE SPECIFIED
20:01:30 <r0bby> i can bold-face it if you like
20:01:31 <djazayeri> r0bby: let's go back to a different topic of conversation.
20:01:50 <djazayeri> I had some comments on the db tables that you send a couple of pasties back.
20:02:13 <r0bby> blame mike for everything but facilitydata_question facilitydata_value
20:02:24 <r0bby> blame mike for facilitydata_question facilitydata_value
20:02:36 <r0bby> the others are my fault.
20:02:44 <r0bby> those work
20:02:47 <r0bby> i'm not touching them
20:02:53 <djazayeri> Okay, so remind me: can sections be shared in different schemas?
20:03:10 <r0bby> in theory they should be
20:03:16 <r0bby> ie a section with a different period
20:03:16 <djazayeri> okay
20:03:24 <r0bby> er schema
20:03:38 <djazayeri> So in the create table statement for section, you have this:
20:03:39 <djazayeri> constraint `schema this is associated with` foreign key (`schema`) references `facilitydata_form_schema` (`schema_id`)
20:03:51 <djazayeri> There's no schema column though.
20:03:57 <r0bby> that was removed
20:04:12 <r0bby> i forgot to remove that constraint
20:04:22 <djazayeri> ok
20:04:49 <r0bby> the list really is the only issue
20:04:56 <r0bby> once that's resolved this all should work
20:05:09 <r0bby> hence why i'm getting so frustrated
20:05:13 <djazayeri> so looking at form_question
20:05:20 <djazayeri> I don't see a sort-weight or a list-index
20:05:39 <r0bby> that's in the questions table
20:05:49 <r0bby> i set up a seperate table
20:06:00 <r0bby> i saw some unncessary rows being created
20:06:19 <r0bby> because we dont know the position until it's put in the list :|
20:06:37 <r0bby> we're back at square one with this f'en convo i'm walking away for a bit
20:06:48 <r0bby> I'm gonna flip out otherwise.
20:06:52 <djazayeri> You shouldn't be able to create a "floating" form_question
20:07:04 <r0bby> okay
20:07:06 <djazayeri> i.e. you can only create it at the time you are inserting it in the list/set.
20:07:08 <r0bby> here's what im using for testing
20:07:20 <djazayeri> So, now that we're back to the list question, yes, let's take a break.
20:08:21 <r0bby> here's how i'm doing it
20:08:34 <r0bby> i'll show you my mock method (we've been using this)
20:09:50 <r0bby>
20:09:53 <OpenMRSBot> <> (at
20:09:54 <r0bby> that's how im doing it
20:10:05 <r0bby> and how i envisioned doing it.
20:11:39 <r0bby> save it -- add it to the section
20:11:45 <r0bby> save it -- add it to the section
20:11:47 <r0bby> etc
20:12:13 <r0bby> except im doing something wrong there and i see it
20:13:07 <r0bby> i already relaxed the not null constraint on the lists
20:13:13 * r0bby sighs
20:31:36 *** Agnor has quit IRC
20:31:56 *** Agnor has joined #openmrs
20:48:50 <r0bby> djazayeri: after calming down
20:48:56 <r0bby>
20:48:59 <OpenMRSBot> <> (at
20:49:31 <r0bby> perhaps it *IS* possible though it violates the DTD ... which is what perplexes me :(
20:52:38 <r0bby> holy crap i was wrong
20:53:22 <djazayeri> I think that you need to put something like this in your Section.hbm.xml:
20:53:23 <djazayeri> <list name="formQuestions" inverse="true">
20:53:23 <djazayeri> <one-to-many class="FormQuestion" />
20:53:23 <djazayeri> <key><column name="section_id" /></key>
20:53:23 <djazayeri> <list-index><column name="list_index" /></list-index>
20:53:23 <djazayeri> </list>
20:53:56 <r0bby> i got it darius
20:53:57 <r0bby> thanks
20:53:59 <r0bby> im sorry
20:54:02 <r0bby> I really am
20:55:01 <djazayeri> Then in FormQuestion you need <many-to-one name="section" class="Section" not-null="true"><column name="section_id"/></many-to-one>
20:55:03 <r0bby> <list name="formSections" table="facilitydata_form_sections" cascade="save-update,persist"> <key column="section_id"/> <list-index column="position_id" base="0">
20:55:06 <r0bby> <one-to-many class="org.openmrs.module.facilitydata.model.FacilityDataFormSection"/>
20:55:09 <r0bby> </list>
20:55:12 <r0bby> ok thanks
20:55:20 <r0bby> so I need to have a reference BACK
20:55:44 <r0bby> <many-to-one name="section" class="org.openmrs.module.facilitydata.model.FacilityDataFormSection" not-null="false" cascade="save-update,persist"/>
20:55:48 <r0bby> wait i got it :)
20:55:54 <r0bby> thanks a lot darius
20:56:12 <r0bby> I was a difficult to deal w/ you could of said "f off" but you didn't
20:56:29 <r0bby> ok
20:56:33 <djazayeri> Typically we have the collection say inverse="true", and the pointer back from the child to the parent doesn't have an inverse.
20:56:41 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8603]: Fixed patient merge with two patients that are related Fixed patient merge … <> || OpenMRS Tickets: Ticket #790 (defect closed): Merge patients is broken <> || OpenMRS Changesets: Changeset [8602]: 1.4.x: Fixed duplicate identifiers on patient merge bug - #790 <>
20:56:53 <r0bby> yeh
20:57:08 <djazayeri> one side of that always has to be inverse=true though, which I don't see in the last two things you pasted. just fyi
20:57:12 <r0bby> my head is gonna explode right now i need to go handle this sink full of dishes -- living at HOME rocks.
20:57:51 <bwolfe> if you lived on your own you would still have a sink full of dishes to do. :-p
20:58:13 <r0bby> bwolfe: I wouldn't care though :)
20:58:26 <bwolfe> you would eventually. :-)
20:59:59 <djazayeri> bwolfe: thanks for making db updates non-automatic.
21:00:21 <djazayeri> I just accidentally loaded a trunk war with a 1.4 database and I'm happy to find out that it wasn't nuked.
21:00:44 <djazayeri> much happier than last time, when it did get nuked. (nuked = transformed to 1.5)
21:01:07 <bwolfe> :-)
21:01:10 <r0bby> I got mine nuked :)
21:01:19 <r0bby> Now bwolfe
21:01:29 <r0bby> 1.5 dataset with a nice set of patients :)
21:01:33 <bwolfe> I moved on it mainly because jmiranda complained about his db nuking.
21:02:02 <jmiranda> thanks ben
21:02:03 <bwolfe> r0bby: I've said many times how you can get that now.
21:02:12 <r0bby> on a 1.5 database?
21:02:12 <djazayeri> What, you didn't fix it when I complained?
21:02:14 <djazayeri> bah.
21:02:14 <bwolfe> r0bby: I am not making a 1.5 demo data set until it is released
21:02:19 <r0bby> I think i nuyked mine :)
21:02:23 <r0bby> I'll wait then
21:02:29 <bwolfe> djazayeri: jmiranda complained first as far as I know
21:02:34 <r0bby> I'm not doing much with patients :)
21:02:44 <r0bby> Just would be cool to have it :)
21:03:10 <jmiranda> bwolfe, i just deployed a trunk war
21:03:20 <djazayeri> bwolfe: why isn't it telling me what runtime props file it's using?
21:03:26 <jmiranda> on top of an already somewhat up-to-date 1.5 database
21:03:50 <jmiranda> to find that i needed to run all of the updates (from uuid up to the latest) all over again
21:04:01 <djazayeri> yeah, that's exactly what I'm seeing now.
21:04:04 <jmiranda> and was pleasantly surprised to see the preconditions working
21:04:06 <jmiranda> very nice
21:04:38 <bwolfe> jmiranda: I implemented your suggestion of breaking up the uuid changesets. it won't change anythign when it does them because you already have them
21:04:49 <jmiranda> had a weird hiccup at the end (related to a module) that caused the initialsetup wizard to think that none of the changes were committed
21:04:54 <r0bby> incoming flood
21:04:55 <djazayeri> ah, okay.
21:04:57 <r0bby> <list name="questions" table="facilitydata_form_questions" cascade="save-update,persist" inverse="true">
21:04:59 <jmiranda> a tomcat restart fixed that
21:05:00 <r0bby> <key column="id" not-null="true"/>
21:05:03 <r0bby> <list-index column="position_id" base="0"/>
21:05:05 <r0bby> <many-to-many column="question_id" class="org.openmrs.module.facilitydata.model.FacilityDataFormQuestion" order-by="position_id"/>
21:05:09 <r0bby> </list>
21:05:12 <bwolfe> r0bby: pastebin.
21:05:14 <bwolfe> r0bby: seriously
21:05:16 <r0bby> i know :)
21:05:19 <djazayeri> ah, okay, I'll ignore them.
21:05:29 <djazayeri> the duplicate uuid changesets I mean.
21:05:33 <jmiranda> bwolfe, that's what i was saying ... very nice ... i think ... i think i love you, man
21:05:44 <r0bby> you *THINK* !
21:05:48 <r0bby> *THINK*
21:05:49 * jmiranda wipes a tear
21:05:54 <bwolfe> if I knew the "silent" irc command I would have done that right after you said "incoming flood".
21:06:04 <r0bby> djazayeri: i think im gonna keep the mapping tables
21:06:17 <r0bby> it keeps things cleaner
21:06:20 <djazayeri> r0bby: no
21:06:24 <r0bby> bad idea?
21:06:30 <djazayeri> adding unnecessary tables does not keep things cleaner.
21:06:43 <djazayeri> You need mapping tables for many-to-many relationships.
21:06:54 <djazayeri> You don't need them (and shouldn't use them) for 1:many or many:1
21:07:22 <bwolfe> jmiranda: ah, gotcha. gee, thanks. *punches jmiranda's shoulder out of awkwardness*
21:07:22 <djazayeri> bwolfe, jmiranda: is it just me or does liquibase take a surprisingly long time to run the updates.
21:07:31 <djazayeri> maybe because of the lock?
21:08:08 <bwolfe> djazayeri: it was faily slow on my machine too. (half second per changeset that was just checking a precondition)
21:08:10 <r0bby> ut's not just you :)
21:08:11 <djazayeri> All those uuid changesets took 2+ seconds to notice that the precondition failed.
21:10:28 <r0bby> I got the rest of this djazayeri
21:10:44 <r0bby> thanks -- i wish i'd consulted mike before taking this on on my own -- i made a decent attempt :(
21:11:00 <r0bby> but wont there be a row for *EACH* question now
21:11:06 <r0bby> that's my concern
21:11:23 <r0bby> now we'll have unncessary rows at times
21:11:33 *** bwolfe has quit IRC
21:11:33 <djazayeri> What do you mean by unnecessary rows?
21:11:41 <r0bby> okay
21:11:45 <djazayeri> There's a row in Question for every question.
21:11:54 <r0bby> I know
21:12:00 <r0bby> I'm thinking in the list
21:12:03 <djazayeri> There's a row in FormQuestion for every time a question is used in a section.
21:12:07 <djazayeri> That's the list.
21:12:10 <r0bby> ok
21:12:16 <r0bby> maybe im just not seeing it
21:12:28 <r0bby> I've had that problem with this project all throughout
21:12:28 <djazayeri> There will be more rows in FormQuestion than in Question, assuming some reuse of questions.
21:12:31 <r0bby> maybe ill see it
21:12:39 <r0bby> yeh
21:12:44 <r0bby> that's what i was trying to avoid
21:12:50 <r0bby> by the extra table
21:12:51 <r0bby> it's cleaner
21:13:05 <r0bby> I find this messy
21:13:05 <djazayeri> Extra table won't avoid it.
21:13:14 <r0bby> UGH
21:13:27 <r0bby> i'm not adding a not null constraint.
21:13:39 <djazayeri> If you have 10 questions in a section, it is perfectly appropriate to have 10 rows in the form_question table.
21:13:57 <r0bby> 10 questions in schema for a period from June 18 to July 18
21:14:04 <r0bby> then July 18 to Auguest 18
21:14:15 <r0bby> has the same 10 questions -- wait that's noe xtra rows
21:14:16 <r0bby> DOH
21:14:18 <djazayeri> That's not what periods mean.
21:14:29 <r0bby> maybe im still weak on it :(
21:14:47 <r0bby> this is *NOT* good
21:15:06 <djazayeri> Period for a schema means: "up until 2006 they asked these 3 questions on the form. Starting Jan 2007 they added a 4th question"
21:15:31 <djazayeri> so you have different schemas for "monthly report (effective until 12/2006)" and "monthly report (effective from 1/2007)"
21:16:05 <djazayeri> So, to get back to what you were saying, if you did a many-to-many table, you would have exactly as many rows.
21:16:07 <r0bby> I got that :)
21:16:23 <djazayeri> You can think of FormQuestion *as* a many-to-many table between section and question.
21:16:37 <djazayeri> But it also has more columns.
21:16:45 <r0bby> I dont like it this way -- i feel VERY uncomfortable
21:17:12 <r0bby> i save the question *BEFORE* i add it (otherwise constraints are violated (i hit this)
21:18:02 <r0bby> the extra table isn't too much overhead is it?
21:18:39 <r0bby> my extra table has no openmrs auditing
21:19:13 <r0bby> I guess i'll see how it behaves
21:19:21 <r0bby> *HOPEFULLY* it updates vs inserts
21:19:36 <jmiranda> is everyone (except for me) using mysql 5.1?
21:20:34 <Keelhaul> i run 5.1 on Echidna
21:20:36 <Keelhaul> 64bit even
21:21:23 * r0bby bangs his head on his desk
21:22:29 <r0bby> <key column="question_id" not-null="false" update="true"/>
21:22:34 <r0bby> hopefully this behaves right.
21:28:36 <OpenMRSBot> Recent updates in the world of openmrs: OpenMRS Changesets: Changeset [8606]: 1.5.x: Removed references to the formentry module from the liquibase demo … <> || OpenMRS Changesets: Changeset [8605]: Removed references to the formentry module from the liquibase demo data … <> || OpenMRS Changesets: Changeset [8604]: 1.5.x: Fixed patient merge with two patients that are related Fixed … <>
21:36:31 <djazayeri> r0bby: do not add an extra table.
21:36:42 <r0bby> I won't
21:36:45 <djazayeri> Unless you just want mike to say "get rid of the extra table". :-)
21:37:19 <djazayeri> Also, for FormQuestion, both section_id and question_id need to be not-null=true
21:37:35 <r0bby> I did that for a reason
21:38:02 <djazayeri> I can't find the pastie of the test code
21:38:05 <djazayeri> can you paste it again?
21:38:52 <djazayeri> nm, found it.
21:38:55 <r0bby>
21:38:58 <OpenMRSBot> <> (at
21:38:58 <r0bby> end of the class
21:39:17 <r0bby> (yes, i'm using google collections and i refuse to remove it!)
21:39:25 * r0bby gets all defiant)
21:40:41 <r0bby> I had to do it the way i did it for saving the sections -- persisting, THEN adding the other data
21:40:59 <r0bby> WAIT
21:41:04 <r0bby> i dont have the version im using
21:41:22 <r0bby>
21:41:23 <OpenMRSBot> <> (at
21:41:35 <r0bby> there's what i have locla
21:41:53 <r0bby> it's in a transitional state which well doesnt work :)
21:42:39 <r0bby> mike brought up a use-case and it made sense.
21:42:43 <r0bby> anyways i got dishes to do
21:42:48 <r0bby> so I'll be back in a few
21:43:06 *** omart13x has quit IRC
21:44:38 <djazayeri> r0bby: if you have the hibernate mappings set up right, then this will work:
21:44:39 <djazayeri> Schema schema = new Schema("Monthly report");
21:44:39 <djazayeri> Question q1 = new Question("What's your name?", "java.lang.String");
21:44:39 <djazayeri> Section s1 = new Section("one");
21:44:39 <djazayeri> s1.addFormQuestion(new FormQuestion(q1));
21:44:39 <djazayeri> schema.addSection(s1);
21:44:41 <djazayeri> facilityDataService.saveSection(s1);
21:44:47 <djazayeri> Anway, gotta go.
21:44:49 <djazayeri> bye all
21:44:54 *** djazayeri has quit IRC
21:45:29 <r0bby> ...
21:46:45 <r0bby> sometimes i wanna throw *SOMETHING* at the wall
22:02:51 <Keelhaul> the dishes
22:04:30 <Keelhaul> r0bby: why is the mapping class between sections and questions called FormQuestion
22:04:33 <Keelhaul> rather than SectionQuestion
22:04:38 <Keelhaul> a bit confusing imo
22:05:27 <r0bby> Keelhaul: because
22:05:34 <Keelhaul> yes?
22:05:43 <r0bby> FacilityDataFormQuestion has-a FacilityDataQuestion
22:05:47 <r0bby> which is the question type
22:05:58 <r0bby> EVERY type is a subclass of FacilityDataQuestion
22:08:53 <r0bby> it's silly for every data type to inherit the section
22:09:00 <r0bby> it's useless info
22:09:43 <r0bby> soonish i'll explain the architecture when i get passed this weeks milestone
22:10:19 <r0bby> likely using a google doc because im lazy
22:10:25 <r0bby> (I have a doc already :)
22:10:30 <r0bby> we have several
22:10:54 <r0bby> one i used for defining the datamodel which i need to update; one used for defining the domain model; one for the project plan
22:11:07 <r0bby> we've done most of our planning behind closed doors :X
22:16:02 <r0bby> Keelhaul:
22:16:04 <OpenMRSBot> <> (at
22:16:56 <r0bby> our design
22:17:02 <r0bby> took me a good couple weeks to fully grasp it
22:19:24 <Keelhaul> i see the extensions
22:19:35 <r0bby> yup
22:19:35 <Keelhaul> but thats no reason to call the mapping FacilityDataFormQuestion
22:19:51 <r0bby> because it represents the question as we display it on the form.
22:20:12 <r0bby> StockQuestion for example has a days and reason property
22:20:15 <Keelhaul> but you map it to a section
22:20:20 <r0bby> yup
22:21:24 <r0bby> Mike designed most of this -- all of it really
22:21:31 <r0bby> Darius had his hand in it too probably
22:21:36 <r0bby> Mike is talented :)
22:21:49 <Keelhaul> is there no concrete class for coded questions?
22:23:41 *** kane77 has quit IRC
22:25:06 *** jmiranda has quit IRC
22:25:11 <r0bby> there is.
22:25:16 <r0bby> BooleanCoded and StockQuestion
22:25:22 <Keelhaul> oh ok
22:25:24 <r0bby> BooleanCodedQuestion rather
22:25:54 <Keelhaul> so what happens if someone submits a form like that
22:26:13 <r0bby> it iterates over the schema and checks the question data type
22:26:19 <r0bby> then saves it approriately
22:26:54 <Keelhaul> where
22:26:59 <r0bby> FacilityDataValue
22:27:02 <Keelhaul> ok
22:27:48 <r0bby> I have a method to get all value instances. in my utility class which is bloated to say the least
22:30:40 <r0bby> have you specified many to many Keelhaul
22:30:48 <r0bby> <many-to-many column="question_id" class="org.openmrs.module.facilitydata.model.FacilityDataFormQuestion" order-by="position"/>
22:30:56 <r0bby> column is the column in the mapping table right?
22:31:02 <Keelhaul> hold on
22:33:05 <Keelhaul> yes
22:33:17 <Keelhaul> except order-by doesnt work for me in many to many
22:33:22 <Keelhaul> i get an exception
22:34:12 <r0bby> ah
22:34:19 <r0bby> ok that explains it's bitching :)
22:34:46 <Keelhaul> i'd really like it to work though
22:34:54 <Keelhaul> if you figure it out, tell me plz
22:35:58 <r0bby> I will
22:36:10 <Keelhaul> <many-to-many class="Problem">
22:36:10 <Keelhaul> <column name="related_problem_id" />
22:36:10 <Keelhaul> </many-to-many>
22:36:20 <Keelhaul> i have column as a child element rather than an attribute
22:36:30 <Keelhaul> if attribute works too, i'll change it
22:36:45 <r0bby> why are you not using it as an attribute
22:37:00 <Keelhaul> because i didnt know it's possible
22:37:08 <Keelhaul> i never looked at the dtd, just did what i saw in an example
22:37:24 <r0bby> you can do it an attribute
22:39:32 <Keelhaul> heh
22:40:02 <Keelhaul> eclipse actually fetches the dtd defined in the beginning of xml files and displays the list of possible attributes
22:43:00 <Keelhaul> er nm that
22:43:07 <Keelhaul> i was using visual studio, not eclipse
22:49:33 <r0bby> Keelhaul: what is the error you get?
22:49:38 <Keelhaul> forgot
22:49:38 <r0bby> repeated mapping?
22:56:11 *** atomicturtle has joined #openmrs
22:57:13 *** atomicturtle has left #openmrs
23:48:04 *** Mkop has quit IRC
23:50:36 *** Agnor has quit IRC
  • No labels