Extracting Explainable Dates From Medical Images By Reverse-Engineering UNIX Timestamps

Lee Harris · 2025

Read Extracting Explainable Dates From Medical Images By Reverse-Engineering UNIX Timestamps by Lee Harris (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-11451.txt.

Introduction

Lee Harris presents a 2025 paper on pulling trustworthy dates out of medical image text. Dates drive major medical decisions, yet extracting them is oddly hard: AI transcribers are opaque, and hand-written pattern rules are explainable but brittle. Harris asks whether precise computer timestamps can be reverse-engineered from known dates to teach a pattern synthesizer.

Publicly available patterns missed many real dates. Hand-built patterns caught most dates but also flagged many date-like non-dates. Patterns learned automatically by synthesis from reverse-engineered timestamps kept the catch rate nearly as high while slashing false alarms. The study argues that learned, deterministic rules offer an explainable middle path between blind trust in AI and fragile hand coding.

Catalog record

CREATORLee Harris
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE30 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2505-11451

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Extracting Explainable Dates From Medical Images By Reverse-Engineering UNIX Timestamps Lee Harris Abstract Dates often contribute towards highly impactful medical decisions, but it is rarely clear how to extract this data. AI has only just begun to be used transcribe such documents, and common methods are either to trust that the output produced by a complex AI model, or to parse the text using regular expressions. Recent work has established that regular expressions are an explainable form of logic, but it is difficult to decompose these into the component parts that are required to construct precise UNIX timestamps. First, we test publicly-available regular expressions, and we found that these were unable to capture a significant number of our dates. Next, we manually created easily-decomposable regular expressions, and we found that these were able to detect the majority of real dates, but also a lot of sequences of text that looked like dates. Finally, we used regular expression synthesis to automatically identify regular expressions from the reverse-engineered UNIX timestamps that we created. We find that regular expressions created by regular expression synthesis detect far fewer sequences of text that look like dates than those that were manually created, at the cost of a slight increase to the number of missed dates. Overall, our results show that regular expressions can be created through regular expression synthesis to identify complex dates and date ranges in text transcriptions. To our knowledge, our proposed way of learning deterministic logic by reverse-engineering several many-one mappings and feeding these into a regular expression synthesiser is a new approach. I Introduction A very typical way to extract data from medical records (which continue to primarily be stored as paper documents) is to use human labour to manually transcribe these into digital representations, and to identify key points of interest (such as dates, names, medications, outcomes, etc.) at the same time. However, this is a costly and error-prone process, and identifying employees who can (and will) undertake this mundane work may be difficult [ 1 ] . This may also need to be repeated if the required data to extract were to change. It is for these reasons that being able to automatically transcribe and capture data would be very beneficial. Dates are one type of data that is incredibly useful to obtain. [ 2 ] and [ 3 ] achieved this by using modern computer vision. However, as we highlight in Sec. III , it is not be possible to identify the precise days, months, or years for complex dates or date ranges in this way due to the huge (potentially infinite) number of possible variations. Furthermore, it is rarely possible to explain (Sec. II-C ) how these models reach their decisions, and this is an especially important consideration in high-stake situations (such as when handling medical data). Information concluded from high-stake data is often highly impactful, and incorrect results are often intensely scrutinised. The inability to explain how a decision were reached is one of the reasons why many governments require medical data to be processed by humans rather than AI [ 4 ] . One way to achieve explainability is to use deterministic predicate rules of the form “if [ \dots ] then [ \ldots ]”. Other researchers and software packages, such as [ 5 ] and 1 1 1 https://github.com/akoumjian/datefinder , achieve this by identifying date-like sequence of text using regular expressions (Sec. II-D ). These are fast, but their use is often programming-language dependant. Additionally, dayless or multi-line dates, and words (e.g., ‘of’, ‘to the’, etc) that indicate date ranges, are rarely considered in other works. We used regular expressions to capture and convert complex dates and date ranges present in real medical documents into precise UNIX timestamps. We achieved this by transcribing the documents using an open source Optical Character Recognition (OCR) and Handwritten Character Recognition (HCR) tool, and then pattern-matching against these using regular expressions. Our first research contribution highlights that computer vision and Large Language Models (LLMs) are not able to solve this task. Our second contribution shows that easily-accessible regular expression patterns are not suitable for detecting dates and date ranges. Our third contribution shows that the number of correctly identified dates can be significantly increased by manually constructing regular expressions. Finally, we show that all UNIX timestamps between two points in time can be captured by creating synthetic text containing these dates, and feeding the respective day, month, and year components into a regular expression synthesiser. Using a regular expression synthesiser accounts for different programming languages, produces decomposable regular expressions, and ensures that constructing regular expressions is robust and consistent. No medical data has been made available due to the sensitive nature of this, and so its characteristics are described instead. II Background And Related Work II-A Dates And UNIX Timestamps A date identifies a particular moment in time, in a specific timezone (often UTC or GMT), and this is often represented as the amount of seconds that have elapsed since the 1st of January, 1970 (known as the epoch). These (UNIX, epoch, or POSIX timestamps) have become the standard way to digitally reason about, transfer, and store dates and times, and functionality for calculating these is ubiquitous. [ 6 ] highlights that the Universal Coordinated Time (UTC) standard did not exist until 1970, so calculating negative UNIX timestamps is not an official part of the standard, but it is a common convention for negative numbers to be used when earlier dates are required. Additionally, the technical specification used an unsigned 32-bit number, and as each second adds a value of 1, the integer overflow would limit the dates that can be represented to those at the epoch, and the end of 2038. This 69 year window is too short for many usecases, and so it is common for tools to use a 64 (or more) bit integer or floating-point representation. II-B Optical and Handwritten Character Recognition Digital document transcriptions are created by visually recognising characters, and this is a historically significant research area [ 7 ] . The text could exist in a range of file formats, such as in scanned images, photographs, electronically written documents, and mixed medium files (e.g., PDFs), and there exists an important distinction between Optical and Handwritten Character Recognition (respectively known as OCR and HCR). Many researchers regard OCR as a “solved” problem that can be achieved using far simpler software and hardware than HCR [ 8 ] . Ch. 4 in [ 9 ] lists many visual components of text that are more consistent in machine-written text than handwritten text, including: typeface, weight, size, skew, rotation, spacing, padding, sharpness, and colour. Various open-source and proprietary deep learning architectures have achieved incredible results in this field recently [ 10 ] , but it is rarely clear how [ 11 ] . II-C Explainability Explainability is often seen as an essential requirement for responsible and ethical AI deployment in high-stake applications. The Defense Advanced Research Projects Agency (DARPA) define this as “AI systems that can explain their rationale to a human user, characterize their strengths and weaknesses, and convey an understanding of how they will behave in the future” [ 12 ] . Businesses

Read the complete text