Skip to main content

Parse a P6 .xer file to a Python dictionary object.

Project description

xerparser

xerparser reads a P6 .xer file and converts it into a Python dictionary object containing key, value pairs:

  1. "version": Version of P6 the .xer file was exported as.

  2. "export_date": Date the .xer file was exported from P6 (datetime object).

  3. "errors": A list of potential errors in the .xer file based on common issues encountered when analyzing .xer files:

    • Minimum required tables for a valid P6 schedule are:
      • CALENDAR
      • PROJECT
      • PROJWBS
      • TASK
      • TASKPRED
    • Required table pairs are:
      • TASKFIN <> FINDATES : (Financial Period Data)
      • TRSRCFIN <> FINDATES (Financial Period Data)
      • TASKRSRC <> RSRC (Resource Data)
      • TASKMEMO <> MEMOTYPE (Notebook Data)
      • ACTVCODE <> ACTVTYPE (Activity Code Data)
      • TASKACTV <> ACTVCODE (Activity Code Data)
    • Non-existent calendars assigned to activities.

  4. "tables": Dictionay of each table included in the .xer file.
    Examples: PROJECT, PROJWBS, CALENDAR, TASK, TASKPRED, etc... See Oracle Documentation for mapping and schema of P6 database tables.
    The table name (e.g TASK) is the key, and the value is a list of the table entries, which can be accessed the same as any Python dictionary object:

    xer["tables"]["TASK"]
    or
    xer["tables"].get("TASK")

    Each table entry is a dictionary object where the key is the field name (e.g. task_id, task_code, and task_name) from the table schema.

    for task in xer["tables"].get["TASK", []]:
         print(task["task_code"], task["task_name"])

Example Code

from xerparser import xer_to_dict

xer = xer_to_dict("path to file.xer")
xer["version"] # -> 15.2
xer["export_date"] # -> datetime.datetime(2022, 11, 30, 0, 0)
xer["errors"] # -> [ ]

xer["tables"].get("TASK") # -> [{"task_id": 12345, ...}, {"task_id": 12346,...}]
len(xer["tables"].get("TASK",[])) # -> 950

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xerparser-0.2.0.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

xerparser-0.2.0-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page