• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Best practices when transforming data?

EightBitz

Well-known member
With the Pathefinder system, in the structure section, with categories, sections and facets, everything as an ID and a name. I've noticed that with user-added elements in play, the IDs can change. It's not safe to assume that the category_id for the "Spell" category will always be the same for everyone.

With the script I'm working on to import data, the first thing I do is poll all the categories.

Code:
$CategoryList = $structure.GetElementsByTagName("*") | Where-Object {$_.category_id}

That gets me a list of everything in the structure that has a category_id value, whether it's a global category or a user category.

If I want to create a spell topic, I'll search that list for an element with the name of "Spell", and assign the associated category_id to the new topic.

Then for each topic, I grab a list of all the sections in a similar fashion, and just create a loop to create a section for each partition_id it finds for that topic.

Then within the section, I poll for facet_id, and create a snippet for each facet_id.

Then I reference each facet ID by name and process it accordingly.

Up to this point, it all seems like common sense stuff, but from here, things can vary. So my question is, what official standard should I adhere to?

With spells, for example, I'm inclined to assume that:
There will always be an "Overview" section, but it won't necessarily be the first one.
The "Overview" section will always contain the school, subschool, descriptor(s) (etc) snippets.
These snippets for spells will always be present, and always by these names.
There will always be a "Description" section, and it will always have at least one text snippet for the general description of the spell.
There will always be a Mythic section, and it will always have at least one text snippet for a description.

In other words, the basic elements and structure that I see in a default Pathfinder structure, the standard would be to assume that those elements will always be there, by their existing names, and in their existing sections.

There may be MORE snippets and sections, but I don't have to worry about those.

And users may have moved things around and renamed things, but if they have, then it's on their heads, not mine. ;-)

Is that a good general assessment? Or am I making bad assumptions or overlooking anything?
 
Since you provide the structure in your import XML file, then you define the layout within those structures.

IF you use the standard game-system structure as the basis for your own XML import file then you can't go far wrong, and RW should map the standard game-system topics/snippets to match any changes that it knows about in the realm into which it's being imported.

The game system structure isn't going to change that often, so it isn't really worth reloading it each time you want to export it.
 
Since you provide the structure in your import XML file, then you define the layout within those structures.

IF you use the standard game-system structure as the basis for your own XML import file then you can't go far wrong, and RW should map the standard game-system topics/snippets to match any changes that it knows about in the realm into which it's being imported.

The game system structure isn't going to change that often, so it isn't really worth reloading it each time you want to export it.

Ah, you're right of course. I guess I have it so ingrained in me not to hard-code things that I overlooked the obvious.

It's still worthwhile to practice good habits, though. :-)
 
Back
Top