Job Analysis

These exercises require the file jobs.csv.

Group Parents and Children

Print out each parent job followed by each child job that corresponds to that parent.

The output should look something like this:

Lot Level       Full job number                 Shared digits   Unique number
Parent Lot      000JE0173V5.0E00#SBHPY_TS       JE0173V5.0E     00
Child Lot       000JE0173V5.0E01#SBHPY_TS       JE0173V5.0E     01
Child Lot       000JE0173V5.0E09#SBHPY          JE0173V5.0E     09
Parent Lot      000JE01963X.0E00#SBKNR_TS       JE01963X.0E     00
Child Lot       000JE01963X.0E09#SBKNR          JE01963X.0E     09
Child Lot       000JE01963X.0E01#SBKNR_TS       JE01963X.0E     01

Alternatively you could output those rows/columns into a delimited data file.

Unclosed Parents

Identify parent jobs that should be closed because one or more of their children jobs are closed but they are not.

A job has been “closed” if the TRANSACTION_TYPE_NAME column is Job close variance at any point.

The output should look something like this:

Lot Level       Full job number                 Shared digits   Unique  Closed?
Parent Lot      000JE0173V5.0E00#SBHPY_TS       JE0173V5.0E     00      True
Child Lot       000JE0173V5.0E01#SBHPY_TS       JE0173V5.0E     01      True
Child Lot       000JE0173V5.0E09#SBHPY          JE0173V5.0E     09      False
Parent Lot      000JE01963X.0E00#SBKNR_TS       JE01963X.0E     00      True
Child Lot       000JE01963X.0E01#SBKNR_TS       JE01963X.0E     01      True
Child Lot       000JE01963X.0E09#SBKNR          JE01963X.0E     09      False

If any parent jobs are not closed but they have at least one child job which is, an error should be printed out like this:

Error: 000JE0173V5.0E00#SBHPY_TS should be closed