HL7 to SQLite with Mirth Connect - sqlite

I'm trying to build a channel to read an HL7 ADT text file, extract an MRN and write output to a SQLite table (Database Writer).
My SQLite table contains my data but all my PatientIDs are appearing as a concatenated string in one very wide column. As opposed to a PatientID per row/record.
I'm noticing some weird illegal(?) characters in my HL7 file (which come from a Meditech EMR). In QuickViewHL7 they appear in the MSH-22 and MSH-30.
In the VIM editor -
My question is, are these supposed to be delimiters? If so, what are they? Carriage Returns?
I've posted this question on the Mirth Connect forums but seen little but tumbleweeds. I'm hoping someone here might have seen this before and tell me what's going on.
UPDATE: Hex dump suggests it's a 0x7f (0111 1111). This looks like a backspace character. Should I simply strip it or substitute it with something?

This illegal character should be a line feed carriage return to delimit the start of the next HL7 segment.
Using VIM, highlight the illegal character and press 'ga'. This will tell you the hex value of the character. In my case 0xfa (which appears to be a back space!?).
Again in Vim, do a global substitute for a \r
:%s/\%x7f/\r/g
Then save the file.
Everything parses out nicely now.

Related

How to remove "/"/"" from data stored in firebase with App Inventor

When adding data with the block call.StorageValue, the string is saved in firebase with "/" before and after the string,
There does not seem to be any block to remove it, How can I do it?
It's a normal firebase function that allows to separate the values and read them as such.
Example :
on Firebase, "\"English-EN\"" is a single value sent from the app as English-EN
and "[\"863674037411046\",\"863674037411046\",\"863674037411046\",\"863674037411046\"]" is a list of numbers sent as 863674037411046.
Try to retrieve the value with a button and to a simple label and you should see that it's displayed without the extra characters.
Source:check my app "harpokrates". I've made it as a firebase DB management demo and it uses nothing else. All values are stored as you describe and are retrieved just fine, without extra symbols or any need to trim the text.
ps:However if you do have extra symbols at some point, check your use of lists and lists of lists that might generate excessive "\" if you made a mistake somewhere. You can also use the "trim" or "split text" blocks but that would be bad practice. Finding the code error is best.
This is likely an escape character that escapes the special character " (quotation marks). This is common practice to use \ as an escape character to indicate that the next character has special meaning, in this case it is not the start or end of a string but actually part of it.
As such you can't actually remove it (just the escape character) and should consider how you got a quotation mark in the string to begin with.
You should however be able to remove the entire quotation mark \"

Some special characters are added in the BizTalk output file

I have put an XML into a receive location using the Microsoft BizTalk default pipeline "XMLReceive" and then use PassThroughTransmit to output the file to a directory.
However, if hex editor to check the output file, I found that there are three special characters  are found at the beginning of the output file.
The ASCII of  is EF BB BF.
Is there any idea why there are 3 control characters are added at the beginning of the output file?
Those characters are the Byte Order Mark which tell the receiving application how to interpret the text stream. They are not junk but are optional.
I recommend you always send the BOM unless the recieving system cannot accept them (which is really their problem ;).
I have googled the solution myself and shared to others.
Removing the BOM from Outgoing BizTalk Files
http://mindovermessaging.com/2013/08/06/removing-the-bom-from-outgoing-biztalk-files/
The three special characters are BOM (Byte Order Mark), set the PreserveBOM to false in sendport XMLTransmit pipeline will remove these three characters.

Visual FoxPro 9.0 report show unicode

I am using Visual Foxpro 9, I want to print Unicode chars in report (frx).
There are some ways to extend report listener to show unicode. I need the code to extend/show reportListner to show unicode.
I've never had to work with Unicode within VFP either, or spent any time working with Reports, but the Help for the Render method of the ReportListener does mention Unicode:
cContentsToBeRendered
Indicates the text to be rendered for Expression (Field) and Label layout elements.
For Picture layout elements sourced from a file, cContentsToBeRendered contains the filename.
When specifying a filename for an image, ReportListener provides cContentsToBeRendered
as a DBCS string, which is the standard format for strings in Visual FoxPro.
However, when indicating text to be rendered, ReportListener provides
cContentsToBeRendered as a Unicode string, appropriately translated to the correct
locale using any regional script information associated with this layout control in
its report definition file (frx) record.
If your derived class sends the text value through some additional processing, such as
storage in a table, you can use the STRCONV() function, and its optional regional
script parameter, to convert the string to DBCS first. For more information, see
STRCONV( ) Function.
Although I could be incorrect, but I believe VFP does NOT support UniCode and only works with the base ASCII character set. But then again, I've never needed to use Unicode either and have used FoxPro since the beginning of its lifetime.
I would imagine Rick Strahl's article Using Unicode in Visual FoxPro
Web and Desktop Applications would be fairly definitive on the topic.

Getting input as hindi character from textbox and storing it to database

I am using asp.net and c# in my application and Mysql as Database.I want to take input from user in hindi and store it in database and retrieve it.
When I am storing the hindi characters in from Mysql database it is working fine for me but when I am using textbox to input a hindi characters it is showing me ?????????.
I guess the problem is the aspx page does not set to support hindi characters.Please tell me the way to achieve this.
I guess using UTF-8 encoding on your Http request and responses would solve it. What is your requestEncoding and responseEncoding in your Web.config file set to currently?
See more on the <globalization> tag here:
http://msdn.microsoft.com/en-us/library/hy4kkhe0(v=VS.100).aspx
try this:-
// mytable=2 fields id(auto increment),title(nvarchar(max))
string title = "बिलाल";
SqlCommand cmd = new SqlCommand("insert into mytable values (N'" + title + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Haha.. Oh the memories (and I only had to deal with spanish which fits into the default latin1).
So I don't know the MS side of the stack, but I assume it's the same types of solutions as Java. Namely you should always assume UTF-8, and thus make your Content-Type HTML responses always show UTF-8 so that browsers know to encode POST data in UTF-8. You should always inspect the encoding type of HTML POST's just in case you have a browser that ignored the encoding of the HTML form (someone might be using curl/wget/custom-browser). You need to learn how in MS-land to convert from one encoding type into UTF-8 (in java, for reference, we just say String s = new String(bytes, encoding_name))
Assuming that MS's stack uses UTF-16 or UCS-32 or whatever so that UTF-8 is easy to extract, next comes the mysql layer.
This includes 2 things..
1) column encoding MUST be set to UTF8.. It's not obvious at all how to do it, and even the spelling is annoying.. Just google it.. "create database foo default character set UTF8" (approximate syntax), or if you're worried for some reason, do it at the table level "create table foo (..) character set UTF8" (approximate syntax).. Or if the table is already there, take EVERY column that can take arbitrary web-form text (possibly including login-name, but not columns like enumerated varchars - as it would waste index space - even though you'd think it wouldn't) "alter table foo change name varchar(255) character set UTF8" (approximate syntax).
2) You MUST make the ODBC connection (jdbc in java, don't know in MS), encode all in/out characters at UTF-8. There are two parameters I set (use-unicode, and character-set=UTF-8) (approximate parameter names).
Google it all, but this should point you in the right direction.
Test the existing DB by connecting to mysql both with character-set=UTF8 and latin1.. You'll see totally different output in your text-data when connected as each encoding. If you're lucky, you already got the data in correctly.. Otherwise you'll have to regenerate ALL the data, or perform some very clever character conversion hacks like I had to do once upon a time (painful stuff).

HTML Entity in CSVs

How do I add an html entity to my CSV?
I have an asp.net, sql server that generates html, excel, and csv files. Some of the data needs to have the ‡ entity in it. How do I get it to output to my CSV correctly? If I have it like this: ‡, then it gets screwed up but if I output it with the entity code, the CSV outputs that text.
Non-printable characters in a field are sometimes escaped using one of several c style character escape sequences, ### and \o### Octal, \x## Hex, \d### Decimal, and \u#### Unicode.
So just escape your non-ascii character C#-style and you'll be fine.
I'm not sure what you mean by "it gets screwed up".
Regardless, it is up to the receiving program or application to properly interpret the characters.
What this means is that if you put ‡ in your csv file then the application that opens the CSV will have to look for those entities and understand what to do with them. For example, the opening application would have to run an html entity decoder in order to properly display it.
If you are looking at the CSV file with notepad (for example) then of course it won't decode the entities because notepad has no clue what html entities are or even what to do when it finds them.
Even Internet Explorer wouldn't convert the entities for display when opening a CSV file. Now if you gave it a .html extension then IE would handle the display of the file with it's html rendering engine.

Resources