Anyone translate a X12 271 Healthcare response [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I'm looking for C# code that translates a 271 health care eligibility benefit response to a more usable format so I can display certain segments and values into a datagridview. I'm looking for code that I can use to break this thing apart as it's not really difficult, just very tedious and was wondering if anybody else has done this and is willing to share.
Thanks!!

There is an open source X12 parser (OopFactory X12 Parser: https://x12parser.codeplex.com) that does this for you.
To convert any X12 document to Xml:
FileStream fstream = new FileStream("Sample1.txt", FileMode.Open, FileAccess.Read);
var parser = new X12Parser();
Interchange interchange = parser.Parse(fstream);
string xml = interchange.Serialize();
To convert any X12 document to Html:
var htmlService = new X12HtmlTransformationService(new X12EdiParsingService(suppressComments: false));
Stream ediFile = new FileStream("Sample.txt", FileMode.Open, FileAccess.Read);
string html = htmlService.Transform(new StreamReader(ediFile).ReadToEnd());
More details here: https://x12parser.codeplex.com/wikipage?title=Parsing%20an%20837%20Transaction&referringTitle=Documentation
To load an X12 271 response into a .Net object, you can use:
FileStream fstream = new FileStream("Sample1.txt", FileMode.Open, FileAccess.Read);
var service = new EligibilityTransformationService();
EligibilityBenefitDocument eligibilityBenefitDocument = service.Transform271ToBenefitResponse(fstream);

DataDirect Technologies sells a converter that will translate it into XML.

I recommend perl or python for protoyping. once you have behavior you want, you can:
compile the whole thing
have a programmer write C(whatever flavor you need) for the parts that are too slow.
use the prototype as the spec for development in whatever language you need.

Related

OCR : C#/.net for Extract URL from Image [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 months ago.
Improve this question
Can any one help me to extract only URL from image when doing images processing OCR.
I checked, all OCR dll are in paid version. Is there any free libraries.
I used IronOCR and problem solve. I created GetText Function which fetch URL from text when image converted to text.
IronTesseract IronOcr = new IronTesseract();
var Result = IronOcr.Read(Path.GetTempPath() + "image.png");
string _url = GetText(Result.Text);
private string GetText(string myString)
{
Match url = Regex.Match(myString, #"[-a-zA-Z0-9#:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()#%_\+.~#?&//=]*)");
return url.ToString();
}

Compose multiple stream [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need your help to understand which is the best way to compose multiple Stream objects in C#. Please think about the following scenario: I have a file on disk (no matter the file type; think about it as a byte array). I want to read this file, compress it, encrypt it and then write it to another file or send it on the network.
My question is: what's the best way to accomplish this without reading the file, compress and write it in a temp file, then read the temp file, encrypt it, and write to the destination file?
Edit
#itsme86: using a byte array is not a good idea for my purpose as the file could have a big size and generate memory problems.
#Xerillio: naturally I already tried to use temp file, but it's not a good solution: longer processing times and a large amount of disk space.
#Stewart Ritchie: yes, this is the idea, but I don't want to have memory problems, so I'd like to compose the streams and write the result directly on the final "support".
Thank you,
Attilio
If you want to compress a stream, use something like GZipStream.
https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.gzipstream?view=netcore-3.1
using (FileStream originalFileStream = fileToCompress.OpenRead())
using (FileStream compressedFileStream = File.Create(fileToCompress.FullName + ".gz"))
using (GZipStream compressionStream = new GZipStream(compressedFileStream, CompressionMode.Compress))
{
originalFileStream.CopyTo(compressionStream);
}

save a JPEG in progressive format [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
A similar question has already been asked on this thread:
Save JPG in progressive format
However, the answer marked is basically saying that it can't be done. However, considering it is done using other software, it definitely is something which C# can do.
Is there any way this can be done?
Magick.NET can do it with a code like this
using (MagickImage image = new MagickImage("input.png"))
{
// Set the format and write to a stream so ImageMagick won't detect the file type.
image.Format = MagickFormat.Pjpeg;
using (FileStream fs = new FileStream("output.jpg", FileMode.Create))
{
image.Write(fs);
}
// Write to .jpg file
image.Write("PJEG:output.jpg");
// Or to a .pjpeg file
image.Write("output.pjpg");
}
You can find more details here.

Reading 2D Barcode from Images [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I need a library to read 2D barcode (datamatrix) from images on C# project (windows Forms).
I tried using some SDKs, but the SDKs I tried are not free.
Is there any free SDK for reading 2d Barcode from images?
There's an example available:
using DataMatrix.net; // Add ref to DataMatrix.net.dll
using System.Drawing; // Add ref to System.Drawing.
[...]
// ---------------------------------------------------------------
// Date 180310
// Purpose Get text from a DataMatrix image.
// Entry sFileName - Name of the barcode file (PNG, + path).
// Return The text.
// Comments See source, project DataMatrixTest, Program.cs.
// ---------------------------------------------------------------
private string DecodeText(string sFileName)
{
DmtxImageDecoder decoder = new DmtxImageDecoder();
System.Drawing.Bitmap oBitmap = new System.Drawing.Bitmap(sFileName);
List<string> oList = decoder.DecodeImage(oBitmap);
StringBuilder sb = new StringBuilder();
sb.Length = 0;
foreach (string s in oList)
{
sb.Append(s);
}
return sb.ToString();
}
You'll need DataMatrix.net!
Best free Datamatrix coder\decoder that i've used is libdmtx: http://www.libdmtx.org/ . It has c# wrapper, so feel free to use it. I can't write sample code right now, but if you won't be able to handle it yourself, i'll help you a bit later with that.
EDIT:
libdmtx comes with console utils - if you will be able to read your barcodes with console app, you surely will read it using code.
EDIT2:
Here's code samples: http://libdmtx.wikidot.com/libdmtx-net-wrapper
I wonder if you have pictures containing some other info, except the barcode. The thing is - i don't know any free\open source lib to handle finding barcode on a picture, containing any other data properly.
And here's the link to other datamatrix implementations: http://www.libdmtx.org/resources.php

PDF Generation using C#.NET [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am trying to create a PDF generator using C#.NET but having some major difficulties. I have an xml files with the data and an xslt file for the template of the pdf. I tried many different libraries out there but can't seem to get this working properly. Can anyone suggest an example I can use that shows how to do this.
Any help would be much appreciated. Thanks
I found a solution using the excellent TransformXMLToHTML method by Marc Gravell to transform XML + XSLT to HTML.
The HTML can then be transformed to PDF.
This approach may have been slower than editing a PDF as binary. But it was stable and gave me full control over content quality.
Step 1 - transform XML + XSLT to HTML
I needed to add Nugets including:
https://www.nuget.org/packages/System.Xml.ReaderWriter/
using System.Xml;
using System.Xml.Xls;
using System.IO;
public static string TransformXMLToHTML(string inputXml, string xsltString)
{
XslCompiledTransform transform = new XslCompiledTransform();
using(XmlReader reader = XmlReader.Create(new StringReader(xsltString))) {
transform.Load(reader);
}
StringWriter results = new StringWriter();
using(XmlReader reader = XmlReader.Create(new StringReader(inputXml))) {
transform.Transform(reader, null, results);
}
return results.ToString();
}
Step 2 - Transform HTML to PDF
I tried:
https://github.com/rdvojmoc/DinkToPdf
IronPdf which was non free to deploy but the free trial was quite successful (https://ironpdf.com/examples/using-html-to-create-a-pdf/)
https://github.com/ArthurHub/HTML-Renderer
All worked and had their weaknesses and strengths.
[Lets not get into a debate about the best C# HTML to PDF converter.]

Categories

Resources