From 45834047324c175a8e6bb54e98c514ed567e3cea Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 16:32:35 +0200 Subject: [PATCH] use mkdocs macro --- docs/schema.md | 232 +--------------------- macros/__init__.py | 9 + macros/__pycache__/macros.cpython-311.pyc | Bin 0 -> 3346 bytes macros/__pycache__/main.cpython-311.pyc | Bin 0 -> 1499 bytes macros/macros.py | 93 +++++++++ macros/main.py | 34 ++++ mkdocs.yml | 4 + requirements.txt | 4 +- templates/table.jinja | 13 ++ 9 files changed, 157 insertions(+), 232 deletions(-) create mode 100644 macros/__init__.py create mode 100644 macros/__pycache__/macros.cpython-311.pyc create mode 100644 macros/__pycache__/main.cpython-311.pyc create mode 100644 macros/macros.py create mode 100644 macros/main.py create mode 100644 templates/table.jinja diff --git a/docs/schema.md b/docs/schema.md index b66d0744e..c06ff6dcb 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -84,234 +84,4 @@ different elements of the schema. This section lists the core ReproSchema objects and their allowed properties. - - - -### Protocol -A representation of a study which comprises one or more assessments. - -**URI:** [http://schema.repronim.org/Protocol](http://schema.repronim.org/Protocol) - -| Name | Description | URI | -| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| addProperties | An array of objects to describe the various properties added to assessments and fields. | [http://schema.repronim.org/addProperties](http://schema.repronim.org/addProperties) | -| allow | An array of items indicating properties allowed on an activity or protocol | [http://schema.repronim.org/allow](http://schema.repronim.org/allow) | -| compute | An array of objects indicating computations in an activity or protocol and maps it to the corresponding Field item. scoring logic is a subset of all computations that could be performed and not all computations will be scoring. For example, one may want to do conversion from one unit to another. | [http://schema.repronim.org/compute](http://schema.repronim.org/compute) | -| landingPage | An element (by URL) to point to the protocol readme or landing page. | [http://schema.repronim.org/landingPage](http://schema.repronim.org/landingPage) | -| messages | An array of objects to define conditional messages in an activity or protocol. | [http://schema.repronim.org/messages](http://schema.repronim.org/messages) | -| order | An ordered list to describe the order in which the items of an assessment or protocol appear in the user interface. | [http://schema.repronim.org/order](http://schema.repronim.org/order) | -| overrideProperties | An array of objects to override the various properties added to assessments and fields. | [http://schema.repronim.org/overrideProperties](http://schema.repronim.org/overrideProperties) | -| preamble | The preamble for an assessment | [http://schema.repronim.org/preamble](http://schema.repronim.org/preamble) | -| shuffle | An element (bool) to determine if the list of items is shuffled or in order. | [http://schema.repronim.org/shuffle](http://schema.repronim.org/shuffle) | -| about | The subject matter of the Field. | [http://schema.org/about](http://schema.org/about) | -| audio | An embedded audio object. | [http://schema.org/audio](http://schema.org/audio) | -| description | A description of the item. | [http://schema.org/description](http://schema.org/description) | -| image | An image of the item. This can be a URL or a fully described ImageObject. | [http://schema.org/image](http://schema.org/image) | -| schemaVersion | Indicates (by URL or string) a particular version of a schema used in some CreativeWork. For example, a document could declare a schemaVersion using an URL such as http://schema.org/version/2.0/ if precise indication of schema version was required by some application. | [http://schema.org/schemaVersion](http://schema.org/schemaVersion) | -| version | The version of the CreativeWork embodied by a specified resource. | [http://schema.org/version](http://schema.org/version) | -| video | An embedded video object. | [http://schema.org/video](http://schema.org/video) | -| altLabel | The alternate label. | [http://www.w3.org/2004/02/skos/core#altLabel](http://www.w3.org/2004/02/skos/core#altLabel) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### Activity -An assessment in a protocol. - -**URI:** [http://schema.repronim.org/Activity](http://schema.repronim.org/Activity) - -| Name | Description | URI | -| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| addProperties | An array of objects to describe the various properties added to assessments and fields. | [http://schema.repronim.org/addProperties](http://schema.repronim.org/addProperties) | -| allow | An array of items indicating properties allowed on an activity or protocol | [http://schema.repronim.org/allow](http://schema.repronim.org/allow) | -| compute | An array of objects indicating computations in an activity or protocol and maps it to the corresponding Field item. scoring logic is a subset of all computations that could be performed and not all computations will be scoring. For example, one may want to do conversion from one unit to another. | [http://schema.repronim.org/compute](http://schema.repronim.org/compute) | -| cronTable | None | [http://schema.repronim.org/cronTable](http://schema.repronim.org/cronTable) | -| messages | An array of objects to define conditional messages in an activity or protocol. | [http://schema.repronim.org/messages](http://schema.repronim.org/messages) | -| order | An ordered list to describe the order in which the items of an assessment or protocol appear in the user interface. | [http://schema.repronim.org/order](http://schema.repronim.org/order) | -| overrideProperties | An array of objects to override the various properties added to assessments and fields. | [http://schema.repronim.org/overrideProperties](http://schema.repronim.org/overrideProperties) | -| preamble | The preamble for an assessment | [http://schema.repronim.org/preamble](http://schema.repronim.org/preamble) | -| shuffle | An element (bool) to determine if the list of items is shuffled or in order. | [http://schema.repronim.org/shuffle](http://schema.repronim.org/shuffle) | -| about | The subject matter of the Field. | [http://schema.org/about](http://schema.org/about) | -| audio | An embedded audio object. | [http://schema.org/audio](http://schema.org/audio) | -| citation | A citation or reference to another creative work, such as another publication, web page, scholarly article, etc. | [http://schema.org/citation](http://schema.org/citation) | -| description | A description of the item. | [http://schema.org/description](http://schema.org/description) | -| image | An image of the item. This can be a URL or a fully described ImageObject. | [http://schema.org/image](http://schema.org/image) | -| schemaVersion | Indicates (by URL or string) a particular version of a schema used in some CreativeWork. For example, a document could declare a schemaVersion using an URL such as http://schema.org/version/2.0/ if precise indication of schema version was required by some application. | [http://schema.org/schemaVersion](http://schema.org/schemaVersion) | -| version | The version of the CreativeWork embodied by a specified resource. | [http://schema.org/version](http://schema.org/version) | -| video | An embedded video object. | [http://schema.org/video](http://schema.org/video) | -| altLabel | The alternate label. | [http://www.w3.org/2004/02/skos/core#altLabel](http://www.w3.org/2004/02/skos/core#altLabel) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### Field -An item in an assessment. - -**URI:** [http://schema.repronim.org/Field](http://schema.repronim.org/Field) - -| Name | Description | URI | -| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| additionalNotesObj | A set of objects to define notes in a field. For example, most Redcap and NDA data dictionaries have notes for each item which needs to be captured in reproschema. | [http://schema.repronim.org/additionalNotesObj](http://schema.repronim.org/additionalNotesObj) | -| inputType | An element to describe the input type of a Field item. | [http://schema.repronim.org/inputType](http://schema.repronim.org/inputType) | -| preamble | The preamble for an assessment | [http://schema.repronim.org/preamble](http://schema.repronim.org/preamble) | -| responseOptions | An element (object or by URL)to describe the properties of response of the Field item. | [http://schema.repronim.org/responseOptions](http://schema.repronim.org/responseOptions) | -| about | The subject matter of the Field. | [http://schema.org/about](http://schema.org/about) | -| audio | An embedded audio object. | [http://schema.org/audio](http://schema.org/audio) | -| description | A description of the item. | [http://schema.org/description](http://schema.org/description) | -| image | An image of the item. This can be a URL or a fully described ImageObject. | [http://schema.org/image](http://schema.org/image) | -| isPartOf | Indicates an item or CreativeWork that this item, or CreativeWork (in some sense), is part of. | [http://schema.org/isPartOf](http://schema.org/isPartOf) | -| question | A sub property of object. A question. | [http://schema.org/question](http://schema.org/question) | -| readonlyValue | Whether or not a property is mutable. Default is false. Specifying this for a property that also has a value makes it act similar to a "hidden" input in an HTML form. | [http://schema.org/readonlyValue](http://schema.org/readonlyValue) | -| schemaVersion | Indicates (by URL or string) a particular version of a schema used in some CreativeWork. For example, a document could declare a schemaVersion using an URL such as http://schema.org/version/2.0/ if precise indication of schema version was required by some application. | [http://schema.org/schemaVersion](http://schema.org/schemaVersion) | -| version | The version of the CreativeWork embodied by a specified resource. | [http://schema.org/version](http://schema.org/version) | -| video | An embedded video object. | [http://schema.org/video](http://schema.org/video) | -| altLabel | The alternate label. | [http://www.w3.org/2004/02/skos/core#altLabel](http://www.w3.org/2004/02/skos/core#altLabel) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### AdditionalProperty -An object to describe the various properties added to assessments and fields. - -**URI:** [http://schema.repronim.org/AdditionalProperty](http://schema.repronim.org/AdditionalProperty) - -| Name | Description | URI | -| -------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| allow | An array of items indicating properties allowed on an activity or protocol | [http://schema.repronim.org/allow](http://schema.repronim.org/allow) | -| isAbout | A pointer to the node describing the item. | [http://schema.repronim.org/isAbout](http://schema.repronim.org/isAbout) | -| isVis | An element to describe (by boolean or conditional statement) visibility conditions of items in an assessment. | [http://schema.repronim.org/isVis](http://schema.repronim.org/isVis) | -| limit | An element to limit the duration (uses ISO 8601) this activity is allowed to be completed by once activity is available. | [http://schema.repronim.org/limit](http://schema.repronim.org/limit) | -| maxRetakes | Defines number of times the item is allowed to be redone. | [http://schema.repronim.org/maxRetakes](http://schema.repronim.org/maxRetakes) | -| randomMaxDelay | Present activity/item within some random offset of activity available time up to the maximum specified by this ISO 8601 duration | [http://schema.repronim.org/randomMaxDelay](http://schema.repronim.org/randomMaxDelay) | -| schedule | An element to set make activity available/repeat info using ISO 8601 repeating interval format. | [http://schema.repronim.org/schedule](http://schema.repronim.org/schedule) | -| variableName | The name used to represent an item. | [http://schema.repronim.org/variableName](http://schema.repronim.org/variableName) | -| valueRequired | Whether the property must be filled in to complete the action. Default is false. | [http://schema.org/valueRequired](http://schema.org/valueRequired) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### OverrideProperty -An object to override the various properties added to assessments and fields. - -**URI:** [http://schema.repronim.org/OverrideProperty](http://schema.repronim.org/OverrideProperty) - -| Name | Description | URI | -| -------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| isAbout | A pointer to the node describing the item. | [http://schema.repronim.org/isAbout](http://schema.repronim.org/isAbout) | -| isVis | An element to describe (by boolean or conditional statement) visibility conditions of items in an assessment. | [http://schema.repronim.org/isVis](http://schema.repronim.org/isVis) | -| limit | An element to limit the duration (uses ISO 8601) this activity is allowed to be completed by once activity is available. | [http://schema.repronim.org/limit](http://schema.repronim.org/limit) | -| maxRetakes | Defines number of times the item is allowed to be redone. | [http://schema.repronim.org/maxRetakes](http://schema.repronim.org/maxRetakes) | -| randomMaxDelay | Present activity/item within some random offset of activity available time up to the maximum specified by this ISO 8601 duration | [http://schema.repronim.org/randomMaxDelay](http://schema.repronim.org/randomMaxDelay) | -| schedule | An element to set make activity available/repeat info using ISO 8601 repeating interval format. | [http://schema.repronim.org/schedule](http://schema.repronim.org/schedule) | -| variableName | The name used to represent an item. | [http://schema.repronim.org/variableName](http://schema.repronim.org/variableName) | -| valueRequired | Whether the property must be filled in to complete the action. Default is false. | [http://schema.org/valueRequired](http://schema.org/valueRequired) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### UnitOption -An object to represent a human displayable name alongside the more formal value for units. - -**URI:** [http://schema.repronim.org/UnitOption](http://schema.repronim.org/UnitOption) - -| Name | Description | URI | -| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| value | The value for each option in choices or in additionalNotesObj | [http://schema.repronim.org/value](http://schema.repronim.org/value) | -| prefLabel | The preferred label. | [http://www.w3.org/2004/02/skos/core#prefLabel](http://www.w3.org/2004/02/skos/core#prefLabel) | - -### ResponseOption -An element (object or by URL)to describe the properties of response of the Field item. - -**URI:** [http://schema.repronim.org/ResponseOption](http://schema.repronim.org/ResponseOption) - -| Name | Description | URI | -| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| choices | An array to list the available options for response of the Field item. | [http://schema.repronim.org/choices](http://schema.repronim.org/choices) | -| datumType | Indicates what type of datum the response is (e.g. range,count,scalar etc.) for the Field item. | [http://schema.repronim.org/datumType](http://schema.repronim.org/datumType) | -| multipleChoice | Indicates (by bool) if response for the Field item has one or more answer. | [http://schema.repronim.org/multipleChoice](http://schema.repronim.org/multipleChoice) | -| unitOptions | A list of objects to represent a human displayable name alongside the more formal value for units. | [http://schema.repronim.org/unitOptions](http://schema.repronim.org/unitOptions) | -| valueType | The type of the response of an item. For example, string, integer, etc. | [http://schema.repronim.org/valueType](http://schema.repronim.org/valueType) | -| maxValue | The upper value of some characteristic or property. | [http://schema.org/maxValue](http://schema.org/maxValue) | -| minValue | The lower value of some characteristic or property. | [http://schema.org/minValue](http://schema.org/minValue) | -| unitCode | The unit of measurement given using the UN/CEFACT Common Code (3 characters) or a URL. Other codes than the UN/CEFACT Common Code may be used with a prefix followed by a colon. | [http://schema.org/unitCode](http://schema.org/unitCode) | - -### Choice -An object to describe a response option. - -**URI:** [http://schema.repronim.org/Choice](http://schema.repronim.org/Choice) - -| Name | Description | URI | -| ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| value | The value for each option in choices or in additionalNotesObj | [http://schema.repronim.org/value](http://schema.repronim.org/value) | -| image | An image of the item. This can be a URL or a fully described ImageObject. | [http://schema.org/image](http://schema.org/image) | -| name | The name of the item. | [http://schema.org/name](http://schema.org/name) | - -### ComputeSpecification -An object to define computations in an activity or protocol. - -**URI:** [http://schema.repronim.org/ComputeSpecification](http://schema.repronim.org/ComputeSpecification) - -| Name | Description | URI | -| ------------ | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| jsExpression | A JavaScript expression to compute a score from other variables. | [http://schema.repronim.org/jsExpression](http://schema.repronim.org/jsExpression) | -| variableName | The name used to represent an item. | [http://schema.repronim.org/variableName](http://schema.repronim.org/variableName) | - -### MessageSpecification -An object to define messages in an activity or protocol. - -**URI:** [http://schema.repronim.org/MessageSpecification](http://schema.repronim.org/MessageSpecification) - -| Name | Description | URI | -| ------------ | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| jsExpression | A JavaScript expression to compute a score from other variables. | [http://schema.repronim.org/jsExpression](http://schema.repronim.org/jsExpression) | -| message | The message to be conditionally displayed for an item. | [http://schema.repronim.org/message](http://schema.repronim.org/message) | - -### AdditionalNoteObj -A set of objects to define notes in a field. For example, most Redcap and NDA data dictionaries have notes for each item which needs to be captured in reproschema - -**URI:** [http://schema.repronim.org/AdditionalNoteObj](http://schema.repronim.org/AdditionalNoteObj) - -| Name | Description | URI | -| ------ | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| column | An element to define the column name where the note was taken from. | [http://schema.repronim.org/column](http://schema.repronim.org/column) | -| source | An element to define the source (eg. RedCap, NDA) where the note was taken from. | [http://schema.repronim.org/source](http://schema.repronim.org/source) | -| value | The value for each option in choices or in additionalNotesObj | [http://schema.repronim.org/value](http://schema.repronim.org/value) | - -### ResponseActivity -Captures information about some action that took place. It also links to information (entities) that were used during the activity - -**URI:** [http://schema.repronim.org/ResponseActivity](http://schema.repronim.org/ResponseActivity) - -| Name | Description | URI | -| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | -| endedAtTime | None | [http://www.w3.org/ns/prov#endedAtTime](http://www.w3.org/ns/prov#endedAtTime) | -| generated | None | [http://www.w3.org/ns/prov#generated](http://www.w3.org/ns/prov#generated) | -| startedAtTime | None | [http://www.w3.org/ns/prov#startedAtTime](http://www.w3.org/ns/prov#startedAtTime) | -| used | None | [http://www.w3.org/ns/prov#used](http://www.w3.org/ns/prov#used) | -| wasAssociatedWith | None | [http://www.w3.org/ns/prov#wasAssociatedWith](http://www.w3.org/ns/prov#wasAssociatedWith) | -| inLanguage | The language of the content or performance or used in an action. Please use one of the language codes from the [IETF BCP 47 standard](http://tools.ietf.org/html/bcp47). See also [[availableLanguage]]. | [http://schema.org/inLanguage](http://schema.org/inLanguage) | - -### Response -Describes the response of an item. - -**URI:** [http://schema.repronim.org/Response](http://schema.repronim.org/Response) - -| Name | Description | URI | -| --------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| wasAttributedTo | None | [http://www.w3.org/ns/prov#wasAttributedTo](http://www.w3.org/ns/prov#wasAttributedTo) | -| isAbout | A pointer to the node describing the item. | [http://schema.repronim.org/isAbout](http://schema.repronim.org/isAbout) | -| value | The value for each option in choices or in additionalNotesObj | [http://schema.repronim.org/value](http://schema.repronim.org/value) | - -### Participant -An Agent describing characteristics associated with a participant. - -**URI:** [http://schema.repronim.org/Participant](http://schema.repronim.org/Participant) - -| Name | Description | URI | -| ---------- | ------------------------------- | -------------------------------------------------------------------------------- | -| subject_id | The identifier of a participant | [http://purl.org/nidash/nidm#subject_id](http://purl.org/nidash/nidm#subject_id) | - -### SoftwareAgent -Captures information about some action that took place. It also links to information (entities) that were used during the activity - -**URI:** [http://schema.repronim.org/SoftwareAgent](http://schema.repronim.org/SoftwareAgent) - -| Name | Description | URI | -| ------- | ----------------------------------------------------------------- | ------------------------------------------------------ | -| url | URL of the item. | [http://schema.org/url](http://schema.org/url) | -| version | The version of the CreativeWork embodied by a specified resource. | [http://schema.org/version](http://schema.org/version) | +{{ MACROS___schema_table() }} diff --git a/macros/__init__.py b/macros/__init__.py new file mode 100644 index 000000000..54d2a4748 --- /dev/null +++ b/macros/__init__.py @@ -0,0 +1,9 @@ +from .macros import ( + schema_table, +) +from .main import define_env + +__all__ = [ + "define_env", + "schema_table", +] diff --git a/macros/__pycache__/macros.cpython-311.pyc b/macros/__pycache__/macros.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0739b4854510f7495452af925c6a3d1894b7fc40 GIT binary patch literal 3346 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 WIQ`YNhu4bsui-@OF<{&O@&5tlDmgX) literal 0 HcmV?d00001 diff --git a/macros/__pycache__/main.cpython-311.pyc b/macros/__pycache__/main.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d56fabacc4953a07fdc5b5f32645b6fe070f33b GIT binary patch literal 1499 zcmaJ>&1)Pt6xYn`mnUn76iR}dHeyd*@W-VmQwp(7LLjz7)6-ri+L6{Pdq!F$O=pP$QMt$s@jKFz@DC!{UQ9toIo}2xS&%8a@Rg4#viC3OyGOFb_6MrV7 zHd!sttp3tN=oS2m@u8^GV15bH++|3)EhF3BX+gM}DVyTFM6S%-F%6eR|h>6>uw_BJfhGUW>q?<6PrDV3-mzl9; z!`ZS#P?xPTv8tG$OhLf|Zu$;Fx=&>cEhX8mJtQTulDf4LzP0RZ$5VnKvX^PE_T&nf zXXq|^0rUIA_@`@oQ=fV-!GAT4fnZB%K%T=9o31r{n<#Gk(M!0%fi3nPPYhGQ>6o+v z@$xvM01mWa7&nL_DYMxwT%HaW0&{o`ugUJ-+O1;u%6Rvd>-vV{;Fim^)h-JRxhyu8 z{)0Y`fiVfbTPg}Hl`)sVj`3_u!%9$G<<_*z;u5V6D0eqb)FIpn=p&ZG5Dp5kF99}J zQdnV~o>r7{AX-+3WFi(IsW%qTl7$NzN~~5$LFpKnYZ#M+6U{VEGi|UoM43Vtt*y%& zU+>(EqNwH0$v>Vh=(x{P5*d3<+wCB)ItY2Kpd)XV-?zOy0Pxys2)|oe?aP#b0#m-a z3+l_d;157-uHtG@046S028Vfgs&-{RN9W+Dm%$vN(PyaIcyR6BwZ9t+!^S7CKmFq0 zz^~T+LtsX;<^(pNb~CR>5vV+ha$o8^(1$v&42bFHb<)+&sq9HE@;c>8fPnHw6oKj( zY?zBBWs%FNk--4|KFWTN9Hw89I%9qNL3!8sGLm>Ja6Pzy~+q# zvw*ztXwE)=q43B(Z<-5_uRhs%wDZIIPgkE`|MB`SAN_v*k4wK@`t!nZdwtkmKfbsz uytr}P+#EJH?Y`iC Environment: + return Environment( + loader=FileSystemLoader(TEMPLATES_DIR), + autoescape=select_autoescape(), + lstrip_blocks=True, + trim_blocks=True, + ) + + +def schema_table() -> str: + + target_classes = [ + "Protocol", + "Activity", + "Item", + "AdditionalProperty", + "OverrideProperty", + "UnitOption", + "ResponseOption", + "Choice", + "ComputeSpecification", + "MessageSpecification", + "AdditionalNoteObj", + "ResponseActivity", + "Response", + "Participant", + "SoftwareAgent", + ] + + input_file = SCHEMA_DIR / "reproschema.yaml" + + reproschema = yaml.load(input_file) + + env = return_jinja_env() + template = env.get_template("table.jinja") + + content = [] + for this_class in target_classes: + + class_dict = reproschema["classes"][this_class] + class_dict["uri"] = class_dict["class_uri"].replace("reproschema:", reproschema["id"]) + + slots = [] + for this_slot in class_dict["slots"]: + + slot_dict = reproschema["slots"][this_slot] + + slot_dict["name"] = this_slot + + if "title" not in slot_dict: + slot_dict["title"] = "**TODO**" + if "description" not in slot_dict: + slot_dict["description"] = "**TODO**" + + prefix = slot_dict["slot_uri"].split(":")[0] + value = reproschema["id"] + if prefix in reproschema["prefixes"]: + value = reproschema["prefixes"][prefix] + + slot_dict ["uri"] = slot_dict["slot_uri"].replace(f"{prefix}:", value) + + slots.append(slot_dict) + + class_dict["slots"] = slots + + content.append(template.render(this_class=class_dict)) + + return "\n".join(content) + + +def main(): + print(schema_table()) + + +if __name__ == "__main__": + main() diff --git a/macros/main.py b/macros/main.py new file mode 100644 index 000000000..0c9ebd00f --- /dev/null +++ b/macros/main.py @@ -0,0 +1,34 @@ +"""This package is used to build elements from data into +MarkDown format for the specification text. + +Functions decorated in "define_env()" are callable throughout the +specification and are run/rendered with the mkdocs plugin "macros". +""" + +import os +import sys + +code_path = os.path.abspath(os.path.join(os.path.dirname(__file__))) +sys.path.append(code_path) + +import macros # noqa E402 + + +def define_env(env): + """Define variables, macros and filters for the mkdocs-macros plugin. + + Parameters + ---------- + env : :obj:`macros.plugin.MacrosPlugin` + An object in which to inject macros, variables, and filters. + + Notes + ----- + "variables" are the dictionary that contains the environment variables + "macro" is a decorator function, to declare a macro. + + Macro aliases must start with "MACROS___" + """ + env.macro( + macros.schema_table, "MACROS___schema_table" + ) diff --git a/mkdocs.yml b/mkdocs.yml index 5721e4d33..1652a508a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -75,12 +75,16 @@ markdown_extensions: - pymdownx.snippets: auto_append: - includes/abbreviations.md + - tables - toc: anchorlink: true watch: - includes + - linkml-schema plugins: - search - tags + - macros: + module_name: macros/main \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a9afbecb6..238eb6d8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ -rdflib==5.0.0 +mkdocs-macros-plugin mkdocs-material pymdown-extensions +rdflib==5.0.0 +ruamel.yaml \ No newline at end of file diff --git a/templates/table.jinja b/templates/table.jinja new file mode 100644 index 000000000..9012dbd68 --- /dev/null +++ b/templates/table.jinja @@ -0,0 +1,13 @@ + + +### {{ this_class.title }} + +{{ this_class.description }} + +URI: [{{ this_class.uri }}]({{ this_class.uri }}) + +| Property | Title | Description | URI | +| :------- | :---- | :---------- | :-- | +{% for slot in this_class.slots %} +| {{ slot.name }} | {{ slot.title }} | {{ slot.description }} | [{{ slot.uri }}]({{ slot.uri }}) | +{% endfor %} \ No newline at end of file