MyNixOS website logo
Description

ISO11784 PIT Tag ID Format Converters.

Some tools to assist with converting International Organization for Standardization (ISO) standard 11784 (ISO11784) animal ID codes between 4 recognised formats commonly displayed on Passive Integrated Transponder (PIT) tag readers. The most common formats are 15 digit decimal, e.g., 999123456789012, and 13 character hexadecimal 'dot' format, e.g., 3E7.1CBE991A14. These are referred to in this package as isodecimal and isodothex. The other two formats are the raw hexadecimal representation of the ISO11784 binary structure (see <https://en.wikipedia.org/wiki/ISO_11784_and_ISO_11785>). There are two 'flavours' of this format, a left and a right variation. Which flavour a reader happens to output depends on if the developers decided to reverse the binary number or not before converting to hexadecimal, a decision based on the fact that the PIT tags will transmit their binary code Least Significant Bit (LSB) first, or backwards basically.

ISO11784Tools

Installation

remotes::install_github("graemediack/ISO11784Tools",build_vignettes = TRUE)

vignette("ISO11784Tools")

Introduction

ISO11784 and ISO11785 are standards describing how information should be encoded within passive integrated transponder tags (PIT tags).

ISO11784 describes the binary construction of the information stored in the tag, and ISO11785 describes how it should be read by PIT tag readers.

Despite this, there are some differences in how readers will display the id information depending on user settings and manufacturer choices.

Further Reading

ISO11784 In Practice

I encountered 4 different formats of ISO11784 ID codes whilst researching for a PIT tag database. This package is intended to facilitate transformation to and from all of these formats.

It could potentially have other functionality with respect to ISO11784, for example it could connect to ICAR and identify manufacturer of tags along with other metadata.

The 4 formats identified are:

  • Dot Hexadecimal - e.g. 3E7.1CBE991A14. Manufacturer Code = 3E7 (Note - this is ID is reserved for testing), Animal ID = 1CBE991A14
  • Full Decimal - e.g. 999123456789012. Manufacturer Code = 999 (Note - this is ID is reserved for testing), Animal ID = 123456789012
  • Full 64 bit Hexadecimal in two 'flavours' that depend on whether the device reverses the transmitted binary ID before converting it to hex or not:
    • Left Hand Flavour - e.g. 8000F9DCBE991A14.
    • Right Hand Flavour - e.g. 2858997D3B9F0001.

Note, all 4 examples above are the same code.

Functions

I have created a set of functions to make converting between these formats easy.

get_iso11784_format

pass a vector of strings containing your tag codes into this function to obtain a vector of the formats

ISO11784Tools::get_iso11784_format(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))

convert_to_X Family

The convert_to_X family of functions takes a vector of strings with your tag codes and converts them into the target format

ISO11784Tools::convert_to_isodecimal(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))
ISO11784Tools::convert_to_isodothex(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))
ISO11784Tools::convert_to_iso64bitl(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))
ISO11784Tools::convert_to_iso64bitr(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))

convert_to_all

ISO11784Tools::convert_to_all(c('3E7.1CBE991A14','999123456789012','8000F9DCBE991A14','2858997D3B9F0001','blahblah'))

convert_to_all takes a vector of strings and returns a 6 column tibble with detected format and all the possible conversions. It simply wraps the previous 5 functions into one and outputs as a tibble to save some time for the user

to Family

The convert_to_X family of functions are wrappers for lower level functions that convert to and from the Full Decimal format. The Full Decimal format and the Dot Hexadecimal format were the first I encountered, and seem to be the most prevalent. I chose Full Decimal as the primary format for this package, and created functions to convert from and to that format in the early stages of development. Hence, these functions center on Full Decimal.

Rather than give full examples of these I will simply list them here for reference. Each of these functions will accept a single string or a vector of strings and will return warning and NA if the format is not as expected, but will still convert anything within a vector that is the correct format.

  • From Full Decimal:

    • isodecimal_to_iso64bitleft
    • isodecimal_to_iso64bitright
    • isodecimal_to_isodothex
  • To Full Decimal:

    • iso64bitleft_to_isodecimal
    • iso64bitright_to_isodecimal
    • isodothex_to_isodecimal

Lowest Level Family

The above functions are built on base converters that are included as imported functions for convenience rather than intended for direct use.

These functions are written to allow conversion between the three bases; binary, decimal, and hexadecimal, to the maximum limit of the R numeric data type; 0b1000000000000000000000000000000000000000000000000000000, 18014398509481984, and 0x40000000000000 respectively.

R has limitations with regard to maximum values held in integer and numeric data types. I don't know why this is so I won't try to expand on the reason here. ISO 11784 ID codes are generally larger than the integer maximum, but smaller than the numeric maximum. Other packages might have quicker versions of these functions that I haven't found (happy to receive suggestions!), so I needed to build them from scratch.

  • binary_to_decimal
  • binary_to_hexadecimal
  • decimal_to_binary
  • decimal_to_hexadecimal
  • hexadecimal_to_binary
  • hexadecimal_to_decimal

The End. Enjoy!

Metadata

Version

1.1.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows