Comments (3)
Should be trivial to remove the vertical tab characters from the file before you parse them. I assume something like:
(Get-Content -Path c:\temp\test.hl7).Replace("`v","") | Out-File -Path C:\temp\test.hl7
Or even better, find out why the vertical tab is added to the file in the first place and fix the root issue. The vertical tab is part of the MLLP frame, but any MLLP framing is typically removed before saving the message to a file.
from hl7-powershell-module.
Rob,
Thanks for the quick answer. Unfortunately, the files come from the vendor with the `v on them, and removing it from all the files before processing is doable, but isn't the best solution. I need to get a few dozen values out of each file and then write them to a database, so opening each HL7 message a few dozen times (some of which are several MB) multiplied by about 20 million would be pretty inefficient.
Ideally, if your cmdlet would have a -text option that would allow it to read the text from a variable already in memory (which is where I would strip the `v), the file access would only have to happen once for each message, saving tons of I/O.
from hl7-powershell-module.
You can retrieve more than 1 value from a single query, this would remove the need to open each file multiple times. e.g.
> Select-HL7Item -ItemPosition MSH-9.2, PID-3[1].1, PID-5, PID-7, PV1-2 -Path .\test.hl7
MSH-9.2 : A01
PID-3[1].1 : 10006579
PID-5 : DUCK^DONALD^D
PID-7 : 19241010
PV1-2 : I
Filename : C:\scratch\test.hl7
If you need to do further processing via a script, save the result object to a variable and access the values via the variable's properties. e.g.
> $results = Select-HL7Item -ItemPosition MSH-9.2, PID-3[1].1, PID-5, PID-7, PV1-2 -Path .\test.hl7
> $results.'MSH-9.2'
A01
> $results.'PID-5'
DUCK^DONALD^D
Reading the message contents from a file into a variable, then passing this in as a parameter will still require just as many file reads as the example above.
from hl7-powershell-module.
Related Issues (10)
- Missing DLL file HOT 1
- Remove-HL7Identifiers in Core 7 not working HOT 7
- Consider publishing on PSGallery HOT 5
- Why this filter does not work ? HOT 2
- Consider the ability to include a list of parameters for Select-HL7Item -ItemPosition HOT 3
- Manage several occurrences of the same segment HOT 3
- Filter returns more matches than expected HOT 10
- Non PowerShell Users Question HOT 2
- Receive-HL7Message -NOACK HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hl7-powershell-module.