Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.062 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'bash': 0.07; 'currency': 0.07; 'hierarchical': 0.07; 'subject:How': 0.09; 'csv': 0.09; 'level:': 0.09; 'objects.': 0.09; 'toss': 0.09; 'units,': 0.09; 'example:': 0.10; 'stored': 0.10; 'python.': 0.11; 'subject: \n ': 0.15; '(system': 0.16; 'drag': 0.16; 'folder,': 0.16; 'hurt.': 0.16; 'moving,': 0.16; 'postgres,': 0.16; 'received:195.186': 0.16; 'received:bluewin.ch': 0.16; 'scripts.': 0.16; 'umbrella': 0.16; 'wizard': 0.16; 'wrote:': 0.16; 'alex': 0.18; 'say,': 0.18; 'do.': 0.22; 'expense': 0.22; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'header:User-Agent:1': 0.26; 'subject:list': 0.26; 'comfortable': 0.27; 'respective': 0.27; 'have,': 0.27; 'occurred': 0.29; 'repair': 0.29; 'subject:that': 0.29; "i'm": 0.30; 'branch': 0.30; 'folder': 0.30; 'task': 0.30; "i'd": 0.31; 'operations': 0.31; 'probably': 0.31; 'another': 0.32; 'up.': 0.32; 'third': 0.33; 'lets': 0.33; 'thanks!': 0.34; 'file': 0.34; 'this?': 0.34; 'worked': 0.34; 'add': 0.34; 'next': 0.35; 'could': 0.35; 'requiring': 0.35; 'quite': 0.35; 'item': 0.35; 'but': 0.36; 'skip:i 20': 0.36; 'instead': 0.36; 'smaller': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thought': 0.37; 'list.': 0.37; "won't": 0.38; 'names': 0.38; 'anything': 0.38; 'someone': 0.38; 'usd': 0.38; 'end': 0.39; 'data': 0.39; 'subject:the': 0.39; 'system.': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'easy': 0.60; 'collection': 0.60; 'your': 0.60; 'portfolio': 0.61; 'real': 0.62; 'art': 0.62; 'charset:windows-1252': 0.62; 'matter': 0.63; 'more': 0.63; 'within': 0.64; 'management': 0.64; 'air': 0.65; 'managing': 0.66; 'received:ch': 0.66; 'investment': 0.67; 'records': 0.70; 'wish': 0.71; 'commercial': 0.73; 'bank': 0.75; 'estate': 0.76; 'hoping': 0.77; 'collection,': 0.84; 'fear.': 0.84; 'folders.': 0.84; 'fourth': 0.84; 'hardly': 0.84; 'quantity,': 0.84; 'received,': 0.84; 'banks,': 0.91; 'inefficient': 0.91; 'estate,': 0.93; 'revenue,': 0.93; 'accounts,': 0.95; 'imagine': 0.96 Date: Fri, 14 Aug 2015 23:25:20 +0200 From: Friedrich Rentsch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: How to model government organization hierarchies so that the list can expand and compress References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439587589 news.xs4all.nl 2914 [2001:888:2000:d::a6]:46790 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95381 On 08/13/2015 09:10 PM, Alex Glaros wrote: > It's like the desktop folder/directory model where you can create unlimited folders and put folders within other folders. Instead of folders, I want to use government organizations. > > Example: Let user create agency names: Air Force, Marines, Navy, Army. Then let them create an umbrella collection called "Pentagon", and let users drag Air Force, Marines, Navy, etc. into the umbrella collection. > > User may wish to add smaller sub-sets of Army, such as "Army Jeep Repair Services" > > User may also want to add a new collection "Office of the President" and put OMB and Pentagon under that as equals. > > What would the data model look like for this? If I have a field: next_higher_level_parent that lets children records keep track of parent record, it's hard for me to imagine anything but an inefficient bubble sort to produce a hierarchical organizational list. Am using Postgres, not graph database. > > I'm hoping someone else has worked on this problem, probably not with government agency names, but perhaps the same principle with other objects. > > Thanks! > > Alex Glaros After struggling for years with a tree-like estate management system (onwer at the top, next level: real estate, banks, art collection, etc., third level: real estate units, bank accounts, etc. fourth level: investment positions, currency accounts, etc)--it recently occurred to me that I had such a system all along: the file system. The last folder at the bottom end of each branch names its contents (AAPL or USD or Lamborghini, etc) the contents is a csv file recording an in and out, revenue, expense history (date, quantity, paid or received, memo, . . .). Any documentation on the respective value item may also be stored in the same folder, easy to find without requiring cross referencing. Managing the data is not a awkward as one might fear. A bash wizard could probably do it quite efficiently with bash scripts. Bash dummies, like me, are more comfortable with python. Moving, say, a portfolio from one bank to another is a matter of "mv i/banks/abc/account-123 i/banks/xyz" (system call). With the tabular data base system (MySQL) I have, simple operations like this one are quite awkward. Well, you might laugh. Or others might. If your task is a commercial order, then this approach will hardly do. Anyway, I thought I'd toss it up. If it won't help it won't hurt. Frederic