GithubHelp home page GithubHelp logo

Comments (2)

ddooley avatar ddooley commented on July 18, 2024 1

Sorry for the somewhat outdated docs, I'll update that shortly. The DataHarmonizer build cycle has changed. Indeed when run in a /web/templates/[schema name]/ folder, linkml.py just produces a schema.json file from an existing schema.yaml file. (This pattern exists in all the template folders.)

This is from a recent correspondence (we have a separate approach with a tabular_to_data.py script but since you already have schema.yaml do this route:

Basic steps:
With a [schema name] of your choice:
Work in /web/templates/[schema name]/

  • Add one almost empty file “export.js” to the same folder. It contains:
// A dictionary of possible export formats
export default {};
  • Assemble 1 schema.yaml file by hand. It should be a merger of what you have for [your schema].yaml and some stuff below.
  • Add one extra little bit specific to DataHarmonizer , namely the “dh_interface” stuff below that signals to DH to show the given class. Below we are using an AMBR class as an example:
classes:
  dh_interface:
    name: dh_interface
    description: A DataHarmonizer interface
    from_schema: https://example.com/AMBR
  AMBR:
    name: AMBR
    description: The AMBR Project, led by the Harrison Lab at the University of Calgary,
      is an interdisciplinary study aimed at using 16S sequencing as part of a culturomics
      platform to identify antibiotic potentiators from the natural products of microbiota.
      The AMBR DataHarmonizer template was designed to standardize contextual data
      associated with the isolate repository from this work.
    is_a: dh_interface
  • You might want to add all the “types: {}” from one of the other specification schema.core.yaml file examples existing in /web/templates, since this allows DH things like the "provenance" slot, but this is not essential.
types:
  WhitespaceMinimizedString:
    name: 'WhitespaceMinimizedString'
    typeof: string
    description: 'A string that has all whitespace trimmed off of beginning and end, and all internal whitespace segments reduced to single spaces. Whitespace includes #x9 (tab), #xA (linefeed), and #xD (carriage return).'
    base: str
    uri: xsd:token
  Provenance:
    name: 'Provenance'
    typeof: string
    description: 'A field containing a DataHarmonizer versioning marker. It is issued by DataHarmonizer when validation is applied to a given row of data.'
    base: str
    uri: xsd:token

then with command prompt in that file’s template folder, run

python3 ../../../script/linkml.py -i schema.yaml

This will generate the schema.json file, it also adds a menu item for your specification by adjusting /web/templates/menu.js.

To test and run go to DH root folder and type (as documented on github main code page):

yarn dev

To build a stand alone set of JS files in /web/dist/

yarn build:web

These can then be zipped or copied separately to wherever you want to make them available.

Let me know if this works or if more info needs to be added to it! Then I'll revise docs.

Thanks!

from dataharmonizer.

cpauvert avatar cpauvert commented on July 18, 2024

Thank you @ddooley for the fast and detailed answer!
It did the trick though maybe a few clarifications could be added:

  • the name of the folder in web/templates is the lower case version of the schema name. E..g for ambrfoo/FoO
  • update the menu.json by changing display: false to display true.
  • (in my case, I had to curate the different classes that were exported and select the one I wanted)
  • go to localhost:8080 after yarn dev (do not try to open the index.html)

I can add them to PR and you can edit from there.
Thank very much!

from dataharmonizer.

Related Issues (20)

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.