org.eclipse.ohf.ihe.xds.metadata.extract.cdar2
Class CDAR2Extractor

java.lang.Object
  extended by org.eclipse.ohf.ihe.xds.metadata.extract.cdar2.CDAR2Extractor
All Implemented Interfaces:
DocumentEntryElementExtractor, DocumentEntryExtractor

public class CDAR2Extractor
extends java.lang.Object
implements DocumentEntryExtractor, DocumentEntryElementExtractor

Extracts XDS Document Entry Metadata from generic CDA R2 document

Author:
Sarah Knoop

Field Summary
static java.util.HashMap ADMIN_GENDER_TABLE_001
          Map between CDA R2 Administrative Gender codes and HL7v2.5 Table 001(Administrative Sex).
static java.lang.String DESCRIPTOR
          Descriptor for Extractor
 
Constructor Summary
CDAR2Extractor(POCDMT000040ClinicalDocument cda)
          Loads CDA Document
 
Method Summary
 DocumentEntryType extract()
          Entry point to invoke extraction process.
 AuthorType[] extractAuthors()
          Extracts the relevant authorInstitution, authorPerson, authorRole and authorSpeciality information from the CDA: ClinicalDocument/author/assignedAuthor.
 AvailabilityStatusType extractAvailabilityStatus()
          CDA R2 document header does not contain information corresponding to availablity status metadata.
 CodedMetadataType extractClassCode()
          Extracts the relevant classCode information from the CDA: ClinicalDocument/code.
 InternationalStringType extractComments()
          CDA R2 document header does not contain information corresponding to comments metadata.
 CodedMetadataType extractConfidentialityCode()
          Extracts the relevant confidentialityCode information from the CDA: ClinicalDocument/confidentialityCode.
 java.lang.String extractCreationTime()
          Extracts the relevant creationTime information from the CDA: ClinicalDocument/effectiveTime.
 java.lang.String extractEntryUUID()
          DocumentEntry.entryUUID is an XDS specific attribute and outside the scope of any CDA R2 document.
 CodedMetadataType[] extractEventCodes()
          This extraction routine, at this point, does not attempt to extract event code metadata from a generic CDA R2 document.
 CodedMetadataType extractFormatCode()
          DocumentEntry.formatCode is an XDS specific attribute and outside the scope of any CDA R2 document.
 java.lang.String extractHash()
          DocumentEntry.hash is a comptuted value and outside the scope of any CDA R2 document.
 CodedMetadataType extractHealthCareFacilityTypeCode()
          Extracts the relevant healthcareFacilityTypeCode information from the CDA: ClinicalDocument/componentOf/encompassingEncounter/location/code
Note: healthcareFacilityTypeCode and practiceSettingCode data sources are the same in the CDA
 java.lang.String extractLanguageCode()
          Extracts the relevant languageCode information from the CDA: ClinicalDocument/languageCode
 XCN extractLegalAuthenticator()
          Extracts the relevant legalAuthenticator information from the CDA: ClinicalDocument/legalAuthenticator/assignedEntity/id and ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name
NOTES: 1.
 java.lang.String extractMimeType()
          DocumentEntry.mimeType is an XDS specific attribute and outside the scope of any CDA R2 document.
 java.lang.String extractParentDocumentId()
          DocumentEntry.parentDocumentId expresses the id of a parent document to this CDA document in the XDS Regisry.
 ParentDocumentRelationshipType extractParentDocumentRelationship()
          DocumentEntry.parentDocumentRelationship expresses the relationship of this CDA to another document in the XDS Regisry.
 CX extractPatientId()
          DocumentEntry.patientId expresses the Affinity Domain level patient id used in the XDS Regisry.
 CodedMetadataType extractPracticeSettingCode()
          Extracts the relevant practiceSettingCode information from the CDA: ClinicalDocument/componentOf/encompassingEncounter/location/code
Note: healthcareFacilityTypeCode and practiceSettingCode data sources are the same in the CDA
 java.lang.String extractServiceStartTime()
          Extracts the relevant serviceStartTime information from the CDA: ClinicalDocument/documentationOf/serviceEvent/effectiveTime This time is to be in UTC, but without the timezone offset or fractional seconds: [[[[[YYYY]MM]DD]HH]mm]ss].
 java.lang.String extractServiceStopTime()
          Extracts the relevant serviceStopTime information from the CDA: ClinicalDocument/documentationOf/serviceEvent/effectiveTime This time is to be in UTC, but without the timezone offset or fractional seconds: [[[[[YYYY]MM]DD]HH]mm]ss].
 java.lang.String extractSize()
          DocumentEntry.size is a comptuted value and outside the scope of any CDA R2 document.
 CX extractSourcePatientId()
          Extracts the relevant sourcePatientId information from the CDA: ClinicalDocument/recordTarget/patientRole/id
