Git Product home page Git Product logo

pyp6xer's Introduction

PyP6Xer Python Primavera P6 XER parser

PyXer is an open source project to parse Primavera xer files in python. The project is work in progress and open for community contributions.

In order to install a copy in your system you can use pip package manager as follows:

pip install PyP6XER

The usage of the library is fairly simple and the import examples can be:

from xerparser.reader import Reader

Here are some examples of reading and parsing xer files:

xer = Reader("<filename>") # this returns a reader object  

to reade all projects in file as one xer file may have multiple projects stored into it:

for project in xer.projects:
  print(project)

pyp6xer's People

Contributors

hassanemam avatar jerroldjv avatar chehadekassouf avatar rsantina avatar

Stargazers

hollyDanmaster01  avatar  avatar  avatar Anatoly avatar Giorgio Boiero avatar  avatar Ilgiz avatar GeorgeKalf avatar Mohamed Mohsen Elnahla avatar Serge Volkov avatar  avatar mil2345 avatar Osama Ata avatar  avatar EhsanC avatar Morgan Solomon avatar  avatar  avatar YMS avatar  avatar Tinotenda Chigwida avatar  avatar Brian Kurt Fujikawa avatar 或且非 avatar  avatar Karim Gaber avatar  avatar yar avatar Edgar Vega Silva avatar  avatar Pawel Dziemiach avatar Rey F. Diaz avatar  avatar

Watchers

James Cloos avatar Karim Gaber avatar  avatar lawrence rowland avatar Euan Hillerby avatar EnverMT avatar  avatar

pyp6xer's Issues

test.py fails as no 'sample.xer'

Describe the bug
test.py fails as no 'sample.xer'

To Reproduce
Steps to reproduce the behavior:

  1. Go to root
  2. Click on launch test.py
  3. See error
Traceback (most recent call last):
  File "PyP6Xer/test.py", line 10, in <module>
    r = Reader('sample.xer')
  File "PyP6Xer/xerparser/reader.py", line 282, in __init__
    file = open(filename, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'sample.xer'

Expected behavior
Getting a short view of the tested file

DCMA-14 Point Analysis - VISUALISATION

Congrats @HassanEmam for the impressive and amazing project!
Would it be possible to add some results visualisation to the DCMA-14 point analysis?

  • Summary table of the results
  • Graphical summary of results

Thanks a lot

'Task' object has no attribute 'get'

When calling the dcma.analysis() method I get the following error

Exception has occurred: AttributeError
'Task' object has no attribute 'get'

image

sched_options not present in XER

There are cases when sched_options is not present in the XER and not all add_date are present in the PROJECT data.

for sched_options not present the system stops with this error:
KeyError from line 121 of file venv/Lib/site-packages/xerparser/src/xer.py
maybe if u can check if the sched_options is not present to have a default.

for the add_date are present the system stop with this error:
time data '' does not match format '%Y-%m-%d %H:%M' from line 39 of file venv/Lib/site-packages/xerparser/schemas/project.py
maybe if u can check if it is not present not to assign it or use a default date

Thanks

DCMA14 error: print(health.analysis())

Hi, first of all congrats for this awesome project! I just started testing it and I am encountering the following error. Could you please help me figure it out?

Traceback (most recent call last):
File "c:\Users\neres\VisualStudio Projects\PyP6Xer trial\test_trial.py", line 181, in
print(health.analysis())
File "c:\Users\neres\VisualStudio Projects\PyP6Xer trial\xerparser\dcma14\analysis.py", line 97, in analysis
'cstrs': [self.get_activity(x.task_id) for x in self.constraints]}
File "c:\Users\neres\VisualStudio Projects\PyP6Xer trial\xerparser\dcma14\analysis.py", line 97, in
'cstrs': [self.get_activity(x.task_id) for x in self.constraints]}
AttributeError: 'dict' object has no attribute 'task_id'
PS C:\Users\neres\VisualStudio Projects\PyP6Xer trial>

Reader.resources is empty

The resources are not being loaded.
I tried both Reader and to reach it from within activity. resources but the it contained only resource assignment primitive information.
example is labor or not.
Is it possible to add the resource object to the individual resource assignment at the activity level

Activity/task estimation weight ("est_wt") error ValueError: could not convert string to float: ''

