Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Continuity of Care Document (CCD)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Continuity of Care Document (CCD)

    Good afternoon!

    Has anyone take a CCD record and converted/ported into a table?
    Does anyone know of an application that can do this?

    I'm being retained to extract data from an electronic medical record system where I have to create CCD using the source application (using a screen scrubber). The destination application does not make discrete data of the CCD so I need to convert to another format so they can port into their application. (Huge Company but no resources. go figure). The only reason for creating a ccd in the first place is because the source tables don't appear to store the data where one can find.

    Any and all help much appreciated!
    -O.G.
    Creating Healthcare Work-Flow Solutions Since 2005

    #2
    Re: Continuity of Care Document (CCD)

    an example I saw was a simple xml document - should be a piece of cake parsing out the records and fields into a table
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    Comment


      #3
      Re: Continuity of Care Document (CCD)

      I don't know if this is helpful, but we use a program called "Monarch" to scrape reports and create dbf files from the scraped information.

      Tom

      Comment


        #4
        Re: Continuity of Care Document (CCD)

        Thanks, I found a couple of cool tools that would take the xml and create the tables. I worked with another xml instead of the CCd and the problem I ran into was that the xml was very "variable" where the elements could change in quantity. I scrapped the idea because of time constraints. The electronic health record vendor had significantly more resources to accomplish the same and didn't want to tackle it. The project was a data extraction from one electronic medical record vendor to another and well too much liability.. Thanks again for posting!!
        Creating Healthcare Work-Flow Solutions Since 2005

        Comment


          #5
          Re: Continuity of Care Document (CCD)

          Omar,
          I've created a script to extract some of the information from a CCD, but not all. As you pointed out, there's intentionally room for a lot of variability in CCDs. Here's the script that I've written, which is obviously dependent on the tables that are in my EHR. It will parse out the medications, allergies, problem list, and gives the user an opportunity to
          correct entries if, say, the received medication list is inaccurate (which happens half the time, in my experience!). Hope this helps if you are still working on the project.

          'Date Created: 15-Sep-2013 08:13:55 AM
          'Last Updated: 10-Oct-2013 08:50:49 PM
          'Created By : peter
          'Updated By : peter
          ' parse cda file
          if .not. eval_valid("cnw") then
          dim cnw as sql::connection
          cnw.open("::name::wms")
          end if

          fn=ui_get_file("Read CDA file","CDA(*.XML)","","Y")
          if fn="" then
          end
          end if
          dom=*XML_Document(file.to_string(fn))
          documentTimeP=dom.QueryElement("*tag='effectiveTime'").all[1]
          documentTime=getProperty(documentTimeP,"effectiveTime","value")
          dim documentDate as d=stod(left(documentTime,8))
          patientRole=dom.QueryElement("*tag='patientRole'").all[1]
          patients=patientRole.QueryElement("*tag='patient'")
          'patients=dom.QueryElement("*fullname='anonymous.ClinicalDocument.recordTarget.patientRole.patient'")
          patient=patients.all[1]
          fname=alltrim(patient.QueryElement("*tag='given'").all[1].Output("*value"))
          lname=alltrim(patient.QueryElement("*tag='family'").all[1].Output("*value"))
          pname=alltrim(fname)+" "+alltrim(lname)

          raceCode=getProperty(patient,"raceCode","code")
          raceDisplayName=getProperty(patient,"raceCode","displayName")
          ethnicCode=getProperty(patient,"ethnicGroupCode","code")
          ethnicDisplayName=getProperty(patient,"ethnicGroupCode","displayName")
          dim dob as d=stod(getProperty(patient,"birthTime","value"))
          dim cdob as c=""+dob
          sexCode=getProperty(patient,"administrativeGenderCode","code")
          sexDisplay=getProperty(patient,"administrativeGenderCode","displayName")
          maritalStatusCode=getProperty(patient,"maritalStatusCode","code")
          maritalStatusDisplay=getProperty(patient,"maritalStatusCode","displayName")

          ' first, try match on dob, sex, and last name
          sql=<<%sql%
          SELECT concat('{DATA=',account,'}',last_name,', ',first_name) FROM patient WHERE dob=:dob AND sex=:sex AND last_name=:last_name
          %sql%
          dim args as sql::Arguments
          args.clear()
          args.set("dob",dob)
          args.set("sex",sexCode)
          args.set("last_name",lname)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 40 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          dim a_acct as c=rs.ToString()
          delete rs
          if a_acct="" then
          sql=<<%sql%
          SELECT concat('{DATA=',account,'}',last_name,', ',first_name) FROM patient WHERE dob=:dob AND sex=:sex
          %sql%
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 51 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          a_acct=rs.ToString()
          delete rs
          end if
          dim acct as c=""
          varC_reply=ui_dlg_box("Incoming C-CDA Patient",<<%dlg%
          {font=Arial,9}
          {units=f}
          {region}
          Last name: |{text=30,1lname};
          First name: |{text=30,1fname};
          Sex: |{text=2,1sexCode};
          Birthdate: |{text=14,1cdob}
          {endregion};
          These patients are our closest matches.;
          Choose a match: [%O={@@}%.40,5acct^#a_acct];
          <Accept?acct\>""> <Cancel>;
          %dlg%)
          if varC_reply="Cancel" then
          end
          end if

          sql="SELECT * FROM allergies WHERE account=:account AND active='Y'"
          args.clear()
          args.set("account",acct)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 88 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          knownAllergies=""
          while rs.nextRow()
          knownAllergies=knownAllergies+rs.data("drug")+"("+rs.data("rxcui")+"):"+rs.data("reaction")+"("+rs.data("snomedRxn")+")"+\
          rs.data("severity")+"("+rs.data("severityCode")+")"+crlf()
          end while
          delete rs
          sql=<<%sql%
          SELECT * FROM medications WHERE account=:account AND noteID=0 AND errorComment is null AND dateEnded is null
          %sql%
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 102 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          knownMedications=""
          while rs.nextRow()
          knownMedications=knownMedications+rs.data("drug")+"("+rs.data("rxcui")+"):"+rs.data("doseUnit")+":"+rs.data("route")+" "+\
          rs.data("frequency")+crlf() '+rs.data("fillInstructions")+crlf()
          end while
          delete rs

          ' known problems
          sql=<<%sql%
          select description,snomed from problemlist where account=:account AND status='Active'
          %sql%
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 118 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          dim knownProblems as c=""
          while rs.nextRow()
          knownProblems=knownProblems+rs.data("description")+"("+rs.data("snomed")+")"+crlf()
          end while
          delete rs

          sblist=dom.queryElement("*tag='structuredBody'")
          sb=sblist.all[1]
          sections=sb.queryElement("*tag='section'")
          nsections=sections.all.size()

          dim playingEntityCoded as l
          for i=1 to nsections
          sect=sections.all[i]
          sectionCode=sect.queryElement("*tag='code' .and. codeSystem='2.16.840.1.113883.6.1'").all[1]
          sectionDisplayName=sectionCode.AttributeGet("displayName")
          'showvar(sectionDisplayName)
          allergyList=sect.queryElement("code='48765-2'")
          if allergyList.all.size()>0 then
          dim allergies as c=""
          allergiesEntryList=sect.queryElement("*tag='entry'")
          totalAllergies=allergiesEntryList.all.size()
          for j=1 to totalAllergies
          allergiesEntry=allergiesEntryList.all[j]
          playingEntity=allergiesEntry.queryElement("*tag='playingEntity'").all[1]
          playingEntityCoded=playingEntity.queryElement("*tag='code' .and. code>''").all.size()>0

          if playingEntityCoded then
          rxcui=getProperty(playingEntity,"code","code")
          displayName=getProperty(playingEntity,"code","displayName")
          observation=allergiesEntry.queryElement("*tag='entryRelationship'").all[1].queryElement("*tag='observation'").all[1]
          manifestation=allergiesEntry.queryElement("*tag='entryRelationship' .and. typeCode='MFST'").all[1].queryElement("*tag='observation'").all[1]

          reactionCoded=manifestation.queryElement("*tag='value' .and. xsi:type='CD'").all.size()>0
          if reactionCoded then
          reactionCodeEntry=manifestation.queryElement("*tag='value' .and. xsi:type='CD'").all[1]
          reactionCode=getProperty(reactionCodeEntry,"value","code")
          reactionDisplayName=getProperty(reactionCodeEntry,"value","displayName")
          else
          reaction=alltrim(manifestation.queryElement("*tag='text'").all[1].innerXML)
          if "<reference"$reaction then
          reactionDisplayName=word(reaction,1,"<reference")

          end if
          reactionCode=""
          end if
          else
          displayName=ALLTRIM(playingEntity.queryElement("*tag='name'").all[1].innerXML)
          rxcui=""
          manifestation=allergiesEntry.queryElement("*tag='entryRelationship' .and. typeCode='MFST'").all[1].queryElement("*tag='observation'").all[1]

          reactionCoded=manifestation.queryElement("*tag='value' .and. xsi:type='CD'").all.size()>0
          if reactionCoded then
          reactionCodeEntry=manifestation.queryElement("*tag='value' .and. xsi:type='CD'").all[1]
          reactionCode=getProperty(reactionCodeEntry,"value","code")
          reactionDisplayName=getProperty(reactionCodeEntry,"value","displayName")
          else
          reaction=alltrim(manifestation.queryElement("*tag='text'").all[1].innerXML)
          if "<reference"$reaction then
          reactionDisplayName=word(reaction,1,"<reference")
          end if
          reactionCode=""
          end if
          end if
          subjectiveEntryRelationships=allergiesEntry.queryElement("*tag='entryRelationship' .and. typeCode='SUBJ' .and. inversionInd='true'")
          if subjectiveEntryRelationships.all.size()=0 then
          severity="";severityCode=""
          else
          subjectiveEntryRelationship=subjectiveEntryRelationships.all[1]
          valueEntries=subjectiveEntryRelationship.queryElement("*tag='value' .and. xsi:type='CE'")
          valueEntry=valueEntries.all[1]
          severityCode=getProperty(valueEntry,"value","code")
          severity=getProperty(valueEntry,"value","displayName")
          end if
          allergies=allergies+displayName+"("+rxcui+"):"+reactionDisplayName+"("+reactionCode+"):"+severity+"("+severityCode+")"+crlf()
          next
          dim one as c=""
          ui_dlg_box("Allergies",<<%dlg%
          {font=Arial,9}
          {units=f}
          Allergies in C-CDA:; [.80,5one^#allergies];
          Known allergies:; [%r%.80,5dummy^#knownAllergies];
          <Add allergy to our system!add?one\>""> <Continue>;
          %dlg%,<<%code%
          if a_dlg_button="add" then
          a_dlg_button=""
          sql=<<%SQL%
          INSERT INTO allergies (account,dateNoted,drug,rxcui,reaction,snomedRxn,active,recordedBy,severity,severityCode)
          VALUES (:account,curdate(),:drug,:rxcui,:reaction,:snomedRxn,'Y',:user,:severity,:severityCode)
          %SQL%
          args.clear()
          args.set("account",acct)
          args.set("drug",word(one,1,"("))
          args.set("rxcui",word(word(one,2,"("),1,")"))
          reactionPart=word(one,2,":")
          args.set("reaction",word(reactionPart,1,"("))
          args.set("snomedRxn",word(word(reactionPart,2,"("),1,")"))
          severityPart=word(one,3,":")
          args.set("severity",word(severityPart,1,"("))
          args.set("severityCode",word(word(severityPart,2,"("),1,")"))
          args.set("user",user)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 224 in parseCDA",cnw.callresult.text)
          end
          end if
          sql="SELECT * FROM allergies WHERE account=:account AND active='Y'"
          args.clear()
          args.set("account",acct)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 231 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          knownAllergies=""
          while rs.nextRow()
          knownAllergies=knownAllergies+rs.data("drug")+"("+rs.data("rxcui")+"):"+rs.data("reaction")+"("+rs.data("snomedRxn")+")"+\
          rs.data("severity")+"("+rs.data("severityCode")+")"+crlf()
          end while
          delete rs
          end if
          %code%)
          end if
          medicationList=sect.queryElement("code='10160-0'")
          if medicationList.all.size()>0 then
          dim medications as c=""
          medicationsEntryList=sect.queryElement("*tag='entry'")
          totalMedications=medicationsEntryList.all.size()
          for j=1 to totalMedications
          medicationEntry=medicationsEntryList.all[j]
          routeCode=medicationEntry.queryElement("*tag='routeCode'").all[1]
          route=getProperty(routeCode,"reference","value")
          doseQuantity=getProperty(medicationEntry,"doseQuantity","value")
          directionsText=alltrim(medicationEntry.queryElement("*tag='text'").all[1].innerXML)

          directions=word(directionsText,1,"<")+word(directionsText,2,">") ' skip the <reference> tag
          rx=medicationEntry.queryElement("*tag='manufacturedMaterial'").all[1]

          rxNorm=getProperty(rx,"code","code")
          displayName=getProperty(rx,"code","displayName")
          entryRelationshipList=medicationEntry.queryElement("*tag='entryRelationship' .and. typeCode='SUBJ'")
          if entryRelationshipList.all.size()>0 then
          entryRelationship=entryRelationshipList.all[1]
          providerInstructions=alltrim(entryRelationship.queryElement("*tag='text'").all[1].innerXML)
          providerInstructions=word(providerInstructions,1,"<")
          else
          providerInstructions=""
          end if
          medications=medications+displayName+"("+rxNorm+"):"+doseQuantity+":"+route+crlf()+directions+\
          if(providerInstructions>"",crlf()+providerInstructions,"")+crlf(2)

          next
          one="";otherFreq="";freq="";fillInstructions="Generic substitution allowed";prn="";nbr="";route="";otherRoute=""
          dim add as l=.f.
          routeCodes=cnw.ToString("select description from routeCodes order by description")
          ui_dlg_box("Medications",<<%dlg%
          {font=Arial,9}
          {units=f}
          Medications in C-CDA:;
          {region}
          [.80,5one^#medications]|{region}<Add selected!add?one\>"">;<Continue>{endregion}
          {endregion};
          Medications known to us:;
          [.80,5two^#knownMedications];

          {condition=(add=.t.)}
          {region}
          (nbr:1) (nbr:2) (nbr:3) (nbr:4) (nbr:other);
          Other number: [.15otherNbr]
          {endregion};
          {region}
          (route:po) (route:SC) (route:IM) (route:SL) (route:rectal) (route:resp.) (route:other);
          Other route: [.35,5otherRoute^#routeCodes];
          {endregion};
          {region}
          (freq:daily)|(freq: in a.m.)|(freq:hs)|(freq:bid)|(freq:tid)|(freq:qid);
          (freq:q4h)|(freq:q6h)|(freq:q8h)|(freq:q12h)|(freq:weekly)|(freq:other)|PRN: (2prn);
          {endregion};
          {region}
          Other Frequency: [100.80otherFreq]
          {endregion};
          (fillInstructions:Generic substitution allowed) (fillInstructions:Dispense as written);
          {lf};
          <Save> <Cancel>;
          {condition=.t.}

          %dlg%,<<%code%
          if a_dlg_button="add" then
          a_dlg_button=""
          add=.t.
          end if
          if a_dlg_button="Save" then
          a_dlg_button=""

          saveMed(local_variables())
          add=.f.
          one=""
          sql=<<%sql%
          SELECT * FROM medications WHERE account=:account AND noteID=0 AND errorComment is null AND dateEnded is null
          %sql%
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 293 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          knownMedications=""
          while rs.nextRow()
          knownMedications=knownMedications+rs.data("drug")+"("+rs.data("rxcui")+"):"+rs.data("doseUnit")+":"+rs.data("route")+" "+\
          rs.data("frequency")+crlf() '+rs.data("fillInstructions")+crlf()
          end while
          delete rs
          end if
          %code%)
          end if
          vitalsList=sect.queryElement("code='8716-3'")
          if vitalsList.all.size()>0 then
          dim vitals as c=""
          vitalsEntryList=sect.queryElement("*tag='entry'")
          totalVitals=vitalsEntryList.all.size()
          for j=1 to totalVitals
          vitalEntry=vitalsEntryList.all[j]
          observationList=vitalEntry.queryElement("*tag='observation'")
          nObservations=observationList.all.size()
          for k=1 to nObservations
          observation=observationList.all[k]
          parameter=getProperty(observation,"code","code")
          displayName=getProperty(observation,"code","displayName")
          obsValue=getProperty(observation,"value","value")
          units=getProperty(observation,"value","unit")
          dateTime=getProperty(observation,"effectiveTime","value")
          if dateTime="" then
          effTime=observation.queryElement("*tag='effectiveTime'").all[1]
          dateTime=getProperty(effTime,"low","value")
          end if
          vitals=vitals+dateTime+"--"+displayName+"("+parameter+") "+obsValue+" "+units+crlf()

          next
          vitals=vitals+crlf()
          next
          'ui_msg_box("Vitals",vitals)
          end if
          resultsList=sect.queryElement("code='30954-2'")
          if resultsList.all.size()>0 then
          dim results as c
          resultsEntryList=sect.queryElement("*tag='entry'")
          totalResults=resultsEntryList.all.size()
          for j=1 to totalResults
          resultEntry=resultsEntryList.all[j]
          observationList=resultEntry.queryElement("*tag='observation'")
          nObservations=observationList.all.size()
          for k=1 to nObservations
          observation=observationList.all[k]
          parameter=getProperty(observation,"code","code")
          displayName=getProperty(observation,"code","displayName")
          obsValue=getProperty(observation,"value","value")
          units=getProperty(observation,"value","unit")
          dateTime=getProperty(observation,"effectiveTime","value")
          if dateTime="" then
          effTime=observation.queryElement("*tag='effectiveTime'").all[1]
          dateTime=getProperty(effTime,"low","value")
          end if
          results=results+dateTime+"--"+displayName+"("+parameter+") "+obsValue+" "+units+crlf()

          next
          results=results+crlf()
          next
          'showvar(results)
          end if

          problemsList=sect.queryElement("code='11450-4'")
          if problemsList.all.size()>0 then
          dim problems as c
          problemsEntryList=sect.queryElement("*tag='entry'")
          totalproblems=problemsEntryList.all.size()
          dom.MarkElements("typeCode='REFR'",.t.)
          dom.deleteMarked()
          for j=1 to totalproblems
          problemEntry=problemsEntryList.all[j]
          observationList=problemEntry.queryElement("*tag='observation'")
          nObservations=observationList.all.size()
          for k=1 to nObservations
          observation=observationList.all[k]
          snomeds=observation.queryElement("*tag='value' .and. codeSystem='2.16.840.1.113883.6.96'")
          if snomeds.all.size()=0 then
          snomeds=observation.queryElement("*tag='translation' .and. codeSystem='2.16.840.1.113883.6.96'")
          end if
          if snomeds.all.size()>0 then
          snomed=snomeds.all[1]
          parameter=snomed.AttributeGet("code")
          displayName=snomed.AttributeGet("displayName")

          else
          snomeds=observation.queryElement("*tag='text'")
          snomed=snomeds.all[1]
          displayName=alltrim(word(snomed.innerXML,1,"<"))
          parameter="not coded"

          end if
          dateTime=getProperty(observation,"effectiveTime","value")
          if dateTime="" then
          effTimeList=observation.queryElement("*tag='effectiveTime'")
          if effTimeList.all.size()>0 then
          effTime=effTimeList.all[1]
          dateTime=getProperty(effTime,"low","value")
          end if
          end if
          problems=problems+stod(left(dateTime,8))+":"+displayName+":"+parameter+crlf()
          next
          next
          one="";dummy=""
          ui_dlg_box("Problems",<<%dlg%
          {font=Arial,9}
          {units=f}
          Problems in C-CDA:; [.80,5one^#problems];
          Known problems:; [%r%.80,5dummy^#knownProblems];
          <Add problem to our system!add?one\>""> <Continue>;
          %dlg%,<<%code%
          if a_dlg_button="add" then
          a_dlg_button=""
          sql=<<%SQL%
          INSERT INTO problemList (account,dateDiagnosed,description,snomed,status,lastEditedBy)
          VALUES (:account,:dateDiagnosed,:description,:snomed,'Active',:user)
          %SQL%
          args.clear()
          args.set("account",acct)
          args.set("description",word(one,2,":"))
          args.set("snomed",word(one,3,":"))
          args.set("dateDiagnosed",ctod(word(one,1,":")))
          args.set("user",user)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 429 in parseCDA",cnw.callresult.text)
          end
          end if
          sql=<<%sql%
          select description,snomed from problemlist where account=:account AND status='Active'
          %sql%
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 116 in parseCDA",cnw.callresult.text)
          end
          end if
          rs=cnw.resultSet
          dim knownProblems as c=""
          while rs.nextRow()
          knownProblems=knownProblems+rs.data("description")+"("+rs.data("snomed")+")"+crlf()
          end while
          delete rs
          one="";dummy=""
          end if
          %code%)
          end if
          next
          sql=<<%sql%
          INSERT INTO meddocs (account,docType,dateDoc,date_creat,created_By,time_creat,content)
          VALUES (:account,:docType,:dateDoc,curdate(),:user,replace(cast(current_time() as char(8)),':',''),:content)
          %sql%
          args.clear()
          args.set("account",acct)
          args.set("docType","CDA")
          args.set("user",user)
          args.set("dateDoc",documentDate)
          args.set("content",file.to_string(fn))
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 462 in parseCDA",cnw.CallResult.text)
          end
          end if
          meddocsid=cnw.LastInsertedIdentity()
          sql=<<%txt%
          INSERT INTO meddocsidx
          (meddocsid,account, docType, dateDoc, date_creat, created_by, time_creat)
          VALUES
          (:meddocsid,:account,"CDA",:dateDoc,current_date(),:user, replace(cast(current_time() as char(8)),':',''))
          %txt%
          args.set("meddocsid",meddocsid)
          cnw.execute(sql,args)
          ui_msg_box("CDA file saved","to Correspondence")
          end

          function getProperty as c(obj as p,tag as c,attribute as c)
          filter="*tag='"+tag+"'"
          elements=obj.queryElement(filter)
          attribQry=elements.queryAttributes(attribute)
          getProperty=alltrim(attribQry.getValues())
          end function

          function saveMed as v(vars as p)
          with vars
          select
          case route="po"
          route="oral"
          case route="SC"
          route="subcutaneous"
          case route="SL"
          route="sublingual"
          case route="IM"
          route="intramuscular"
          case route="resp."
          route="RESPIRATORY (INHALATION)"
          case route="other"
          route=otherRoute
          end select
          select
          case freq="hs"
          freq="at night"
          case freq="bid"
          freg="twice daily"
          case freq="tid"
          freq="three times each day"
          case freq="qid"
          freq="four times each day"
          case freq="q4h"
          freq="every 4 hours"
          case freq="q6h"
          freq="every 6 hours"
          case freq="q8h"
          freq="every 8 hours"
          case freq="q12h"
          freq="every 12 hours"
          case freq="other"
          freq=otherFreq
          end select
          if prn then
          freq=freq+" as needed"
          end if
          if nbr="other" then
          nbr=otherNbr
          end if
          drug=word(one,1,"(")
          rxcui=word(word(one,2,"("),1,")")
          doseUnit=word(one,2,":")
          sql=<<%txt%
          INSERT INTO medications
          (account,noteID, drug,rxcui,dateBegun,route,frequency,doseUnit,enteredBy,fillInstructions)
          VALUES
          (:account,:noteID,:drug,:rxcui,curdate(),:route,:frequency,:doseUnit,:enteredBy,:fillInstructions)
          %txt%
          dim args as sql::arguments
          args.clear()
          args.set("account",acct)
          args.set("drug",drug)
          args.set("rxcui",rxcui)
          args.set("route",route)
          args.set("doseUnit",nbr)
          args.set("frequency",freq)
          args.set("fillInstructions",fillInstructions)
          args.set("enteredBy",user)
          args.set("noteID",0)
          if .not. cnw.execute(sql,args) then
          ui_msg_box("Error 568 in parseCDA",cnw.callresult.text)
          end
          end if
          prn=.f.
          otherFreq=""
          otherNbr=""
          drug=""
          frequency=""
          nbr=""
          route=""
          otherRoute=""
          rxcui=""
          end with
          end function

          Comment


            #6
            Re: Continuity of Care Document (CCD)

            Wow! Thanks so much for your generosity! You are so so so Kind!
            Creating Healthcare Work-Flow Solutions Since 2005

            Comment

            Working...
            X