Lookup Strategies

Rob Rothwell r.j.rothwell at gmail.com
Thu Oct 2 13:45:52 UTC 2008


Hello...
My basic question is if using a MagmaReader is the best way to search a
MagmaCollection for a SINGLE object...

Background information follows!

---------------------------------------------------------------

I am using Magma to create a sort of Object-Based Warehouse for multiple
Applications in a Healthcare Environment.

I have developed a pretty decent "batch loading" strategy that is based upon
my knowledge of my own system limitations, which unfortunately is actually
driving my Data Model.  Basically, I have a PatientEncounter, which has
multiple PatientEncounterElement(s) (demographics, coding information,
billing information, etc...) which are pretty much tied directly to the
systems and functions they come from, NOT exactly how it makes the most
sense!  However, this lets us batch update "pages" of
PatientEncounterElement(s) at a time and limiting the number of ODBC calls
required.

My question, though, is in my strategy for checking for NEW
PatientEncounter(s).  Basically I am searching through my live data over a
date range (I have no triggers available, and most of our systems don't lend
themselves to finding new patients that weren't there yesterday) and making
sure the PatientEncounter is present in the Magma database like so:

EncounterReader>>updateEncounterListFrom: anAccountList "a collection of
ODBCRow(s)"
| i pat |
i := 0.
anAccountList do:
[ :each |
pat := PatientEncounter forAccount: each acct.
pat ifNil:
[ pat := PatientEncounter newAccount: each acct.
pat admissionDate: each admDate.
pat dischargeDate: each disDate.
FMCMagmaClient demographics add: pat demographics.
FMCMagmaClient encounters add: pat.
i := i + 1.
i > self pageSize ifTrue:
[ FMCMagmaClient commitAndBegin.
i := 0 ] ] ].
(i > 0) ifTrue: [ FMCMagmaClient commitAndBegin ]

Where FMCMagmaClient encounters, FMCMagmaDemographics, etc... return the
MagmaCollections that hold those objects, and:


Class PatientEncounter>>forAccount: anAccountNumber
| reader |
reader := FMCMagmaClient encounters where: [ :each | each acct =
anAccountNumber ].
reader size = 0 ifTrue: [ ^ nil ].
^ reader first

and I have indexed #acct.

Anyway, checking for existing records and adding new ones as necessary seems
to take longer than just updating existing records, which is to be expected,
so I was wondering if this is the best way to check for existing records in
my MagmaCollection.

Thanks, and take care,

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/magma/attachments/20081002/196aadfd/attachment.htm


More information about the Magma mailing list