GithubHelp home page GithubHelp logo

pyx12's Introduction

Pyx12

Build Status

Pyx12 is a HIPAA X12 document validator and converter. It parses an ANSI X12N data file and validates it against a representation of the Implementation Guidelines for a HIPAA transaction. By default, it creates a 997 response for 4010 and a 999 response for 5010. It can create an html representation of the X12 document or can translate to and from an XML representation of the data file.

Usage

As a command line tool

x12valid <filename>

To fix common X12 structural errors

x12norm --fix --eol <filename>

Code Examples

Iterate over a loop.  Alter children. Show changes
    src = pyx12.x12context.X12ContextReader(param, errh, fd_in)
    for datatree in src.iter_segments('2300'):
        # do something with a 2300 claim loop
        # we have access to the 2300 loop and all its children
        for loop2400 in datatree.select('2400'):
            print(loop2400.get_value('SV101'))
            # update something
            loop2400.set_value('SV102', 'xx')
            # delete something
            if loop2400.exists('PWK'):
                loop2400.delete('PWK')
        # iterate over all the child segments
        for seg_node in datatree.iterate_segments():
            print(seg_node.format())

Prerequisites

Pyx12 uses some runtime features of setuptools / distribute. If you use pip to install, all is good. If not, install setuptools first.

Get setuptools http://pypi.python.org/pypi/setuptools/

Get pip http://www.pip-installer.org/en/latest/installing.html

Install

Install system-wide

pip install pyx12

Or install in a virtual environment

virtualenv my_env
pip -E my_env install pyx12

Licensing

Pyx12 has a BSD license. The full license text is included with the source code for the package.

pyx12's People

Contributors

arenius avatar azoner avatar gumption avatar jdavisp3 avatar lexhung avatar limnick avatar minjitoscar avatar sbuss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyx12's Issues

Can't setup.py install

Since f63a44f setup.py install is broken due to a reference to a non-existent script.

$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 25, in <module>
    join('build/bin', target_script))
  File "/usr/local/Cellar/python/2.7.3/lib/python2.7/distutils/file_util.py", line 109, in copy_file
    "can't copy '%s': doesn't exist or not a regular file" % src)
distutils.errors.DistutilsFileError: can't copy 'bin/x12_build_pkl.py': doesn't exist or not a regular file

Add map file for 5010 279A1

Currently having trouble parsing 270s due to the fact that icvn 00501, fic HS, vriic 005010X279A1 map is missing

834 5010 LS/LE (Loop 2700/2750) Additional Reporting Categories not correct

The 005010X220A1-834 Benefit Enrollment and Maintenance TR3 Errata report published June 2010, specifies corrections to handling of LS/LE Loop envelope for Additional Reporting Categories.

See for reference sample data structure to use to test:
Click Link Here

Changes that needed to be addressed:

  1. LS (Pos 6880) and LE (Pos 6885) are both segments within Loop 2000, not Loop 2700. Only one LS/LE pair allowed for each Loop 2000.
  2. LX (Pos 6881) segment within LS/LE is Loop 2700, not Loop 2710 (which has been eliminated).
  3. Loop 2750 is a child sub-loop of Loop 2700 containing the following segments:
  • N1 (Pos 6882)
  • REF (Pos 6883)
  • DTP (Pos 6884)

Recommended change to V2 map (not tested, still trying to figure out how to have library force use of correct map!!): 834.5010.X220.A1.v2.xml

...
        <!--End of 2300 loop-->
        <!-- Loop 2000, LS/LE Loop Envelope: Additional Reporting Categories-->
        <segment xid="LS" usage="R" pos="6880" max_use="1" name="Additional Reporting Categories">
          <element xid="LS01" data_ele="447" usage="R" seq="01" name="Loop Identifier Code" />
        </segment>
        <!--End of segment LS-->
        <loop xid="2700" pos="6801" usage="R" repeat="&gt;1" name="Member Reporting Categories">
          <segment xid="LX" usage="R" pos="6881" max_use="1" name="Member Reporting Categories">
            <element xid="LX01" data_ele="554" usage="R" seq="01" name="Assigned Number" />
          </segment>
          <!--End of segment LX-->
          <loop xid="2750" pos="6802" usage="R" repeat="1" name="Reporting Category">
            <segment xid="N1" usage="R" pos="6882" max_use="1" name="Reporting Category">
              <syntax>R0203</syntax>
              <syntax>P0304</syntax>
              <element xid="N101" data_ele="98" usage="R" seq="01" name="Entity Identifier Code">
                <valid_codes>
                  <code>75</code>
                </valid_codes>
              </element>
              <element xid="N102" data_ele="93" usage="R" seq="02" name="Member Reporting Category Name" />
              <element xid="N103" data_ele="66" usage="N" seq="03" name="Identification Code Qualifier" />
              <element xid="N104" data_ele="67" usage="N" seq="04" name="Identification Code" />
              <element xid="N105" data_ele="706" usage="N" seq="05" name="Entity Relationship Code" />
              <element xid="N106" data_ele="98" usage="N" seq="06" name="Entity Identifier Code" />
            </segment>
            <!--End of segment N1-->
            <segment xid="REF" usage="S" pos="6883" max_use="1" name="Reporting Category Reference">
              <syntax>R0203</syntax>
              <element xid="REF01" data_ele="128" usage="R" seq="01" name="Reference Identification Qualifier">
                <valid_codes>
                  <code>00</code>
                  <code>17</code>
                  <code>18</code>
                  <code>19</code>
                  <code>26</code>
                  <code>3L</code>
                  <code>6M</code>
                  <code>9V</code>
                  <code>9X</code>
                  <code>GE</code>
                  <code>LU</code>
                  <code>PID</code>
                  <code>XX1</code>
                  <code>XX2</code>
                  <code>YY</code>
                  <code>ZZ</code>
                </valid_codes>
              </element>
              <element xid="REF02" data_ele="127" usage="R" seq="02" name="Member Reporting Category Reference ID" />
              <element xid="REF03" data_ele="352" usage="N" seq="03" name="Description" />
              <composite xid="REF04" data_ele="C040" usage="N" seq="04" name="Reference Identifier" />
            </segment>
            <!--End of segment REF-->
            <segment xid="DTP" usage="S" pos="6884" max_use="1" name="Reporting Category Date">
              <element xid="DTP01" data_ele="374" usage="R" seq="01" name="Date Time Qualifier">
                <valid_codes>
                  <code>007</code>
                </valid_codes>
              </element>
              <element xid="DTP02" data_ele="1250" usage="R" seq="02" name="Date Time Period Format Qualifier">
                <valid_codes>
                  <code>D8</code>
                  <code>RD8</code>
                </valid_codes>
              </element>
              <element xid="DTP03" data_ele="1251" usage="R" seq="03" name="Member Reporting Category Effective Date(s)" />
            </segment>
            <!--End of segment DTP-->
          </loop>
          <!--End of 2750 loop-->
        </loop>
        <!--End of 2700 loop-->
        <segment xid="LE" usage="S" pos="6885" max_use="1" name="Additional Reporting Categories Loop Termination">
          <element xid="LE01" data_ele="447" usage="R" seq="01" name="Loop Identifier Code" />
        </segment>
        <!--End of segment LE-->
      </loop>
      <!--End of 2000 loop-->
...

834 5010 LX sequence # collisions?

@azoner Hi John - it has been a while - but I am encountering an issue with a new submitter that technically falls into "standards" (834 005010X220A1). I am opening a new issue at this point (related to #42. It is definitely related however to Loop 2700 or LX segment valiation logic.

It seems there is an issue where if LX01 values outside of a LS2700/LE2700 (Loop 2700 wrapper) are the same as LX01 values inside the LS2700/LE2700 (Loop 2700 wrapper) - that we get an issue:
"Segment LS*2700 not found. Started at /ISA_LOOP/GS_LOOP/ST_LOOP/DETAIL///<Loop != 2700>"

See pastebin link for an example file that should be considered valid for 834 005010X220A1 processing.

What should happen is the LX segments where the LX01 value matches an LX01 value in the LS/LE Loop 2700 envelope - should not be colliding. It looks like they are in somehow.

Another possibility - if collision of LX01 values is not the issue - is that the LX01 values are being expected to be 100% sequential and contiguous within the LS/LE Loop 2700, but all that is required is that they be unique and sequential - but not necessarily contiguous.

So basically:

Allow collisions of LX01 values between a unique LX segment outside of Loop 2700 and a unique LX segment inside Loop 2700.
Within Loop 2700 - enforce unique and in sequence but can skip (i.e. 1,2,26,30) - but do not enforce a need for contiguous (i.e. 1,2,3,4.. etc).

999 output

Default validation output form should be a 999, not 997

Tabs not being treated as invalid

I ran across an issue where there was a tab at the end of an NMToken but it was still passing validation

The quick fix is to change the following line error on any whitespace, including tabs

if data_type in ['AN', 'ID'] and elem_val[-1] == ' ':

However, from my reading, tabs are not valid characters except in terminal control set values) and needs to fail validation whether at the end or the beginning or the middle of the string.

References found:
http://www.wpc-edi.com/reference/repository/005050cc.pdf (section B.1.1.2.2 and B.1.1.2.3 ; Terminal Control Set - B.1.1.2.4.1)
https://docs.microsoft.com/en-us/biztalk/core/edi-character-sets - The Basic character set includes the following uppercase letters, digits, space, and special characters: A through Z, 0 through 9, ! โ€œ & โ€™ ( ) * + , - . / : ; ? = (space). ;
The Extended character set includes the characters in the Basic character set, and lowercase letters, select language characters, and other special characters: a through z, % @ [ ] _ { } \ | < > ~ # $.

Is this production ready?

While the question is general, I will also be interested in specifics for ANSI 270/271 5010 that need to be considered before using this in production.

Error parsing 277 file

I'm trying to parse a 277 file via the command line tool first. It looks like i need to specify a map path but I'm doing something wrong. I get a type error, which I'm guessing it's because i'm on the latest python 3.8.2

ERROR Line:16 SEG:3 - Mandatory loop "Provider of Service Information Trace Identifier" (2200C) missing
2020-08-12 08:34:28,998 ERROR Failed to create 999 response
Traceback (most recent call last):
  File "/home/eddyizm/Documents/py_edi_import/env/lib/python3.8/site-packages/pyx12/x12n_document.py", line 252, in x12n_document
    errh.accept(visit_999)
  File "/home/eddyizm/Documents/py_edi_import/env/lib/python3.8/site-packages/pyx12/error_handler.py", line 101, in accept
    visitor.visit_root_pre(self)
  File "/home/eddyizm/Documents/py_edi_import/env/lib/python3.8/site-packages/pyx12/error_999.py", line 83, in visit_root_pre
    self.wr.Write(isa_seg)
  File "/home/eddyizm/Documents/py_edi_import/env/lib/python3.8/site-packages/pyx12/x12file.py", line 495, in Write
    self._write_isa_segment(seg_data)
  File "/home/eddyizm/Documents/py_edi_import/env/lib/python3.8/site-packages/pyx12/x12file.py", line 582, in _write_isa_segment
    self.fd_out.write(out)
TypeError: a bytes-like object is required, not 'str'
env/193592.20200803220823730_Sample.CLI.277.edi: Failure```

pyx12 usage issue

I am trying to use the pyx12 module in parsing some 837I/P files. I can import the module but none of the functions are there and can not be used. Here is the error:

import pyx12
pyx12.x12context
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'pyx12' has no attribute 'x12context'
I am not sure what is going on. I used pip to install pyx12 so everything was installed correctly.

Invalid PRV02 code in 2310B

There is a PVR02 element error in map 837.5010.X222.A1.xml. If the 2310B loop is parented to a 2000B loop then the valid code for the PVR02 element is correct - 'PXC' - line 5166. But, if the 2310B is parented to a 2000C loop, then the PVR02 element has a valid code listed as 'ZZ' at line 15719. That is the old code from 4010A1. It should also be 'PXC'.

Thanks and sorry to be a pest.

Cannot distinguish repeated SEGMENT outside LS loop

We are not able to construct a map that pyX12 can recognize where there is a repeated segment inside an LS loop and the optional segment is absent.

For example, consider:

LoopID 300 -->
LX
MAN

LoopID 310 -->
W01
G69
LS
LoopID 330 -->
LX
etc.
LoopID 330 <--
LE
LoopID 310 <--
LoopID 300 <--

In our sample data, we have multiple LX's that are attached to the 300 loop and no LX's for the 330 loop. The parser thinks the second LX belongs to the 330 loop. We have not been able to construct a map that forces the parser to pop up the tree when it recognizes a missing LS. Trying to make it required fails.

Set up issue

First: I'm a newbie and there is probably something very basic I'm doing wrong here so apologies in advance for my ignorance. Also, thank you John and everyone else who has contributed to this project.

I am trying to set up pyx12 on ubuntu and I am having trouble distinguishing what information from the previous documentation at http://pyx12.sourceforge.net/doc/ is still relevant to the what seems to be the latest version.

For instance when I run x12info on my test835.txt file it correctly identifies it as:

Source filename: test835.txt
ISA Sender: "SENDER " ISA Receiver: "RECEIVER " PRODUCTION
GS Sender: "SENDER" GS Receiver: "RECEIVER" GS Type: "004010X091A1"
ST ID: "1234" ST Type: "835"

However, when I attempt to generate an xml file using:

x12xml test835.txt

the process fails and throws an error:

Map not found. icvn=00401, fic=HC, vriic=004010X091A1

Even when I do what I believe to be the correct syntax:

x12xml --config-file=path/to/835.4010.X091.A1.xml test835.txt

It says:

Map not found. icvn=00401, fic=HC, vriic=004010X091A1

when in reality it exists. It seems like before you would use -m plus the path to the map directory, but is that still the case? Do you have any idea what I'm doing wrong?

One additional thing that may be helpful: it seems like when I use pip to install the pyx12 it's not creating the test file directory, but again, I am not sure whether or not this was just phased out in the most recent release.

Any help would be greatly appreciated!

Missing PER Segment

One of the PER Segments (Service Facility Contact Information) is missing in the 837.5010.X222.A1.xml map. In the 2310C loop that is parented to a 2000C the segment exists (line 15930), but if a 2000C is not needed (patient is the subscriber) then the PER segment is missing (line 5456). It could just be duplicated into that location.

I realize that most payors don't use that segment.

Help - Parse data in multiple files (not really an issue, a question)

Hello, Pardon my lack of python knowledge.
We are looking to use this to generate ANSI 834 files.
Our files primarily have Loops 2000 and 2300 (apart from other loops, required header and trailer records).
We have data that will go in each of the loops in separate files.

Where do i start to generate a ANSi834 file where data is stored in multiple files.

Thank You.
Arjun

Remove ISA/GS loops from maps

ISA, GS and TA1 definitions do not belong in each map xml. Convert to common 4010 and 5010 header xml definitions.

Regexes in Validation are wrong.

rec_N = re.compile("^-?[0-9]+", re.S) rec_R = re.compile("^-?[0-9]*(\.[0-9]+)?", re.S) rec_ID_E = re.compile( "[^A-Z0-9!\"&'()*+,\-\./:;?=\sa-z%~@\[\]_{}\\\|<>#$\s]", re.S) rec_ID_E5 = re.compile( "[^A-Z0-9!\"&'()*+,\-\./:;?=\sa-z%~@\[\]_{}\\\|<>^#$\s]", re.S)
rec_ID_B = re.compile("[^A-Z0-9!\"&'()*+,-./:;?=\s]", re.S)
rec_DT = re.compile("^[0-9]+", re.S)
rec_TM = re.compile("^[0-9]+", re.S)`

[^0-9]+ means not in the set 0-9. The same issue occurs in ID_E, ID_E5, and ID_B. It should really be:

rec_N = re.compile("^-?[0-9]+", re.S) rec_R = re.compile("^-?[0-9]*(\.[0-9]+)?", re.S) rec_ID_E = re.compile( "^[A-Z0-9!\"&'()*+,\-\./:;?=\sa-z%~@\[\]_{}\\\|<>#$\s]", re.S) rec_ID_E5 = re.compile( "6[A-Z0-9!\"&'()*+,\-\./:;?=\sa-z%~@\[\]_{}\\\|<>^#$\s]", re.S)
rec_ID_B = re.compile("^[A-Z0-9!"&'()*+,-./:;?=\s]", re.S)
rec_DT = re.compile("^[0-9]+", re.S)
rec_TM = re.compile("^[0-9]+", re.S) `

XML map for 837D claim

I'm working on a project where I'd like to parse the X12 837D claim format. I see the pyx12/map/ directory which holds the various specs. Where can I find (or how can I generate) an xml file which'll be able to parse the dental version of the 837 spec to add to that directory?

Feature Request: Remove validation of external defined code sets

Code set values for certain X12 elements were included in the original implementation guide, and also listed an external defining organization. These code sets can and do change out of tempo with the X12 major versions and addendum.

Maintenance of these code sets has been infrequent; which can result in validation issue.

I propose removing the validation of any code set that depends on external definers, where the code is likely to change between major X12 versions. These would include:

adjustment_reason
claim_status
claim_status_cat
country
currency
entity_id
pos
prov_taxonomy
remark_code

These code set identifiers and associate code values are defined in the file codes.xml

Let me know what you think.

ST_LOOP does not work in x12xml

Multiple ST/SE's are not parsed in x12xml.
Got this error while processing EDI 832. Tests using sample 820 and 830 (maps present in pyX12) results in the same.

Some pointers on source of the issue would be helpful. Will certainly contribute back on fix.

It is parsed as -
<loop id='GS_LOOP'> <seg id='GS'> <ele id='GS01'>XX</ele> <ele id='GS02'>XXXXXXXXXX</ele> <ele id='GS03'>XXXXXXXXX</ele> <ele id='GS04'>20121228</ele> <ele id='GS05'>XXXX</ele> <ele id='GS06'>XXXX</ele> <ele id='GS07'>X</ele> <ele id='GS08'>004010</ele> </seg> <seg id='GS'> - This is actually ST data which should be inside ST_LOOP <ele id='GS01'>820</ele> - (832/830) <ele id='GS02'>XXXXXXX</ele> </seg> <loop id='ST_LOOP'>....

CTP Error

There is a CTP error in map 837.5010.X222.A1.xml. If CTP05-01 is in the sequence 2000B-2300-2400-2410 then all of the codes are valid (F2, GR, ME, ML, UN). Element starts on line 9966. But, if the sequence is 2000C-2300-2400 then the valid codes are missing the ME code ((F2, GR, ML, UN). Element starts on line 20730

Also the same sequences have an error with CTP03. Line 9952 lists CTP03 usage as 'N' and line 20713 lists it as 'R'. Under loop path: 2000B-2300-2400-2410 and 2000C-2300-2400-2410 it only states that if CTP11 is present, then CTP03 is required.

Still being a pest. Thanks.

Is this project alive or dead?

Hi, thanks for the library. Is this project dead? I see a PR merged for py3 support, yet an open issue and no releases for quite a while. Any plan for an update?

Help - Parse EDI file into XML

I have seen this library but not able to locate any example to parse EDI file into XML. Can anyone of you please help.

ST_LOOP does not work in x12xml

Multiple ST/SE's are not parsed in x12xml.
Got this error while processing EDI 832. Tests using sample 820 and 830 (maps present in pyX12) results in the same.

Some pointers on source of the issue would be helpful. Will certainly contribute back on fix.

It is parsed as -

<loop id='GS_LOOP'> <seg id='GS'> <ele id='GS01'>XX</ele> <ele id='GS02'>XXXXXXXXXX</ele> <ele id='GS03'>XXXXXXXXX</ele> <ele id='GS04'>20121228</ele> <ele id='GS05'>XXXX</ele> <ele id='GS06'>XXXX</ele> <ele id='GS07'>X</ele> <ele id='GS08'>004010</ele> </seg> <seg id='GS'> - This is actually ST data which should be inside ST_LOOP <ele id='GS01'>820</ele> - (832/830) <ele id='GS02'>XXXXXXX</ele> </seg> <loop id='ST_LOOP'>....

Trying to Contact John

Hi John: I am a Python developer working in health IT supporting the federal government. I am writing an article about X12 and would really like to chat with you by phone for a few minutes. Would you be up for a short call?

  • Alan

aviars at videntity dot com

p.s. I couldn't find your email or a LinkedIn profile. So that is why I contacted you via an issue request.

x12xml crashing in dataele.py

Running Anaconda on Windows, Python 3.6.4. Current master branch. Parsing an 837 file using map '837Q3.I.5010.X223.A1.xml', explicit path to map directory (base_path).

During x12xml, I get the below error associated with the following line in dataele.py:
Line 52 : for eElem in et.parse(fd).iter('data_ele'):

It looks like ElementTree is okay either taking the raw path string (os.path.join...) or a file descriptor with the 'rb' mode. 'r' mode gives the same error. To minimize side effects I changed line 48 to :

fd = open(os.path.join(base_path, dataele_file),'rb')

Worked with the next 6 837 files I processed.

I'd submit a pull request, but I'm not certain if this behavior is Windows-only.

Traceback (most recent call last):
File "C:\Users\jtern\Anaconda3\Scripts\x12xml-script.py", line 11, in
load_entry_point('pyx12==2.3.3', 'console_scripts', 'x12xml')()
File "C:\Users\jtern\Anaconda3\lib\site-packages\pyx12-2.3.3-py3.6.egg\pyx12\scripts\x12xml.py", line 120, in main
fd_997=None, fd_html=None, fd_xmldoc=fd_xml, map_path=args.map_path)
File "C:\Users\jtern\Anaconda3\lib\site-packages\pyx12-2.3.3-py3.6.egg\pyx12\x12n_document.py", line 78, in x12n_document
control_map = pyx12.map_if.load_map_file(map_file, param, map_path)
File "C:\Users\jtern\Anaconda3\lib\site-packages\pyx12-2.3.3-py3.6.egg\pyx12\map_if.py", line 1543, in load_map_file
imap = map_if(etree.getroot(), param, map_path)
File "C:\Users\jtern\Anaconda3\lib\site-packages\pyx12-2.3.3-py3.6.egg\pyx12\map_if.py", line 199, in init
self.data_elements = dataele.DataElements(base_path)
File "C:\Users\jtern\Anaconda3\lib\site-packages\pyx12-2.3.3-py3.6.egg\pyx12\dataele.py", line 52, in init
for eElem in et.parse(fd).iter('data_ele'):
File "C:\Users\jtern\Anaconda3\lib\xml\etree\ElementTree.py", line 1196, in parse
tree.parse(source, parser)
File "C:\Users\jtern\Anaconda3\lib\xml\etree\ElementTree.py", line 597, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 1

Error when parsing a 271 file

$ x12valid 271Sample.txt
Traceback (most recent call last):
File "/usr/local/bin/x12valid", line 10, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/pyx12/scripts/x12valid.py", line 155, in main
fd_997=fd_997, fd_html=fd_html, fd_xmldoc=None, map_path=args.map_path):
File "/usr/local/lib/python2.7/dist-packages/pyx12/x12n_document.py", line 147, in x12n_document
raise pyx12.errors.EngineError(err_str)
pyx12.errors.EngineError: Map not found. icvn=00501, fic=HB, vriic=005010X279A1
$

271Sample.txt

835 - missing Adjustment Reason Code

Ele 7 - (272) is not a valid code for Adjustment Reason Code (CAS02)

Is there a way to add current codes -- OR -- just warn during validation

You do not happen to have an example of the looping over 835's? I guess I could read the XML and come up with the structure. Thanks

ERROR Failed to create 999 response- X12 file validation

I have got an issue while validating an X12 EDI file through command line.
TypeError: a bytes-like object is required, not 'str'.
Also help me to do this validation through python console.

The command I'm using is: x12valid <path> --verbose

x12valid throwing TypeError: 'NoneType' object is not iterable

I've encountered the following error when a segment has an element defined as required and that element has subelements defined. When the entire element is missing (e.g. I receive a segment in an X221 file like PLB*123*20211108~ where element 3 is required and has sub-elements), then I receive the following error:

Traceback (most recent call last):
  File ".local/bin/x12valid", line 8, in <module>
    sys.exit(main())
  File ".local/lib/python3.6/site-packages/pyx12/scripts/x12valid.py", line 158, in main
    fd_997=fd_997, fd_html=fd_html, fd_xmldoc=None, map_path=args.map_path):
  File ".local/lib/python3.6/site-packages/pyx12/x12n_document.py", line 199, in x12n_document
    valid &= node.is_valid(seg, errh)
  File ".local/lib/python3.6/site-packages/pyx12/map_if.py", line 1013, in is_valid
    valid &= child_node.is_valid(None, errh)
  File ".local/lib/python3.6/site-packages/pyx12/map_if.py", line 1481, in is_valid
    for sub_ele in comp_data:
TypeError: 'NoneType' object is not iterable

To fix it, I wrapped a test above the for loop at line 1481 so that if comp_data is empty, it will skip the for-loop and continue to if not good_flag check.

setting custom param - map_path does not work

If one has customized set of maps at a different place than pyX12's 'map' folder, configuring param's map_path does not result in anything.

pyx12.param.param('CUSTOM/PATH') though changes the param['map_path'] value, the files are still fetched from 'map' folder and 'CUSTOM/PATH' is ignored.

Python3 support?

I tried using this module with Python3. Are there any plans to make it compatible with Python3?

can it convert to a tabular data format excel or tab delimited file ?

I tried my best before posting here, apologies if its redundant.

I am looking to see if i pass a file that is in ANSI5010 format like the one in your examples folder for ANSI5010, can it read and convert the data to a tabular format... like a column for each value from INS to the last loop 2300/2400 as the case maybe and report a person's data from multiple rows onto 1 row in the tabular format?

For Example -
INSY18030XNAC FT~
REF0F00389999~
REF1L000003409999~
REF3HK129999A~
DTP356D820150301~
NM1
IL1DOEJOHNA
34999999999~
N3
777 ELM ST~
N4ALLEGANMI*49010
CY03~
DMG
D819670330M
O~
LUI
ESSPANISH~

should become something like below...
INS01 INS02 INS03..........REF01 REF02....
Y 18 030 ........... 0F 000389999....

Add map file for 5010 277

I'm interesting in adding support for 5010 277 files -- what's involved in developing a new map file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.