MoseleyBioinformaticsLab / MESSES

MESSES (Metadata from Experimental SpreadSheets Extraction System) is a Python package that facilitates the conversion of tabular data into other formats.
https://moseleybioinformaticslab.github.io/MESSES/
Other
0 stars 0 forks source link

Passing Calling Record Information #28

Open ptth222 opened 1 year ago

ptth222 commented 1 year ago

This kind of goes along with nested directives, but I wanted it to have its own issue. Basically, when a nested directive is called you usually want to pass the record information that the calling directive was on when it called the nested directive. For example, if you have a directive that is looping over sample records and creating a dictionary based on the data in the sample records and it calls another directive to fill in a header value, you want that nested directive to have immediate access to the sample record's information. I have already exposed this in the code, but I think you had an issue with my initial syntax. My suggestion was to use the '^' character to indicate that you want the field from the record that called the directive. For example:

"studies%factors": {
    "no_id_needed": {
        "value_type": "section_matrix",
        "required": "True",
        "test": "study.id=^id",
        "headers": [
          "\"@id\"=\"#factor/\"id",
          "\"factorName\"=id",
          "\"factorType\"=/studies%factor%type",
          "\"comments\"=/studies%factors%comments"
        ],
        "table": "factor"
        }
    }

The "^id" in "study.id=^id" for the "test" field would indicate to fill that in with the record's "id" value. You suggested '$' instead of '^' to help avoid confusion with regex, but '$' is also a regex character. Also there are no regexes in the directives currently, and if they were added I would expect them to have a similar syntax as what's in the modification tags, i.e r"...". I really like the caret because it is often used to indicate something above, like it's pointing up, and in this case it would be like pointing up the call stack.

What's the final opinion on the syntax?

hunter-moseley commented 1 year ago

Maybe it is better to use ^.id. A "^." better identifies this as a part of something else. There may be possibilities of specifying something like "^.name.first" or the like.

On Thu, Jun 22, 2023 at 6:58 PM ptth222 @.***> wrote:

This kind of goes along with nested directives, but I wanted it to have its own issue. Basically, when a nested directive is called you usually want to pass the record information that the calling directive was on when it called the nested directive. For example, if you have a directive that is looping over sample records and creating a dictionary based on the data in the sample records and it calls another directive to fill in a header value, you want that nested directive to have immediate access to the sample record's information. I have already exposed this in the code, but I think you had an issue with my initial syntax. My suggestion was to use the '^' character to indicate that you want the field from the record that called the directive. For example:

"studies%factors": { "no_id_needed": { "value_type": "section_matrix", "required": "True", "test": "study.id=^id", "headers": [ @.***\"=\"#factor/\"id", "\"factorName\"=id", "\"factorType\"=/studies%factor%type", "\"comments\"=/studies%factors%comments" ], "table": "factor" } }

The "^id" in "study.id=^id" for the "test" field would indicate to fill that in with the record's "id" value. You suggested '$' instead of '^' to help avoid confusion with regex, but '$' is also a regex character. Also there are no regexes in the directives currently, and if they were added I would expect them to have a similar syntax as what's in the modification tags, i.e r"...". I really like the caret because it is often used to indicate something above, like it's pointing up, and in this case it would be like pointing up the call stack.

What's the final opinion on the syntax?

— Reply to this email directly, view it on GitHub https://github.com/MoseleyBioinformaticsLab/MESSES/issues/28, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEP7B5BA3W3YZ32CHS4VQLXMTEYNANCNFSM6AAAAAAZQ22CYU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Hunter Moseley, Ph.D. -- Univ. of Kentucky Professor, Dept. of Molec. & Cell. Biochemistry / Markey Cancer Center / Institute for Biomedical Informatics / UK Superfund Research Center Not just a scientist, but a fencer as well. My foil is sharp, but my mind sharper still.

Email: @. (work) @. (personal) Phone: 859-218-2964 (office) 859-218-2965 (lab) 859-257-7715 (fax) Web: http://bioinformatics.cesb.uky.edu/ Address: CC434 Roach Building, 800 Rose Street, Lexington, KY 40536-0093