NOTES: 1.
 SourcePatientInfoType extractSourcePatientInfo()
          Extracts the relevant sourcePatientInfo information from the CDA: ClinicalDocument/recordTarget/patientRole
NOTES: 1.
 InternationalStringType extractTitle()
          Extracts the relevant title information from the CDA: ClinicalDocument/title
 CodedMetadataType extractTypeCode()
          Extracts the relevant typeCode information from the CDA: ClinicalDocument/code
Note: typeCode and classCode data sources are the same in the CDA
 java.lang.String extractUniqueId()
          Extracts the relevant uniqueId information from the CDA: ClinicalDocument/id (format is id@root^id@extension)
 java.lang.String extractURI()
          DocumentEntry.URI is a comptuted value and outside the scope of any CDA R2 document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR

public static final java.lang.String DESCRIPTOR
Descriptor for Extractor

See Also:
Constant Field Values

ADMIN_GENDER_TABLE_001

public static final java.util.HashMap ADMIN_GENDER_TABLE_001
Map between CDA R2 Administrative Gender codes and HL7v2.5 Table 001(Administrative Sex). Keys are CDAR2 AdministrativeGender object literal string representations and values are corresponding HL7v2.5 gender code values as strings.

Constructor Detail

CDAR2Extractor

public CDAR2Extractor(POCDMT000040ClinicalDocument cda)
Loads CDA Document

Parameters:
cda - the CDA R2 document to extract metadata from for the document entry metadata. Cannot be null.
Method Detail

extract

public DocumentEntryType extract()
                          throws MetadataExtractionException
