Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Developer Blog » Kyle's Blog » Subject Field Inconsistencies

Subject Field Inconsistencies Subject Field Inconsistencies

Document Actions
Submitted by kclarks. on 2007-03-13 17:11. ContentDevelopment
Some suggestions I have for cleaning up our subject data
Well, looking at the subject fields, on our currently published objects, we seem to have quite a bit of inconsistencies.  The main issue that I see is that courses have subjects as strings, whereas module subjects are tuples.  It seems to me like we should really convert them to the same data type. Here is a run-down of our various subjects, how many of each we have, and what I would suggest that we do to them to make them more consistent:

Current Value
# of Objects
Suggested Change
('Social Sciences',) 198
NO CHANGE
()29
NO CHANGE
'Science and Technology' 117
('Science and Technology',)
('Humanities',) 106
NO CHANGE
('Arts',)
190
NO CHANGE
('',) 119
()
('Mathematics and Statistics', ' Science and Technology') 312
NO CHANGE
('Business',) 15
NO CHANGE
('Business', ' Social Sciences') 2
NO CHANGE
('Mathematics and Statistics',) 186
NO CHANGE
('Science and Technology', ' Social Sciences') 10
NO CHANGE
'Social Sciences' 3
('Social Sciences',)
('Arts', ' Science and Technology') 22
NO CHANGE
('Humanities', ' Social Sciences') 43
NO CHANGE
('Humanities', ' Test/Draft') 1
NO CHANGE
'Mathematics and Statistics' 6
('Mathematics and Statistics',)
'Business'
6
('Business',)
('Arts', ' Social Sciences') 53
NO CHANGE
('Humanities', ' Science and Technology') 40
NO CHANGE
('Science and Technology',) 2476 NO CHANGE
'Test'
9
('Test/Draft')
'Humanities' 23
('Humanities',)
('Test/Draft',)
86
NO CHANGE
'Arts'
11
('Arts',)
''
1
()

Any of the subjects that will be getting set to empty, (), would instead get set to the subject of an earlier version if it was somehow lost in republishing.  This is mostly the case for the modules that now have ('',).

Anyone want to suggest other changes while I am at it?

Re: Subject Field Inconsistencies

Posted by jenn at 2007-03-14 11:20
Yeah, I think we should have an interface for setting them. *duck* :)

No, this looks good to me, and the scripts work and everything.

Re: Subject Field Inconsistencies

Posted by kef at 2007-04-25 23:01
What is the status of the suggestion to make all subjects tuples? Is this Ross territory? Seems like a good idea to me.

Re: Re: Subject Field Inconsistencies

Posted by jenn at 2007-04-26 09:27
It's a data structure thing, but a ZODB/Plone code one, so in the general developer ballpark.

This was partially done in the newlook upgrade script pass where we set the module subjects; at the same time, all blank course subjects were changed to be empty tuples instead of empty strings. I don't think the code was changed to make new objects follow the new scheme, though, so we're still getting empty strings on at least some new courses (see depot 8080 where I published a bunch of copies of a new course that had been sitting in the workgroup since before newlook).

Do this in debug to see that there are plenty of courses out there in workgroups with string-type subjects: [[c.subject for c in wg.objectValues('Collection')] for wg in app.plone.GroupWorkspaces.objectValues() if wg.objectIds('Collection') != []]

Re: Re: Re: Subject Field Inconsistencies

Posted by jenn at 2007-04-26 09:37
This seems to do the trick for objects in workgroups:

groups=app.plone.GroupWorkspaces.objectValues()
groups.extend(app.plone.Members.objectValues())

for wg in groups:
for c in wg.objectValues('Collection'):
if c.subject == '':
c.subject = ()

We can run it next time we're planning to test course publishing, along with another run of FixBadSubjects.zctl from the newlook scripts directory.

Re: Re: Re: Re: Subject Field Inconsistencies

Posted by jenn at 2007-04-26 09:38
Argh. Blasted formatting. Well, I'm sure you can see where the indentation should go.
Developer Blog
« May 2008 »
Su Mo Tu We Th Fr Sa
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Categories:
Content (55)
Copyright (0)
Deep Code (3)
Development (193)
Markup (22)
Metadata (1)
Printing (7)
Style (9)
Testing (2)
Usability (6)