Describe the bug
Traceback (most recent call last): File "/Users/scottcurtis/Documents/Work/Repos/xer-file-parser/cli.py", line 62, in <module> main(sys.argv[1:]) File "/Users/scottcurtis/Documents/Work/Repos/xer-file-parser/cli.py", line 56, in main parser_factory.get( File "/Users/scottcurtis/Documents/Work/Repos/xer-file-parser/library/parser/pyp6xer/parser.py", line 19, in parse reader = Reader(self.input_file_path) File "/Users/scottcurtis/Library/Python/3.9/lib/python/site-packages/xerparser/reader.py", line 330, in __init__ self.create_object(current_table, zipped_record) File "/Users/scottcurtis/Library/Python/3.9/lib/python/site-packages/xerparser/reader.py", line 106, in create_object self._tasks.add(params, self._data) File "/Users/scottcurtis/Library/Python/3.9/lib/python/site-packages/xerparser/model/tasks.py", line 38, in add task = Task(params, data) File "/Users/scottcurtis/Library/Python/3.9/lib/python/site-packages/xerparser/model/classes/task.py", line 53, in __init__ self.est_wt = locale.atof(params.get('est_wt').strip()) if 'est_wt' in params.keys() else None File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/locale.py", line 328, in atof return func(delocalize(string)) ValueError: could not convert string to float: ''

To Reproduce
Attempt to read an XER file with "estimation weight" for a task as a none-float value.

Expected behavior
Reader to successfully parse the file.

Activities relationship

Dear Dr. Emam,
I am writing this message to contribute an idea that may you find interested to be updated with PyP6Xer. One of the biggest issues we can find is that the changing of the relationship between the activities, more specifically, the changing of the sequence of works. In essence, if I have a project of 8 Buildings or a project divided into many areas, and we need to change the sequence of works between the buildings or the areas, this issue will need loads of efforts to change thousands of relationships between the activities using export and import function with Excel spreadsheet or modifying the relationship on the XER file itself.
My idea is if there is a solution to change the relations using python, then import it into the XER file.

Thanks,
Kareem.

TaskPred lag_hr_cnt

Hi @HassanEmam, I've noticed through exploring a set of XER files that the lag_hr_cnt field within the TASKPRED table may contain float values. This results in a ValueError when attempting to use the Reader since line 31 of taskpred.py is int(params.get('lag_hr_cnt').strip()). Would it be possible to update this line to float instead of int?

end_date showing wrong values

I noticed that the end_date is showing the same value as start_date.
I had to use the early_end_date for the meantime.

field larger than field limit (131072)

@hassan this error happened when importing .xer with 11 projects. Could you help? I need to analyze several projects. Thank you!

Error Traceback (most recent call last)
in
1 #segundo passo - ler arquivo xer
----> 2 xer = Reader("/content/drive/MyDrive/DD30092022_.IP-I_Axer.xer")
3

/usr/local/lib/python3.7/dist-packages/xerparser/reader.py in init(self, filename)
320 with codecs.open(filename, encoding='utf-8', errors='ignore') as tsvfile:
321 stream = csv.reader(tsvfile, delimiter='\t')
--> 322 for row in stream:
323 if row[0] =="%T":
324 current_table = row[1]

Error: field larger than field limit (131072)

Unable to access predecessors/successors

Describe the bug
Thank you for a great project @HassanEmam!

I would like to use the library to pull out all predecessors to an activity. Once I find the activity and try to print predecessors (project.activity.predecessors) I am getting an error: TypeError("Predecessors.get_predecessors() missing 1 required positional argument: 'act_id'")

Full error:
'Traceback (most recent call last):\n File "location\.vscode\extensions\ms-python.python-2022.20.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_resolver.py", line 192, in _get_py_dictionary\n attr = getattr(var, name)\n File "location\Python\Python310\lib\site-packages\xerparser\model\classes\task.py", line 318, in predecessors\n return Predecessors.get_predecessors(self.task_id)\nTypeError: Predecessors.get_predecessors() missing 1 required positional argument: 'act_id'\n'

Same issue with successors. I am assuming this has something to do with XER file that I have but just wanted to confirm. Thank you!

To Reproduce
Attempt to print predecessors to an activity

My code is straight-forward:

from xerparser.reader import Reader

filename = "my.xer"
xer = Reader(filename) # this returns a reader object

for project in xer.projects:
if(project.proj_short_name == "my_project"):
print("PROJECT: " + project.proj_short_name + "*****")
for activity in project.activities:
if(activity.task_name == "my_activity"):
print("Activity ID | ", activity.task_code, " | Activity Name | ", activity.task_name, " | Pred |", activity.predecessors)
else:
continue

Expected behavior
Print a list of predecessors

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 10
  • Python: 3.10

Smartphone (please complete the following information):

  • N/A

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.