Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Refactor and consolidate parsing pathway #26

Closed
blacktm opened this issue Mar 28, 2013 · 1 comment
Closed

Refactor and consolidate parsing pathway #26

blacktm opened this issue Mar 28, 2013 · 1 comment

Comments

@blacktm
Copy link
Member

blacktm commented Mar 28, 2013

Original implementation included completely separate pathways for parsing different document types (CCDA, C32). The new implementation should diverge at the point of parsing and data extraction, then join before constructing the final data object. This will reduce redundancy and make it generally easier to test and maintain.

@blacktm
Copy link
Member Author

blacktm commented Apr 2, 2013

Modules responsible for processing each section of patient data now has a single method called process which is passed the source data in CCDA, VA C32, or JSON. The method then takes the pathway determined by the document type to extract data from the patient record, then joins back to assemble the resulting data structure.

Example taken from the Demographics module:

var process = function (source, type) {
  var data;

  switch (type) {
    case 'ccda':
      data = processCCDA(source);
      break;
    case 'va_c32':
      data = processVAC32(source);
      break;
    case 'json':
      return processJSON(source);
      break;
  }

  return {
    name: {
      prefix: data.prefix,
      given: data.given,
      family: data.family
    },
  ...

@blacktm blacktm closed this as completed Apr 2, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant