Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter Value #5

Open
rG2ee opened this issue Nov 28, 2021 · 3 comments
Open

Filter Value #5

rG2ee opened this issue Nov 28, 2021 · 3 comments

Comments

@rG2ee
Copy link

rG2ee commented Nov 28, 2021

Hello,
this is more like a question rather than an issue. I tried

SGTIN(company_prefix="0614141", indicator="8", item_ref="12345", serial_number="12345").encode(SGTIN.BinarySchemes.SGTIN_96, SGTIN.FilterValues.CASE)
>> '3054257BF7194E4000003039'


SGTIN(company_prefix="0614141", indicator="8", item_ref="12345", serial_number="12345").encode(SGTIN.BinarySchemes.SGTIN_96, SGTIN.FilterValues.RESERVED_2)
>> '30B4257BF7194E4000003039'

So the third bit is reserved for filtering. Is there a way to access the filter from an encoded epc like this:

SGTIN.decode('30B4257BF7194E4000003039').filter_value

Every other attribute is stored on the instance but I haven't found the filter.

Thanks in advance!

@legomatrix
Copy link

Maybe this helps:
GS1 Tag Data Standard
Line 2363 starts a whole chapter on filter values.

Maybe you can deduct filter values form binary values.

GS1_EPC_TDS_i1_13.pdf

@rG2ee
Copy link
Author

rG2ee commented Dec 28, 2021

You already provide the filter value in one of your functions.

In pyepc/epc.py:
Patching SGTIN 96-bit (line 554-560) and SGTIN 198-bit (line 583-589):

return cls( 
    company_prefix,  
    indicator,
    item_ref,
    utils.decode_integer(serial),
    default_filter_value=str(int(filter_value, 2)) 
)

These two additional lines fix the issue. The question is if it breakes other things. (in this case one may use a different variable than default_filter_value).

If it's ok for you, I would create a PR and write some tests.

@sharoonthomas
Copy link
Contributor

I think it's ok to set the default_filter_value with the filter_value that was decoded from an SGTIN.

Do you want to send a pull request for this? If yes, please include a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants