Skip to main content

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

Project description

xerparser

A simple Python package that reads a P6 .xer file and converts it into a Python object.

Disclaimers:
This package is only usefull if you are already familiar with the mapping and schemas used by P6 during the export process. Refer to the Oracle Documentation for more information regarding how data is mapped to the XER format.
Tested on .xer files exported as versions 15.2 through 19.12.


Install

Windows:

pip install xerparser

Linux/Mac:

pip3 install xerparser

Usage

Import the Xer class from xerparser and pass a .xer file as an argument.

from xerparser import Xer

file = r"/path/to/file.xer"
xer = Xer(file)

The Xer class accepts .xer file passed as types str, path, or bytes.
The file and table data will be parsed and returned as a Python object.

Attributes

The tables stored in the .xer file are attributes for the Xer class. Since a XER file can contain multiple projects/schedules, the tables are accessable as either Global , Project specific, or Task Specific:

Global

xer.export    # export data
xer.errors    # list of potential errors in export process
xer.calendars # dict of CALENDAR objects
xer.projects  # dict of PROJECT objects
xer.resources # dict of RSRC objectrs

Project Specific

# Get first project
project = xer.projects.values()[0]

project.calendars       # set of CALENDAR objects used by project
project.tasks           # dict of TASK objects
project.relationships   # dict of TASKPRED objects
project.wbs             # dict of PROJWBS objects

Task Specific

# Get first task
task = project.tasks.values()[0]

task.memos        # list of TASKMEMO objects
task.resources    # list of TASKRSRC objects

Error Checking

Sometimes the xer file is corrupted during the export process. A list of potential errors is generated based on common issues encountered when analyzing .xer files:

  • Minimum required tables - an error is recorded if one of the following tables is missing:

    • CALENDAR
    • PROJECT
    • PROJWBS
    • TASK
    • TASKPRED
  • Required table pairs - an error is recorded if Table 1 is included but not Table 2:

    P6 Table 1 P6 Table 2 Notes
    TASKFIN FINDATES Financial Period Data for Task
    TRSRCFIN FINDATES Financial Period Data for Task Resource
    TASKRSRC RSRC Resource Data
    TASKMEMO MEMOTYPE Notebook Data
    ACTVCODE ACTVTYPE Activity Code Data
    TASKACTV ACTVCODE Activity Code Data
  • Non-existent calendars assigned to activities.


Example Code

from xerparser import Xer, PROJECT

file = r"/path/to/file.xer"
xer = Xer(file)  
xer.export.version  # -> 15.2  
xer.export.date  # -> datetime.datetime(2022, 11, 30, 0, 0)  
xer.errors  # -> []  

# get first project
project: PROJECT = xer.projects.values()[0]

# get project name
project.name

# get project data date
project.data_date

# get project finish date
project.finish_date

# get task and relationship count
len(project.tasks)
len(project.relationships)

# loop through tasks
for task in project.tasks.values():
    print(task)

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.3.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xerparser-0.3.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file xerparser-0.3.0.tar.gz.

File metadata

  • Download URL: xerparser-0.3.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.19.0-26-generic

File hashes

Hashes for xerparser-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9cdcfaa7813915d157f8e977224b3187799a37b960df4455d317583e0d2b14e3
MD5 19e2c63bfe2843b7cd80d6f042fac011
BLAKE2b-256 4a9ea23cf4899b7349bae47759b34176ee7d71434ec93f253975794ebfacb971

See more details on using hashes here.

File details

Details for the file xerparser-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xerparser-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.19.0-26-generic

File hashes

Hashes for xerparser-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c3248f71a1fb4849d74f48084ebe8ad068a014211cff37b3fd7267270d86ceb
MD5 88d53a0a86675dcc1491fef7a18f2d1d
BLAKE2b-256 5a5a07a52cdf67096ac8f6c3e9ae162d59818abef11e92d0a3d9f3658c4738e7

See more details on using hashes here.

Supported by

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