Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
fancy code reviewing some python ?

Posted by spuddy (Jon Johnson), 1 March 2005
I am developing a utility which will be put out under GPL to take an SPSS (a widely used stats package) data file and produce XML and some  other outputs There are a number of bits of software which do this already, but they all suffer from limitations and require all sorts of hacks and mucking about and none are as comprehensive as this is going to be (even if it kills me) So I thought I'd do it properly

The data file consists of
1. a header which contains a schema describing the data
2. the data itself

The file is in a rather odd format to me, although it may be familiar to FORTRAN programmers (SPSS is written in FORTRAN)

It also uses a variant of base 30 to encode all numbers,
0=0
1=1
..
9=9
A=10
B=11
..
S=28
T=29
10=30
1T=59
21=61

80 chars wide
it is sort of / delimited, except where there are strings which have the length of the string before the /
e.g.
21/Description of column7/another/99/abcdefghi/
becomes
Description of column
another
9
abcdefghi

I put the schema into a structure and then add data to each element of the structure

I am reasonably happy with the code, but being the lone (Python) coder here I lack feekback and would appreciate any comments

I have used Mertz' state machine pattern to drive the code
it is only 400 lines or so for the main code and you'll get properly credited when i release it.

If you're interested please get in touch at
jj@cls.ioe.ac.uk

cheers

Jon


Posted by admin (Graham Ellis), 2 March 2005
Jon,   I fancy reviewing the code but I don't have enough hours in the day to do everything I fancy.  You're welcome to get in touch further (by personal message on this board or by email) if you would like to send me a copy ... I can promise you up to half an hour within the next 2 weeks to look at it.

Posted by rob_cowie (rob_cowie), 13 April 2005
Hi,

I'm a Python newbie but I'd love to have a look at your code...more for my benefit really.

I want to create a quick script to parse an SPSS datafile, locate a field called PCODE and remove all spaces in it's string.

I assume this can be accomplished in SPSS but I can't find where... and the python script might take me less time than fumbling around SPSS in the dark.

Cheers,

Rob Cowie



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho