Git Product home page Git Product logo

cedar-artifact-library's People

Contributors

egyedia avatar jkyu avatar martinjoconnor avatar yancao77 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cedar-artifact-library's Issues

No way to get property associations for enclosed fields or elements

If fields or elements inside templates or elements have property associations, there is no way to retrieve the property IRIs.

The IRIs are enclosed inside the JSON Schema specification for the instance @context.

e.g., if a Study template has a Study ID field with a property association http://semantic-dicom.org/dcm#StudyID the JSON Schema for the template will look as follows:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "title": "Study template schema",
  "description": "Study template schema generated by the CEDAR Template Editor 2.6.19",
  "properties": {
    "@context": {
        "type": "object",
        ....
        "Study ID": {
          "enum": [
            "http://semantic-dicom.org/dcm#StudyID"
          ]
        }
      },
      "required": [... ],
      "additionalProperties": false
    },

Support YAML artifact import

This library currently supports YAML as an export format for artifacts.

Add support for YAML import of artifacts.

CamelCase Acronyms/Abbreviations (Minor Style Issue)

Consider this before the library gets wider use. Obviously there's some element of personal taste here,

Some of the method names contain acronyms or abbreviations, for example, getJsonLDID, that are akward to read but moreover, modern style guides (e.g. the Google one) in essence say acronyms should be CamelCased. So, consider CamelCasing these, for example, getJsonLdId.

FWIW, a few years ago I would name things OWLClass or IRI but now I'd use OwlClass and Iri after falling into line with wider community guidelines.

Java vs. TypeScript String Rendering Escaping Issues

There are a few cases where strings are escaped differently by the current Java and TypeScript libraries.

template-008
DIFF: regex escaping
template-023
DIFF: Java escapes >2,3,6-trichlorotoluene< as "2,3,6-trichlorotoluene"
template-029
DIFF: multiline content in several places
DIFF: Java escapes >no< as "no"

Carried over from cedar-artifact-library#21

Parsing of value constraints fails due to `numTerms` attribute being required

The JSON below fails to parse because the parse is looking for an attribute called numTerms. Not sure what this is.

{
  "_valueConstraints": {
    "requiredValue": false,
    "multipleChoice": false,
    "classes": [],
    "branches": [],
    "ontologies": [
      {
        "uri": "https://bioportal.bioontology.org/ontologies/MESH",
        "acronym": "MESH",
        "name": "MESH"
      }
    ],
    "literals": []
  }
}

YAML serialization completion

The following list from Atti details the outstanding renderings to be implemented to complete the YAML serialization of schema artifacts:

     Template header and footer are missing . See template-007. I am using:
                modelVersion: 1.6.0
                header: Template header
                footer: Template footer
                createdOn: 2024-02-29T14:25:48-08:00
 
     Static fields are not serialized properly, or at all. See template-004, template-009
 
     Regex not serialized for text fields. See template-008
 
     Provenance not serialized. Any template. I am using:
                createdOn: 2024-03-11T15:26:26-07:00
                createdBy: https://metadatacenter.org/users/c7dcc3ca-55fe-4ca8-b448-ab110bfe4c95
                lastUpdatedOn: 2024-03-11T15:26:26-07:00
                modifiedBy: https://metadatacenter.org/users/c7dcc3ca-55fe-4ca8-b448-ab110bfe4c95
 
     Annotations not serialized. see template-027
                annotations:
                  - name: https://datacite.com/doi
                    type: id
                    value: https://doi.org/10.82658/8vc1-qf27
 
           or see field-001
                annotations:
                  - name: https://datacite.com/doi
                    type: id
                    value: https://doi.org/10.82658/8vc1-abcd
                  - name: foo
                    type: value
                    value: bar
 
 
 
     If the child name in properties is different than the schema:name, only the child name is used in yaml.
           See template-26.
           I added "key" as the first attribute. Then we have name. And altLabel
           Name and key should be equal.
           But they are not always
                children:
                  - key: _text_field_
                    type: templateField
                    id: https://repo.metadatacenter.org/template-fields/9efde92f-63b9-427f-b071-36ea57de1b7e
                    name: Textfield
                    description: Help Text
                    modelVersion: 1.6.0
                    inputType: textfield
                    datatype: xsd:string
 
 
     timeFormat: 12h is serialized, even if it is not in the JSON. See template-010
                the field "Simple date" does not have inputTimeFormat in the source json (only 2 occurrences) but the resulting YAML has 3
 
     checkbox currently has these. Do we need them? see template-018
               multiple: true
               minItems: 1
               multipleChoice: true
           for checkbox, these values are always like this.
 
     list: if it is not multiple choice, it does not say it in the YAML. The json says that template-019
           maybe, just for clarity, it should say
                multipleChoice: true
 
     list: if it is multiple, it says so in the JSON and the YAML, this is ok. See template-020
           plus also specifies
                         multiple: true
                         minItems: 1
           are these needed?
 
     attribute-value See template-022. Do we need to say these?
               multiple: true
               minItems: 0

Provide abstraction for different UI objects

The different UI objects, ElementUI, TemplateUI, FieldUI have similar methods, but no common abstraction so I have to do instance checks and then casts to call methods. For example, when getting property order (TemplateUI and ElementUI) I cannot just call a getOrder method on the UI object.

Provide a common method for getting child artifacts

Often I just want to get all chid artifacts of any given artifact. I typically do this for building a tree of a template. It would be convenient if there was a method (on Artifact) call getChildArtifacts (or something similar) that returns a List<Artifact>.

At the moment, I do something like this:

private List<SchemaArtifact> getChildren(SchemaArtifact schemaArtifact) {
        var result = new ArrayList<SchemaArtifact>();
        if(schemaArtifact instanceof TemplateSchemaArtifact tsa) {
            result.addAll(tsa.getElementSchemas().values());
            result.addAll(tsa.getFieldSchemas().values());
        }
        else if(schemaArtifact instanceof ElementSchemaArtifact esa) {
            result.addAll(esa.getElementSchemas().values());
            result.addAll(esa.getFieldSchemas().values());
        }
        return result;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.