Below is how I've considered it thus far, with each Table name listed with its column names listed.
DataSources (obvious, store details of the data sources here)
---------------
SourceID_PK
Acquisition_Date
Acquired_From
DataFields (This would represent the accepted field names for all the imported data - the accepted synonyms - a sort of controlled vocabulary)
------------
FieldName_PK
DataFieldSynonyms
-----------------------
DataFieldSynonym_PK
DataSource:SourceID (link to data source table)
DataFields:FieldName (link to DataFields table)
So far, I think this captures what I need to manage synonyms. In this simple case, DataFields would contain every field name except Data6. Data6 would be the non-accepted synonym, but we want to keep it around so we know what file number 2 called this field. DataFieldSynonyms would contain every data field ever encountered. One minor redundancy here is this: In this example Data3 from File one is the accepted synonym for Data6 from File two. Let's say we have File three that also has Data6 but for whatever reason it is synonymous with Data1 in that case. Twisted I know. The result I see is that Data6 is listed three times in the DataFieldSynonyms table, once from each Data Source. For Data Source 1, it is liked the the accepted Data3, for Data Source 2, it is linked to the accepted Data3, but for Data Source 3 it is linked to Data1. If you're still with me, I'm interested if that redundancy will matter, and if so, how might I eliminate it.
Now it starts to get tricky - storing the actual data. Most simply, if we assume all the data is the same type, I could use a very tall, skinny table.
DataTable
-----------
Observation_ID_PK (primary key)
DataFields:FieldName_FK (link to DataFields table)
Value
But would this become a performance issue once I start collecting all the data for a particular observation or if I try to reconstitute the original input file?
Even more complicated is the situation where I have different data types that I need to treat differently: boolean, real, integer, categorical. Here I could have 4 tables like DataTable, one for each data type - BooleanData, RealData, IntegerData, CategoricalData, each with the same three fields as above. Alternatively, I could have a wider, sparse table:
DataTable
------------
Observation_ID_PK
DataType (use a simple flag to tell me which of the 4 data types is being used)
DataFields:FieldName_FK (link to DataFields table)
Boolean_Value
Real_Value
Integer_Value
Categorical_Value
But again, it is really just a tall, skinny table. If I have 1 million rows in each input file, and each row has 100 columns of data, will a tall, skinny table become a major issue once I start trying to collect data. My concern is that I end up with lots of self-joins on this DataTable.
Any tips are greatly appreciated.
-Kirk