overview (1K)

What is MDO?
MDO is an interface. On one side it communicates with various data sources such as VistA, HL7, DICOM, XML and SQL. On the other side, it delivers to the client a uniform, well-defined suite of objects from the medical domain, objects such as patient, provider, progress note, lab result, etc. MDO delivers the same object regardless of the data source. So, to the client software, a progress note from VistA looks and behaves exactly the same as a progress note from HL7 or SQL or XML.

Since software powered by MDO doesn't need to know the origin of its data, no changes are required if a data source changes. If the software is written correctly it doesn't even have to be recompiled. MDO gets its data sources from an XML file. Consider this snippet, that shows the sites in VISN 11:

	
	<VhaVisn name="Veterans In Partnership" ID="11">
		<VhaSite name="Saginaw, MI" ID="655" moniker="SAG">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.SAGINAW.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Battle Creek, MI" ID="515" moniker="BAC">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.BATTLE-CREEK.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Detroit, MI" ID="553" moniker="DET">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.DETROIT.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Indianapolis, IN" ID="583" moniker="IND">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.INDIANAPOLIS.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Ann Arbor, MI" ID="506" moniker="ANN">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.ANN-ARBOR.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Danville, IL" ID="550" moniker="DAN">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.DANVILLE.MED.VA.GOV" status="active"/>
		</VhaSite>
		<VhaSite name="Northern Indiana" ID="610" moniker="NIN">
			<DataSource modality="HIS" protocol="VISTA" source="VISTA.NORTHERN-INDIANA.MED.VA.GOV" status="active"/>
		</VhaSite>
	</VhaVisn>
The modality for all these data sources is HIS, meaning the primary data source for this site. Other modalities might be ECG, RADIOLOGY, etc. The protocols are all VISTA, meaning the conversation is carried on via CPRS RPCs with the VistA listener. Now suppose one of these sites, say Detroit, becomes an HDR site. Merely changing the protocol to HDR would be sufficient. MDO would now talk HDR to this HIS instead of VISTA. In reality of course Detroit would keep its old VistA as well as the new HDR, so the real change to this file would be to change the VISTA modality to HIS2, meaning secondary HIS, and to add a new DataSource element with modality HIS, protocol HDR, etc. The Detroit entry would now look something like this:

		<VhaSite name="Detroit, MI" ID="553" moniker="DET">
			<DataSource modality="HIS" protocol="HDR" source="HDR.DETROIT.MED.VA.GOV" status="active"/>
			<DataSource modality="HIS2" protocol="VISTA" source="VISTA.DETROIT.MED.VA.GOV" status="active"/>
		</VhaSite>

All the client software that previously interacted with Detroit's VistA would now interact, with no futher changes, with Detroit's HDR. Let's see how this works with some code:

  1. MDO.DAOFactory daoFactory = MDO.DAOFactory.getDAOFactory(MDO.DAOFactory.getConstant("XML"));
  2. MDO.DataSourceDAO dao = daoFactory.getDataSourceDAO();
  3. dao.setSource(xmlPath);
  4. MDO.SiteTable siteTable = dao.buildSiteTable();
Line 1 instantiates a DAO factory for XML objects. Line 2 instantiates a DAO, and line 3 sets the DAO's source to the string xmlPath, which points to an XML file. Line 4 then instantiates an MDO SiteTable object that contains all our Region and Site objects. If the XML file we instantiated from was the previous snippet, our SiteTable object would contain 1 Region object (ID=11), and that Region object would contain 7 MDO Site objects. The Site object whose ID=553 and name="Detroit, MI" would contain 2 MDO DataSource objects.

Now let's use our new SiteTable to connect to the local site's HIS:

  1. MDO.Site loginSite = siteTable.getSite(siteID);
  2. MDO.DataSource his = loginSite.getHIS();
  3. MDO.DAOFactory daoFactory = MDO.DAOFactory.getDAOFactory(MDO.DAOFactory.getConstant(his.getProtocol()));
  4. MDO.DataSourceDAO loginDao = daoFactory.getDataSourceDAO();
  5. loginDao.setSite(loginSite);
  6. loginDao.setProps(his);
  7. loginDao.connect();
  8. String Text = loginDao.getWelcome();
Line 1 instantiates an MDO Site object called loginSite by passing the local site's site code to the SiteTable object. Line 2 instantiates an MDO DataSource object by getting the loginSite's DataSource that has modality HIS. Line 3 keys on the DataSource object's protocol property to instantiate a DAO factory to build a DAO for this data source. If we built this SiteTable prior to changing Detroit's HIS from VISTA to HDR this would result in a factory that built a VISTA DAO. If we built the SiteTable after the change the factory would build an HDR DAO. Notice that this code snippet has no idea what kind of data source it is dealing with. Line 4 instantiates a DAO for our login site and the next two lines set the new DAOs properties. Line 7 connects to the local data source and line 8 get the welcome message.

To summarize, MDO delivers objects that are identical regardless of their data source. A note is a note is a note.

How Does MDO Work?
MDO uses two design patterns: Abstract Factory and Data Access Object, as shown in the following diagram:

When the client software wants an object, it uses DaoFactory to instantiate the appropriate DAO. The protocol attribute from the XML file is passed as the parameter that decides what kind of DAO to create. The DAO then acquires the necessary data from its data source and creates the medical domain object. For example, to obtain a patient object from the Danville HIS, the Danville site object that was obtained from the above XML file is passed to DaoFactory. This will produce a VistaDao (since the Danville HIS has protocol VISTA) that will connect to VISTA.DANVILLE.MED.VA.GOV and speak "VISTA-ese". The VistA patient data will then be morphed into the MDO Patient object.

Vista DAOs
MDO is an ongoing project. The only DAOs currently implemented, or at least partially implemented, are the XML and the VISTA ones. The only thing implemented in the XML DAO is the functionality to read the XML site file and produce a SiteTable MDO. The VistaDAOs deserve a page of their own: Vista DAOs.