Home Applications isc-coding-challenge-golf

isc-coding-challenge-golf

InterSystems does not provide technical support for this project. Please contact its developer for the technical assistance.
0
0 reviews
0
Awards
2
Views
0
IPM installs
0
0
Details
Releases (1)
Reviews
Issues
A code-golf submission for the ISC Programming Challenge

What's new in this version

Initial Release

ISC Coding Challenge — Code Golf

A code-golf submission for the InterSystems Employee Programming Challenge #1. Processes 20 Gaia DR3 epoch photometry files to identify variable stars with >100% flux variation in either the BP or RP band.

Results

  • 1 line of code in src/RunScript.mac
  • 448 characters on the code line
  • Produces 57,099 qualifying variable sources

How it works

The entire solution is a single Python one-liner embedded in an ObjectScript $SYSTEM.Python.Run() call:

import os
s = lambda c: (
    # Parse flux array "[1.2,NaN,3.4,...]" -> (min, max) or (0,0)
    (v := [float(x) for x in c[1:-1].split(',') if x if x < 'N'])
    and (min(v), max(v)) or (0, 0)
)

open('/o/r.csv', 'w').write( 'source_id,bp_min_flux,bp_max_flux,rp_min_flux,rp_max_flux,percentage_change\n' + ''.join( f'{q[0].split(",")[1]},{a},{b},{c},{d},{p}\n' for l in os.popen('zcat /i/') # decompress all .gz files via shell if '/' < l[0] < ':' # keep only data rows (start with digit) if (q := l.split('"')) # split on double-quote to isolate array fields for a, b, c, d in [s(q[17]) + s(q[27])] # bp flux (field 18) + rp flux (field 28) if (p := max( a and (b-a)/a100 or -1, # bp percentage change c and (d-c)/c*100 or -1 # rp percentage change )) > 100 ) )

Key optimizations

  1. os.popen('zcat /i/*') — eliminates import gzip, glob, csv by leveraging shell decompression and globbing
  2. '/' < l[0] < ':' — filters data rows (ASCII digits 48-57) in 15 chars, skipping # comments and the text header
  3. x < 'N' — filters NaN values lexicographically (4 chars vs x != 'NaN')
  4. Walrus operator — binds the quote-split result inline without an extra for q in [...] clause
  5. Short volume mounts (/i/, /o/) — saves ~56 chars vs full IRIS paths

Running

docker-compose up --build

Then invoke:

iris session IRIS -U USER "d Run^RunScript"

Output is written to data/out/r.csv on the host (mounted as /o/r.csv inside the container).

Docker setup

The docker-compose.yml mounts:

  • ./dataset/i (input gzipped CSVs)
  • ./data/out/o (output directory)
  • .//home/irisowner/dev (full project for IRIS to load the source)
Version
1.0.015 Jul, 2026
Category
Analytics
Works with
InterSystems IRIS
First published
15 Jul, 2026
Last edited
15 Jul, 2026