All OpenMRS ID accounts have been reset.

Read more and change your password before signing in.
Icon

EXTENDED: OMRS14 Proposals due 30 April! Read more and submit a proposal at OpenMRS Talk.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Currently we have completed work on stage one of the project, which is to store user defined strategies in the database.
Previously, user defined strategies were stored in the Config.xml file as follows,

Code Block
borderStylesolid
titleconfig.xml fragment
borderStylesolid

 <run estimate="false" name="famName" npairs="0" null_EM="false" null_scoring="false"
        p="0.0"
        random-sample="true"
        sample-size="100000"
        ulocked="false">
      <row name="(Attribute) Birthplace" trinomial_EM="false">
         <BlockOrder>null</BlockOrder>
         <BlckChars>40</BlckChars>
         <Include>false</Include>
         <TAgreement>0.9</TAgreement>
         <NonAgreement>0.1</NonAgreement>
         <ScaleWeight>null</ScaleWeight>
         <Algorithm>Exact Match</Algorithm>
         <SetID>0</SetID>
      </row>
      <row name="(Attribute) Citizenship" trinomial_EM="false">
         <BlockOrder>null</BlockOrder>
         <BlckChars>40</BlckChars>
         <Include>false</Include>
         <TAgreement>0.9</TAgreement>
         <NonAgreement>0.1</NonAgreement>
         <ScaleWeight>null</ScaleWeight>
         <Algorithm>Exact Match</Algorithm>
         <SetID>0</SetID>
      </row>
      <row name="(Attribute) Civil Status" trinomial_EM="false">
         <BlockOrder>null</BlockOrder>
         <BlckChars>40</BlckChars>
         <Include>false</Include>
         <TAgreement>0.9</TAgreement>
         <NonAgreement>0.1</NonAgreement>
         <ScaleWeight>null</ScaleWeight>
         <Algorithm>Exact Match</Algorithm>
         <SetID>0</SetID>
      </row>
         -------------------
         --------------
         ----------
         ------


Given above is a sample xml file depicting how a strategy is stored. AS you can see, a single ConfigurationEntry is stored as a <row> tag attribute. Each Strategy has n-many ConfigurationEntries, which may or many not be used for the scoring.

However, not all these data columns should be persisted as many of them are merely hard coded values. Therefore, the database scheme for strategies are as follows,

Code Block
borderStylesolid
titlesqldiff fragment
borderStylesolid
<sql>
CREATE TABLE `patientmatching_configuration` (
			`configuration_id` int AUTO_INCREMENT,
			`configuration_name` varchar(255) default NULL UNIQUE,
			`random_sample_size` int default NULL,
			`using_random_sample` smallint(6) NOT NULL DEFAULT '0',
			PRIMARY KEY (`configuration_id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8;

			CREATE TABLE `patientmatching_configurationEntries` (
			`entry_id` int AUTO_INCREMENT PRIMARY KEY,
			`configuration_id` int default NULL,
			`field_view_name` varchar(255) default NULL,
			`field_name` varchar(255) default NULL,
			`inclusion` varchar(50) default NULL,
			`block_order` int NOT NULL DEFAULT '0',
			`flag` varchar(50) DEFAULT NULL,
			KEY `configurationEntries_id` (`configuration_id`),
			CONSTRAINT `configurationEntries_id` FOREIGN KEY (`configuration_id`)
			REFERENCES `patientmatching_configuration` (`configuration_id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8;
				
		</sql>

Stage two of this effort would be to store reports in the database using the PatientMatching strategies created by the user.
We are leaving this phase open for our GSOC student !

...

1. Sample report number 1

Code Block
borderStylesolid
titlesampe report
borderStylesolid
Group Id|Unique Id|patientmatching.org.openmrs.Patient.birthdate|patientmatching.org.openmrs.Patient.dead|patientmatching.org.openmrs.Patient.gender|patientmatching.org.openmrs.PersonName.familyName|patientmatching.org.openmrs.PersonName.givenName|patientmatching.org.openmrs.PersonName.middleName
0|10024|1991-01-01 00:00:00.0|false|f|maxine|catherine|j
0|10026|1991-01-01 00:00:00.0|false|f|j|catherine|maxine

...

2. Sample report number 2

Code Block
borderStylesolid
titlesampe report
borderStylesolid
Group Id|Unique Id|patientmatching.org.openmrs.Patient.birthdate|patientmatching.org.openmrs.Patient.dead|patientmatching.org.openmrs.Patient.gender|patientmatching.org.openmrs.PersonName.familyName|patientmatching.org.openmrs.PersonName.givenName|patientmatching.org.openmrs.PersonName.middleName
0|10024|1991-01-01 00:00:00.0|false|f|maxine|catherine|j
0|10026|1991-01-01 00:00:00.0|false|f|j|catherine|maxine
1|10005|1982-10-11 00:00:00.0|false|f|ganu|deepa|abhishek
1|10023|2009-03-12 00:00:00.0|false|f|ganu|deepa|
2|10031|1945-01-01 00:00:00.0|false|f|jane|mary|
2|10032|1991-01-01 00:00:00.0|false|f|jane|mary|j

So our question is, what is the best way to model the above xml files as sql tables ? Do note that the columns of every report is not going to be the same. Columns will change based on which Strategies are used to create the report.

Svn commit rev. Ids.

Gliffy Diagram
nameClass_Diagram_report_table
sizeM
Wiki Markup
{mockup:Transform flat file to Datbse|1}
Wiki Markup
{mockup:report_table|1}