Entry point to invoke extraction process.
NOTES:
  • 1. Only the first ClinicalDocument/documentationOf instance will be considered for it's ServiceEvent time to fill values for serviceStartTime and serviceStopTime
  • 2. Only the first ClinicalDocument/recordTarget instance will be considered for sourcePatientId (for which only the first patientRole/id on it's list will be taken) and sourcePatientInfo .
  • 3. XDS metadata does not accept CX types that have more or fewer components than CX.1, CX.4.2,CX.4.3. Other corresponding componets will not be extracted.
  • 4. XDS metadata validation for 2007 Connectathon will not accept DTM types beyond precision of YYYYMMDDHHMMSS. Precision has been truncated on values that include fractional seconds or time zone corrections
  • 5. XDS metadata validation for 2007 Connectathon will not accept SourcePatientInfo beyond local patient ids, patient name, address, birthdate and gender. Other patient info in the CDA that corresponds to source patient info will not be extracted.
  • Specified by:
    extract in interface DocumentEntryExtractor
    Throws:
    MetadataExtractionException

    extractAuthors

    public AuthorType[] extractAuthors()
    Extracts the relevant authorInstitution, authorPerson, authorRole and authorSpeciality information from the CDA: ClinicalDocument/author/assignedAuthor. FIXME documentation CDA: ClinicalDocument/legalAuthenticator/assignedEntity/id and ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name
    NOTES:
  • 1. Only the first ClinicalDocument/legalAuthenticator/assignedEntity/id instance and first ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name instance will be considered for values for the legal authenticator XCN
  • Specified by:
    extractAuthors in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractAuthors()

    extractAvailabilityStatus

    public AvailabilityStatusType extractAvailabilityStatus()
    CDA R2 document header does not contain information corresponding to availablity status metadata.

    Specified by:
    extractAvailabilityStatus in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractAvailabilityStatus()

    extractClassCode

    public CodedMetadataType extractClassCode()
    Extracts the relevant classCode information from the CDA: ClinicalDocument/code.
    Note: typeCode and classCode data sources are the same in the CDA

    Specified by:
    extractClassCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractClassCode()

    extractComments

    public InternationalStringType extractComments()
    CDA R2 document header does not contain information corresponding to comments metadata.

    Specified by:
    extractComments in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractComments()

    extractConfidentialityCode

    public CodedMetadataType extractConfidentialityCode()
    Extracts the relevant confidentialityCode information from the CDA: ClinicalDocument/confidentialityCode.

    Specified by:
    extractConfidentialityCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractConfidentialityCode()

    extractCreationTime

    public java.lang.String extractCreationTime()
    Extracts the relevant creationTime information from the CDA: ClinicalDocument/effectiveTime. This time is to be in UTC, but without the timezone offset or fractional seconds: [[[[[YYYY]MM]DD]HH]mm]ss]. Thus, this time is assumed to be in GMT. So, if the timestamp in the corresponding CDA element contains the timezone offset, this method will convert the timestamp to GMT. If the timezone offset is ommitted, then the timestamp is assumed to be in GMT.

    Specified by:
    extractCreationTime in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractCreationTime()

    extractEntryUUID

    public java.lang.String extractEntryUUID()
    DocumentEntry.entryUUID is an XDS specific attribute and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractEntryUUID in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractEntryUUID()

    extractEventCodes

    public CodedMetadataType[] extractEventCodes()
    This extraction routine, at this point, does not attempt to extract event code metadata from a generic CDA R2 document.

    Specified by:
    extractEventCodes in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractEventCodes()

    extractFormatCode

    public CodedMetadataType extractFormatCode()
    DocumentEntry.formatCode is an XDS specific attribute and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractFormatCode in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractFormatCode()

    extractHash

    public java.lang.String extractHash()
    DocumentEntry.hash is a comptuted value and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractHash in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractHash()

    extractHealthCareFacilityTypeCode

    public CodedMetadataType extractHealthCareFacilityTypeCode()
    Extracts the relevant healthcareFacilityTypeCode information from the CDA: ClinicalDocument/componentOf/encompassingEncounter/location/code
    Note: healthcareFacilityTypeCode and practiceSettingCode data sources are the same in the CDA

    Specified by:
    extractHealthCareFacilityTypeCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractHealthCareFacilityTypeCode()

    extractLanguageCode

    public java.lang.String extractLanguageCode()
    Extracts the relevant languageCode information from the CDA: ClinicalDocument/languageCode

    Specified by:
    extractLanguageCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractLanguageCode()

    extractLegalAuthenticator

    public XCN extractLegalAuthenticator()
    Extracts the relevant legalAuthenticator information from the CDA: ClinicalDocument/legalAuthenticator/assignedEntity/id and ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name
    NOTES:
  • 1. Only the first ClinicalDocument/legalAuthenticator/assignedEntity/id instance and first ClinicalDocument/legalAuthenticator/assignedEntity/assignedPerson/name instance will be considered for values for the legal authenticator XCN
  • Specified by:
    extractLegalAuthenticator in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractLanguageCode()

    extractMimeType

    public java.lang.String extractMimeType()
    DocumentEntry.mimeType is an XDS specific attribute and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractMimeType in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractMimeType()

    extractParentDocumentId

    public java.lang.String extractParentDocumentId()
    DocumentEntry.parentDocumentId expresses the id of a parent document to this CDA document in the XDS Regisry. This is not necessairly the same parent document that is documented within the CDA. Thus, this information is not extracted.

    Specified by:
    extractParentDocumentId in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractParentDocumentId()

    extractParentDocumentRelationship

    public ParentDocumentRelationshipType extractParentDocumentRelationship()
    DocumentEntry.parentDocumentRelationship expresses the relationship of this CDA to another document in the XDS Regisry. This is not necessairly the same relationship documented within the CDA. Thus, this infomation is not extracted.

    Specified by:
    extractParentDocumentRelationship in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractParentDocumentRelationship()

    extractPatientId

    public CX extractPatientId()
    DocumentEntry.patientId expresses the Affinity Domain level patient id used in the XDS Regisry. In all cases, this is not necessairly the same patientId that is documented within the CDA. Thus, this information is not extracted.

    Specified by:
    extractPatientId in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractPatientId()

    extractPracticeSettingCode

    public CodedMetadataType extractPracticeSettingCode()
    Extracts the relevant practiceSettingCode information from the CDA: ClinicalDocument/componentOf/encompassingEncounter/location/code
    Note: healthcareFacilityTypeCode and practiceSettingCode data sources are the same in the CDA

    Specified by:
    extractPracticeSettingCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractPracticeSettingCode()

    extractServiceStartTime

    public java.lang.String extractServiceStartTime()
    Extracts the relevant serviceStartTime information from the CDA: ClinicalDocument/documentationOf/serviceEvent/effectiveTime This time is to be in UTC, but without the timezone offset or fractional seconds: [[[[[YYYY]MM]DD]HH]mm]ss]. Thus, this time is assumed to be in GMT. So, if the timestamp in the corresponding CDA element contains the timezone offset, this method will convert the timestamp to GMT. If the timezone offset is ommitted, then the timestamp is assumed to be in GMT. NOTES:
  • 1. Only the first ClinicalDocument/documentationOf instance will be considered for it's ServiceEvent time to fill values for serviceStartTime and serviceStopTime
  • 2. XDS metadata validation for 2007 Connectathon will not accept DTM types beyond precision of YYYYMMDDHHMMSS. Precision has been truncated on values that include fractional seconds or time zone corrections
  • Specified by:
    extractServiceStartTime in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractServiceStartTime()

    extractServiceStopTime

    public java.lang.String extractServiceStopTime()
    Extracts the relevant serviceStopTime information from the CDA: ClinicalDocument/documentationOf/serviceEvent/effectiveTime This time is to be in UTC, but without the timezone offset or fractional seconds: [[[[[YYYY]MM]DD]HH]mm]ss]. Thus, this time is assumed to be in GMT. So, if the timestamp in the corresponding CDA element contains the timezone offset, this method will convert the timestamp to GMT. If the timezone offset is ommitted, then the timestamp is assumed to be in GMT.
    NOTES:
  • 1. Only the first ClinicalDocument/documentationOf instance will be considered for it's ServiceEvent time to fill values for serviceStartTime and serviceStopTime
  • 2. XDS metadata validation for 2007 Connectathon will not accept DTM types beyond precision of YYYYMMDDHHMMSS. Precision has been truncated on values that include fractional seconds or time zone corrections
  • Specified by:
    extractServiceStopTime in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractServiceStopTime()

    extractSize

    public java.lang.String extractSize()
    DocumentEntry.size is a comptuted value and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractSize in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractSize()

    extractSourcePatientId

    public CX extractSourcePatientId()
    Extracts the relevant sourcePatientId information from the CDA: ClinicalDocument/recordTarget/patientRole/id
    NOTES:
  • 1. Only the first ClinicalDocument/recordTarget instance will be considered for sourcePatientId (for which only the first patientRole/id on it's list will be taken) and sourcePatientInfo .
  • 2. XDS metadata does not accept CX types that have more or fewer components than CX.1, CX.4.2,CX.4.3. Other corresponding componets will not be extracted.
  • Specified by:
    extractSourcePatientId in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractSourcePatientId()

    extractSourcePatientInfo

    public SourcePatientInfoType extractSourcePatientInfo()
    Extracts the relevant sourcePatientInfo information from the CDA: ClinicalDocument/recordTarget/patientRole
    NOTES:
  • 1. Only the first ClinicalDocument/recordTarget instance will be considered for sourcePatientId (for which only the first patientRole/id on it's list will be taken) and sourcePatientInfo .
  • 2. Extracts all id of the list of ids for PatientRole to PID-3 and the PatientRole/Patient/id
  • 3. XDS metadata does not accept CX types that have more or fewer components than CX.1, CX.4.2,CX.4.3. Other corresponding componets will not be extracted.
  • 4. XDS metadata validation for 2007 Connectathon will not accept SourcePatientInfo beyond local patient ids, patient name, address, birthdate and gender. Other patient info in the CDA that corresponds to source patient info will not be extracted.
  • 5.Only the first address will be considered for extraction, only the first subelements of the AD type will be considered for extraction.
  • Specified by:
    extractSourcePatientInfo in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractSourcePatientInfo()

    extractTitle

    public InternationalStringType extractTitle()
    Extracts the relevant title information from the CDA: ClinicalDocument/title

    Specified by:
    extractTitle in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractTitle()

    extractTypeCode

    public CodedMetadataType extractTypeCode()
    Extracts the relevant typeCode information from the CDA: ClinicalDocument/code
    Note: typeCode and classCode data sources are the same in the CDA

    Specified by:
    extractTypeCode in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractTypeCode()

    extractURI

    public java.lang.String extractURI()
    DocumentEntry.URI is a comptuted value and outside the scope of any CDA R2 document. Thus, it cannot be extracted.

    Specified by:
    extractURI in interface DocumentEntryElementExtractor
    Returns:
    null
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractURI()

    extractUniqueId

    public java.lang.String extractUniqueId()
    Extracts the relevant uniqueId information from the CDA: ClinicalDocument/id (format is id@root^id@extension)

    Specified by:
    extractUniqueId in interface DocumentEntryElementExtractor
    Returns:
    Returns the populated attribute. Returns null if this attribute cannot be rendered from the source data.
    See Also:
    org.eclipse.ohf.ihe.xds.metadata.extract.DocumentEntryElementExtractor.extractUniqueId()