Marcus Christie created AIRAVATA-2994:
-----------------------------------------

             Summary: Experiment input editors: transformations
                 Key: AIRAVATA-2994
                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2994
             Project: Airavata
          Issue Type: Sub-task
          Components: Django Portal
            Reporter: Marcus Christie
            Assignee: Marcus Christie


Add the ability to add transformations to input editors through input metadata, 
validations (AIRAVATA-2762) and dependencies (AIRAVATA-2761).

 The schema I'm thinking of is
{code}
{
  "editor": {
    "transformations": [
      {
        "type": "regex-replace",
        "value": ["\s+", "", ""]
      },
      ...
    ]
  }
}
{code}

A list of transformations can be specified. They will be applied in order to 
the input value whenever it changes.

The type must be implemented by a Transformation class ([something like how the 
ValidatorFactory 
works|https://github.com/apache/airavata-django-portal/blob/master/django_airavata/apps/api/static/django_airavata_api/js/models/validators/ValidatorFactory.js#L10]).

Example: transform
{noformat}
>101M:A|PDBID|CHAIN|SEQUENCE
MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSHPETLEKFDRVKHLKTEAEMKASEDLKKHGVTVLTALGAILKKK
GHHEAELKPLAQSHATKHKIPIKYLEFISEAIIHVLHSRHPGNFGADAQGAMNKALELFRKDIAAKYKELGYQG
{noformat}

into
{noformat}
MVLSEGEWQLVLHVWAKVEADVAGHGQDILIRLFKSHPETLEKFDRVKHLKTEAEMKASEDLKKHGVTVLTALGAILKKKGHHEAELKPLAQSHATKHKIPIKYLEFISEAIIHVLHSRHPGNFGADAQGAMNKALELFRKDIAAKYKELGYQG
{noformat}

That is, remove the initial header line and remove all newlines.


Other notes:
* transformations should be applied before validations
* need to add a {{transform(value)}} method to InputDataObjectType. transform() 
should apply transformations and return the transformed value. If there are no 
transformations then transform() should just return the given value




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to