Opasnet base structure: Difference between revisions
(→All tables: updated) |
m (→All tables) |
||
Line 147: | Line 147: | ||
===Table structure in the database=== | ===Table structure in the database=== | ||
====All tables==== | ==== All tables ==== | ||
{| VALIGN="top" BORDER="0" | {| VALIGN="top" BORDER="0" | ||
Line 154: | Line 154: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''act''' | |colspan=5|'''act''' | ||
|- | |||
|colspan=5|'''Uploads, updates, and other actions''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 173: | Line 175: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''actloc''' | |colspan=5|'''actloc''' | ||
|- | |||
|colspan=5|'''Locations of an act''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 184: | Line 188: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''actobj''' | |colspan=5|'''actobj''' | ||
|- | |||
|colspan=5|'''Acts of an object''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 202: | Line 208: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''acttype''' | |colspan=5|'''acttype''' | ||
|- | |||
|colspan=5|'''List of action types''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 213: | Line 221: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''cell''' | |colspan=5|'''cell''' | ||
|- | |||
|colspan=5|'''Cells of an object''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 232: | Line 242: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''loc''' | |colspan=5|'''loc''' | ||
|- | |||
|colspan=5|'''Location information''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 252: | Line 264: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''loccell''' | |colspan=5|'''loccell''' | ||
|- | |||
|colspan=5|'''Locations of a cell''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 263: | Line 277: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''obj''' | |colspan=5|'''obj''' | ||
|- | |||
|colspan=5|'''Object information (all objects)''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 282: | Line 298: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''objtype''' | |colspan=5|'''objtype''' | ||
|- | |||
|colspan=5|'''Types of objects''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 294: | Line 312: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''res''' | |colspan=5|'''res''' | ||
|- | |||
|colspan=5|'''Result distribution (actual values)''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key | ||
Line 313: | Line 333: | ||
{| {{prettytable}} | {| {{prettytable}} | ||
|colspan=5|'''wiki''' | |colspan=5|'''wiki''' | ||
|- | |||
|colspan=5|'''Wiki information''' | |||
|- | |- | ||
|Field||Type||Null||Extra||Key | |Field||Type||Null||Extra||Key |
Revision as of 10:34, 11 March 2011
Moderator:Jouni (see all) |
|
Upload data
|
This page is about the structure of Opasnet Base. For a general description, see Opasnet base.
Scope
Opasnet base is a storage and retrieval system for results of variable and data from studies. What is the structure of Opasnet base such that it enables the following functionalities?
- Storage of results of variables with uncertainties when necessary, and as multidimensional arrays when necessary.R↻
- Automatic retrieval of results when called from Opasnet wiki or other platforms or modelling systems.
- Description and handling of the indicess that a variable may take.
- It is possible to protect some results and data from reading by unauthorised persons.
- If is possible to build user interfaces for easily entering observations into the Base.
Definition
Data
Software
Because Opasnet base will contain very large amounts of mostly numerical information, the state-of-the-art structure is a SQL database. Because of its flexibility, ease of use, and cost, MySQL is an optimal choice among SQL software. In addition to the database software, a variable transfer protocol is needed on top of that so that the results of variables can be retrieved and new results stored either automatically by a calculating software, or manually by the user. Fancy presenting software can be built on top of the database, but that is not the topic of this page.
Storage and retrieval of results of variables
The most important functionality is to store and retrieve the results of variables. Because variables may take very different forms (from a single value such as natural constant to an uncertain spatio-temporal concentration field over the whole Europe), the database must be very flexible. The basic solution is described in the variable page, and it is only briefly summarised here. The result is described as
P(R|x1,x2,...)
where P(R) is the probability distribution of the result and x1 and x2 are defining locations of an index where a particular P(R) applies. Typically locations are operationalised as discrete indices. A variable must have at least one index. Uncertainty about the true value of the variable is operationalised as a random sample from the probability distribution, in such a way that the samples are located along an index Sample, which is a list of integers 1,2,3...n, where n=number of samples.
Dependencies
Result
Opasnet base is a MySQL database located at http://base.opasnet.org.
Data structure
All data should be convertible into the following format:
Personal measurements | ||||
Year | Sex | Age | Height | Weight |
2009 | Male | 20 | 178 | 70 |
2009 | Male | 30 | 174 | 79 |
2010 | Male | 25 | 183 | 84 |
2010 | Female | 22 | 168 | 65 |
where
Name for explanation column(s). |
Explanation data. These are determined or decided before the the actual observations are done. |
Observation index. Common name for all observations |
Name for observation column(s). These are the parameters studied. |
Observation data. These are the actual measurements. |
This is the "Standard data" that is entered as a Data table. The observation index is given separately in Object info and does not yet show up in the table.
Year | Sex | Age | Height | Weight |
2009 | Male | 20 | 178 | 70 |
2009 | Male | 30 | 174 | 79 |
2010 | Male | 25 | 183 | 84 |
2010 | Female | 22 | 168 | 65 |
This is Object information. It slightly varies depending the format you use for uploading data.
ident | Op_en2693 |
name | Testvariable |
unit | # |
# explanation cols | 3 |
observation index | health impact |
probabilistic? | No |
This is the indexified table where all observations have been put into a single column. The next step is to replace all explanatory data text (columns 1-4) with identifiers (from the Loc table in the Opasnet Base).
Year | Sex | Age | Personal measurements | result |
2009 | Male | 20 | Height | 178 |
2009 | Male | 30 | Height | 174 |
2010 | Male | 25 | Height | 183 |
2010 | Female | 22 | Height | 168 |
2009 | Male | 20 | Weight | 70 |
2009 | Male | 30 | Weight | 79 |
2010 | Male | 25 | Weight | 84 |
2010 | Female | 22 | Weight | 65 |
(The tables above have been created with File:Opasnet base explanation.ods.)
Table structure in the database
All tables
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Replacing some cells
It is possible that there is a large data, where there is a need to update only a few cells while all others remain the same. How should this be done? There are a few potential alternatives.
- Use the current replace functionality. Replace all cells but most of them with the original value.
- Use a new act_type that is similar to the current append functionality. This should be understood in a way that if there are two (or more) identical cells (based on cell indices and locations), then the newest result is used and all older ones are discarded. (If the old append is used, then new info is just seen as a new row in the data table, not a replacement of an existing row.
- Add a new field into the cell (?) table with an updated cell_id (in a similar way than act_id and series_id are used in the actobj table). This way, the new cell can automatically inherit all locations of the old cell.
Formula structure
Now it has become clear that it is not enough to have samples of the result distributions. It must be possible to completely recalculate the result based on the information in the Opasnet Base. There are different approaches:
- Calculate the result based on a formula that may refer to other variables called parents. This is a deterministic approach.
- Calculate the result based on the marginal distribution and (conditional) rank correlations with parent variables. This is a probabilistic approach.
This approach requires new tables, namely Formula and Language.
- ----11: . Do we need tables DIF and DIP like Uninet? --Jouni 21:50, 30 December 2009 (UTC) (type: truth; paradigms: science: comment)
- DIP
- DIP_node_id
- DIP_parent_node_id
- DIP_corr_coeff
- DIP_parent_index
- DIF
- DIF_node_id
- DIF_formula
- DIF_varnames_in_formula
All tables: Overview
- We need Ressec (Result secure) and Resinfosec (Result info secure) tables for secure information. All other tables are openly readable except these two. They have the same structure as Res and Resinfo tables, respectively.
Table | Description |
---|---|
Acttype | List of action types |
Cell | Cells of an object |
Formula | Formulas for computing variable results |
Item | |
Language | List of languages understood by the formula |
Loc | Location information |
Loccell | Locations of a cell |
Log | |
Obj | Object information (all objects) |
Objinfo | Additional information about the objects |
Objtype | Types of objects |
Res | Result distribution (actual values) |
Resinfo | Additional description of the result |
Resinfosec | Additional description of the result |
Ressec | Result distribution (actual values) |
Sett | Memberships of items in sets |
Settype | Types of set-item memeberships |
Wiki | Wiki information |
Universal Opasnet Base
The idea of universal Opasnet Base says that it should be possible to store results in such a way that the results themselves are public but their interpretation is limited. For example, patient symptoms and clinical test results should be openly available for research, but information about whose results they are should be private. This can be achieved with the following database structure.
Let's say that it is enough to have two security levels, public and private. A person wants to record personal health information into the database. She logs in with her personal user name. The private profile gives the name (say, Liisa) and social security number of the person, while the public profile says only "30-40-year-old woman in Finland". Liisa writes down her symptoms or medical information and saves them. This is what is stored in the databases:
Table, field | Private database | Public database |
---|---|---|
act.who | Liisa, 010175-1024 | Woman, 30-40 a |
act.when | 2011-03-09 22:09:10 | 2011-03 |
obj.name | N/A. Data is taken from public side. | Pregnancy test |
loccell.loc_id (locations and indices explained) | Person = 010175-1024 Time = 2011-03-09 Test = Clearblue digital test |
Age = 30-40 Sex = Female Country = Finland Time = 2011-03 Test = Clearblue digital test |
res.restext | N/A. Data is taken from public side. | Pregnant 1-2 weeks. |
Based on the information, anyone can see that there is a woman in Finland who has used a Clearblue pregnancy test and the result was positive. But there is no way an outsider could connect this information to any particular person, because all information that could be used for linking is located in the private website. However, an authorised person from health case could see the data in the private database and connect Liisa and the test result.
See also
- A previous discussion about the structure
- A previous structure and related discussions
- Previous tasks performed
- A basic query for retrieving the full result of a variable upload (an example)
{{#sql-query: SELECT obj.ident, obj.name, obj.unit, obj.page, obj.wiki_id, comments, mean, sd, n, location, ind.ident, obs, result, restext FROM obj LEFT JOIN actobj ON actobj.obj_id = obj.id LEFT JOIN act ON actobj.act_id = act.id LEFT JOIN cell ON cell.actobj_id = actobj.id LEFT JOIN loccell ON loccell.cell_id = cell.id LEFT JOIN loc on loccell.loc_id = loc.id LEFT JOIN obj AS ind ON loc.obj_id_i = ind.id LEFT JOIN res ON res.cell_id = cell.id WHERE obj.ident = "Op_en1912" AND actobj.series_id = 190 LIMIT 0,100 }}
- Some useful syntax
- http://www.baycongroup.com/sql_join.htm
- Opasnet base connection.ANA for Analytica: for writing and reading variable results into and from the database. Writing requires a password. For SQL used in the model, see the model page.
- Some historical queries
- Some historical queries 2