def datajoint_dot(): from bokeh.models import Div from bokeh.layouts import layout from bokeh.models.widgets import Panel subject = dj.create_virtual_module('subject', 'u19_subject') action = dj.create_virtual_module('action', 'u19_action') acquisition = dj.create_virtual_module('acquisition', 'u19_acquisition') try: svg = (dj.Diagram(subject) + dj.Diagram(action) + dj.Diagram(acquisition)).make_dot().create_svg() div = Div(text='<object data={0}'.format(svg.decode('utf-8'))) # for some reason div can handle incomplete tags, completing is has artifact. except: print( 'Could not get diagram, did you install graphviz and pydotplus??') div = Div(text='installation not complete') return Panel(child=layout([div]), title='Overview')
def print_erd(): schema = start_connection() # dj.ERD(schema).draw() dj.Diagram(schema).draw() plt.show()
# - # ## Workflow architecture # # This workflow is assembled from 4 DataJoint elements: # + [element-lab](https://github.com/datajoint/element-lab) # + [element-animal](https://github.com/datajoint/element-animal) # + [element-session](https://github.com/datajoint/element-session) # + [element-calcium-imaging](https://github.com/datajoint/element-calcium-imaging) # # For the architecture and detailed descriptions for each of those elements, please visit the respective links. # # Below is the diagram describing the core components of the fully assembled pipeline. # dj.Diagram(imaging) + dj.Diagram(scan) + (dj.Diagram(session.Session) + 1) - 1 # ## Browsing the data with DataJoint `query` and `fetch` # # + DataJoint provides functions to query data and fetch. For a detailed tutorials, visit our [general tutorial site](https://playground.datajoint.io/). # # + Running through the pipeline, we have ingested data of subject3 into the database. # # + Here are some highlights of the important tables. # # ### `subject.Subject` and `session.Session` tables subject.Subject() session.Session()
# + The first time importing the modules, empty schemas and tables will be created in the database. [markdown] # # + By importing the modules for the first time, the schemas and tables will be created inside the database. # # # + Once created, importing modules will not create schemas and tables again, but the existing schemas/tables can be accessed and manipulated by the modules. # + The schemas and tables will not be re-created when importing modules if they have existed. [markdown] # ## DataJoint tools to explore schemas and tables # # # + `dj.list_schemas()`: list all schemas a user has access to in the current database # + `dj.list_schemas()`: list all schemas a user could access. dj.list_schemas() # + `dj.Diagram()`: plot tables and dependencies in a schema. # + `dj.Diagram()`: plot tables and dependencies # plot diagram for all tables in a schema dj.Diagram(imaging) # - # **Table tiers**: # # Manual table: green box, manually inserted table, expect new entries daily, e.g. Subject, ProbeInsertion. # Lookup table: gray box, pre inserted table, commonly used for general facts or parameters. e.g. Strain, ClusteringMethod, ClusteringParamSet. # Imported table: blue oval, auto-processing table, the processing depends on the importing of external files. e.g. process of Clustering requires output files from kilosort2. # Computed table: red circle, auto-processing table, the processing does not depend on files external to the database, commonly used for # Part table: plain text, as an appendix to the master table, all the part entries of a given master entry represent a intact set of the master entry. e.g. Unit of a CuratedClustering. # # **Dependencies**: # # One-to-one primary: thick solid line, share the exact same primary key, meaning the child table inherits all the primary key fields from the parent table as its own primary key. # One-to-many primary: thin solid line, inherit the primary key from the parent table, but have additional field(s) as part of the primary key as well # secondary dependency: dashed line, the child table inherits the primary key fields from parent table as its own secondary attribute.