Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
opal rest /datasources --opal httphttps://opal-demo.obiba.org:8080 --user administrator --password password --json

...


where the URL is changed to your install location and the 'administrator/password' bits are changed accordingly. Assuming you get something sensible back you have installed the opal client correctly and know all your credentials!

...

Once you have a project you want to add a table to it. The first step is to make a JSON file and save it as e.g. my_table.json. The entityType seems to be entirely arbitrary, so call it something relevant to you. 


Code Block
{'entityType': 'Book', 'name': 'Hamlet'}

Now we can push this JSON file into the opal. 


Code Block
opal rest -o http://opal_url --user administrator --password password -m POST -ct "application/json" /datasource/my_project/tables < my_table.json

...

The table will not have any variables associated with it at this stage. We can add them in a similar way to above, first off build a JSON file and save it as e.g. my_variables.json 


Code Block
[
	{
        "name": "content",
        "entityType": "Book",
        "valueType": "text",
        "isRepeatable": False,
        "index": 1,
    },  
    {
        "name": "clean_content",
        "entityType": "Book",
        "valueType": "text",
        "isRepeatable": False,
        "index": 2,
    }
]

...


Here name is the variable name, entityType matches that defined in the table above, valueType is what the variable actually is (allowed types are: text/integer/decimal/.....), isRepeatable is ??? and index is the order the columns are displayed in.

...

Code Block
    opal rest -o http://opal_address --user administrator --password password -m POST -ct "application/json" /datasource/my_project/table/hamlet/variables < my_variables.json

...


Variables can have quite complex definitions - attributes, categories etc can be added to them, see e.g. below.  


Code Block
[
    {
        "name": "VAR1",
        "entityType": "Participant",
        "valueType": "text",
        "unit": "",
        "isRepeatable": false,
        "referencedEntityType": "",
        "mimeType": "",
        "occurrenceGroup": "",
        "index": 1,
        "attributes": [
            {
                "name": "label",
                "value": "Which language do you speak?",
                "locale": "en"
            },
            {
                "name": "label",
                "value": "Quelles langues parlez-vous?",
                "locale": "fr"
            }
        ]
    },
    {
        "name": "VAR2",
        "entityType": "Participant",
        "valueType": "integer",
        "mimeType": "",
        "isRepeatable": false,
        "occurrenceGroup": "",
        "unit": "",
        "referencedEntityType": "",
        "index": 2,
        "attributes": [
            {
                "name": "label",
                "value": "Do you like that?"
            }
        ],
        "categories": [
            {
                "name": "1",
                "isMissing": false,
                "attributes": [
                    {
                        "name": "label",
                        "value": "yes"
                    }
                ]
            },
            {
                "name": "2",
                "isMissing": false,
                "attributes": [
                    {
                        "name": "label",
                        "value": "no"
                    }
                ]
            },
            {
                "name": "9",
                "isMissing": true,
                "attributes": [
                    {
                        "name": "label",
                        "value": "do not know"
                    }
                ]
            }
        ]
    }
]

...


Adding some data

Now to import some data. The general work flow here is to make a CSV file elsewhere, upload it to opal, then tell opal to use the uploaded file.

...

Opal may take a few minutes to process all the data, it also will try to index it too. You can follow the process from the web interface.