From 398e7f9f2abfdafbb2cae8e8df905d4ab51795c2 Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Fri, 22 Mar 2024 16:33:57 -0700 Subject: [PATCH] kwalify importer (#136) * Kwalify importer * test-files * Fixed test --- docs/packages/importers.rst | 9 + poetry.lock | 59 +- pyproject.toml | 1 + schema_automator/cli.py | 26 + .../infer_model_from_rdftab.py | 0 .../importers/cadsr_import_engine.py | 118 +- .../importers/jsonschema_import_engine.py | 26 +- .../importers/kwalify_import_engine.py | 109 + .../importers/rdfs_import_engine.py | 28 +- tests/resources/cadsr-cde-217609.json | 0 tests/resources/cadsr-cde-996.json | 742 ++++- tests/resources/cadsr-swagger.json | 2570 +++++++++-------- tests/resources/test.kwalify.yaml | 71 + tests/resources/test2.kwalify.yaml | 149 + tests/test_importers/test_cadsr_importer.py | 11 +- tests/test_importers/test_kwalify_importer.py | 53 + 16 files changed, 2721 insertions(+), 1251 deletions(-) rename schema_automator/{importers => generalizers}/infer_model_from_rdftab.py (100%) create mode 100644 schema_automator/importers/kwalify_import_engine.py delete mode 100644 tests/resources/cadsr-cde-217609.json create mode 100644 tests/resources/test.kwalify.yaml create mode 100644 tests/resources/test2.kwalify.yaml create mode 100644 tests/test_importers/test_kwalify_importer.py diff --git a/docs/packages/importers.rst b/docs/packages/importers.rst index 1c48fc8..64548ff 100644 --- a/docs/packages/importers.rst +++ b/docs/packages/importers.rst @@ -23,6 +23,15 @@ The ``import-json-schema`` command can be used: schemauto import-json-schema tests/resources/model_card.schema.json +Importing from Kwalify +--------- + +The ``import-kwalify`` command can be used: + +.. code-block:: + + schemauto import-kwalify tests/resources/test.kwalify.yaml + Importing from OWL --------- diff --git a/poetry.lock b/poetry.lock index 34cffab..7b87a86 100644 --- a/poetry.lock +++ b/poetry.lock @@ -836,6 +836,63 @@ files = [ {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"}, ] +[[package]] +name = "duckdb" +version = "0.10.1" +description = "DuckDB in-process database" +category = "main" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "duckdb-0.10.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:0ac172788e3d8e410e009e3699016a4d7f17b4c7cde20f98856fca1fea79d247"}, + {file = "duckdb-0.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f754c20d3b963574da58b0d22029681b79c63f2e32060f10b687f41b7bba54d7"}, + {file = "duckdb-0.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6c68b1ef88b8cce185381ec69f437d20059c30623375bab41ac07a1104acdb57"}, + {file = "duckdb-0.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f566f615278844ea240c9a3497c0ef201331628f78e0f9f4d64f72f82210e750"}, + {file = "duckdb-0.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67d2996c3372a0f7d8f41f1c49e00ecdb26f83cdd9132b76730224ad68b1f1e3"}, + {file = "duckdb-0.10.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5c3b3a18a58eebabb426beafc2f7da01d59805d660fc909e5e143b6db04d881a"}, + {file = "duckdb-0.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:343795d13ec3d8cd06c250225a05fd3c348c3ed49cccdde01addd46cb50f3559"}, + {file = "duckdb-0.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:33f99c2e9e4060464673912312b4ec91060d66638756592c9484c62824ff4e85"}, + {file = "duckdb-0.10.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:fdbe4173729043b2fd949be83135b035820bb2faf64648500563b16f3f6f02ee"}, + {file = "duckdb-0.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f90738310a76bd1618acbc7345175582d36b6907cb0ed07841a3d800dea189d6"}, + {file = "duckdb-0.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0d14d00560832592cbac2817847b649bd1d573f125d064518afb6eec5b02e15a"}, + {file = "duckdb-0.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:11c0bf253c96079c6139e8a0880300d80f4dc9f21a8c5c239d2ebc060b227d46"}, + {file = "duckdb-0.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcc60833bb1a1fb2c33b052cf793fef48f681c565d982acff6ac7a86369794da"}, + {file = "duckdb-0.10.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:88cdc0c2501dd7a65b1df2a76d7624b93d9b6d27febd2ee80b7e5643a0b40bcb"}, + {file = "duckdb-0.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:698a8d1d48b150d344d8aa6dbc30a22ea30fb14ff2b15c90004fc9fcb0b3a3e9"}, + {file = "duckdb-0.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:b450aa2b3e0eb1fc0f7ad276bd1e4a5a03b1a4def6c45366af17557de2cafbdf"}, + {file = "duckdb-0.10.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:40dd55ea9c31abc69e5a8299f16c877e0b1950fd9a311c117efb4dd3c0dc8458"}, + {file = "duckdb-0.10.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d7c1b3538bb9c2b49f48b26f092444525b22186efa4e77ba070603ed4a348a66"}, + {file = "duckdb-0.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bce024b69bae426b0739c470803f7b44261bdc0c0700ea7c41dff5f2d70ca4f3"}, + {file = "duckdb-0.10.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:52af2a078340b2e1b57958477ebc1be07786d3ad5796777e87d4f453e0477b4c"}, + {file = "duckdb-0.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3c52b08c773e52484542300339ebf295e3c9b12d5d7d49b2567e252c16205a7"}, + {file = "duckdb-0.10.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:097aa9b6d5c9f5d3ed8c35b16020a67731d04befc35f6b89ccb5db9d5f1489c4"}, + {file = "duckdb-0.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:b5a14a80ad09d65c270d16761b04ea6b074811cdfde6b5e4db1a8b0184125d1b"}, + {file = "duckdb-0.10.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fb98dbbdbf8048b07223dc6e7401333bb4e83681dde4cded2d239051ea102b5"}, + {file = "duckdb-0.10.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:28857b0d595c229827cc3631ae9b74ff52d11614435aa715e09d8629d2e1b609"}, + {file = "duckdb-0.10.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6d85645136fc25026978b5db81869e8a120cfb60e1645a29a0f6dd155be9e59e"}, + {file = "duckdb-0.10.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e2e10582db74b99051e718279c1be204c98a63a5b6aa4e09226b7249e414146"}, + {file = "duckdb-0.10.1-cp37-cp37m-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d6a88358d86a8ce689fdd4136514aebedf958e910361156a0bb0e53dc3c55f7d"}, + {file = "duckdb-0.10.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b025afa30fcdcede094386e7c519e6964d26de5ad95f4e04a2a0a713676d4465"}, + {file = "duckdb-0.10.1-cp37-cp37m-win_amd64.whl", hash = "sha256:910be5005de7427c5231a7200027e0adb951e048c612b895340effcd3e660d5a"}, + {file = "duckdb-0.10.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:13d81752763f14203a53981f32bd09731900eb6fda4048fbc532eae5e7bf30e5"}, + {file = "duckdb-0.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:21858225b8a5c5dead128f62e4e88facdcbfdce098e18cbcd86a6cd8f48fb2b3"}, + {file = "duckdb-0.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8bf46d55685906729998eca70ee751934e0425d86863148e658277526c54282e"}, + {file = "duckdb-0.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f786b4402b9c31461ea0520d919e2166df4f9e6e21fd3c7bb0035fa985b5dfe"}, + {file = "duckdb-0.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:32e52c6e939a4bada220803e6bde6fc0ce870da5662a33cabdd3be14824183a6"}, + {file = "duckdb-0.10.1-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5c563b565ea68cfebe9c4078646503b3d38930218f9c3c278277d58952873771"}, + {file = "duckdb-0.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:af8382280f24273a535e08b80e9383ad739c66e22855ce68716dfbaeaf8910b9"}, + {file = "duckdb-0.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:2e6e01e2499e07873b09316bf4d6808f712c57034fa24c255565c4f92386e8e3"}, + {file = "duckdb-0.10.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7791a0aa2cea972a612d31d4a289c81c5d00181328ed4f7642907f68f8b1fb9f"}, + {file = "duckdb-0.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1ace20383fb0ba06229e060a6bb0bcfd48a4582a02e43f05991720504508eb59"}, + {file = "duckdb-0.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5aad3e085c33253c689205b5ea3c5d9d54117c1249276c90d495cb85d9adce76"}, + {file = "duckdb-0.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fa08173f68e678793dfe6aab6490ac753204ca7935beb8dbde778dbe593552d8"}, + {file = "duckdb-0.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:525efad4e6caff80d0f6a51d466470839146e3880da36d4544fee7ff842e7e20"}, + {file = "duckdb-0.10.1-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:48d84577216010ee407913bad9dc47af4cbc65e479c91e130f7bd909a32caefe"}, + {file = "duckdb-0.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6e65f00294c3b8576ae651e91e732ea1cefc4aada89c307fb02f49231fd11e1f"}, + {file = "duckdb-0.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:30aa9dbbfc1f9607249fc148af9e6d6fd253fdc2f4c9924d4957d6a535558b4f"}, + {file = "duckdb-0.10.1.tar.gz", hash = "sha256:0d5b6daa9bb54a635e371798994caa08f26d2f145ebcbc989e16b0a0104e84fb"}, +] + [[package]] name = "editorconfig" version = "0.12.4" @@ -6186,4 +6243,4 @@ mariadb = [] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "14010772a2ea7449e1e46170106c1eeee97480d74b6a3897f8614d8e51e602e7" +content-hash = "6e3ed517c6397fb41ecd6e3e1b3183402f5900c297ae9d90baa2440ca6940702" diff --git a/pyproject.toml b/pyproject.toml index c20b7ab..b03f8f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ schemasheets = ">=0.1.24" xmltodict = "^0.13.0" click-default-group = "^1.2.4" linkml-runtime = "^1.7.2" +duckdb = "^0.10.1" [tool.poetry.dev-dependencies] diff --git a/schema_automator/cli.py b/schema_automator/cli.py index 75a4cf1..18c33ef 100644 --- a/schema_automator/cli.py +++ b/schema_automator/cli.py @@ -26,6 +26,7 @@ from schema_automator.importers.dosdp_import_engine import DOSDPImportEngine from schema_automator.generalizers.json_instance_generalizer import JsonDataGeneralizer from schema_automator.importers.jsonschema_import_engine import JsonSchemaImportEngine +from schema_automator.importers.kwalify_import_engine import KwalifyImportEngine from schema_automator.importers.owl_import_engine import OwlImportEngine from schema_automator.generalizers.rdf_data_generalizer import RdfDataGeneralizer from schema_automator.importers.rdfs_import_engine import RdfsImportEngine @@ -347,6 +348,12 @@ def generalize_toml(input, output, schema_name, omit_null, **kwargs): @output_option @schema_name_option @use_attributes_option +@click.option( + "--is-openapi/--no-is-openapi", + default=False, + show_default=True, + help="If true, use OpenAPI schema style" +) @click.option("--import-project/--no-import-project", help="If true, then the input path should be a directory with multiple schema files") @click.option('--format', '-f', default='json', help='JSON Schema format - yaml or json') @@ -370,6 +377,25 @@ def import_json_schema(input, output, import_project: bool, schema_name, format, ie.import_project(input, output, name=schema_name, format=format) +@main.command() +@click.argument('input') +@output_option +@schema_name_option +@use_attributes_option +def import_kwalify(input, output, schema_name, **kwargs): + """ + Imports from Kwalify Schema to LinkML + + See :ref:`importers` for more on the importer framework + + Example: + + schemauto import-kwalify my/schema/personinfo.kwalify.yaml + """ + ie = KwalifyImportEngine(**kwargs) + schema = ie.convert(input, output, name=schema_name, format=format) + write_schema(schema, output) + @main.command() @click.argument('input') @output_option diff --git a/schema_automator/importers/infer_model_from_rdftab.py b/schema_automator/generalizers/infer_model_from_rdftab.py similarity index 100% rename from schema_automator/importers/infer_model_from_rdftab.py rename to schema_automator/generalizers/infer_model_from_rdftab.py diff --git a/schema_automator/importers/cadsr_import_engine.py b/schema_automator/importers/cadsr_import_engine.py index 0ec7ac1..6f44a77 100644 --- a/schema_automator/importers/cadsr_import_engine.py +++ b/schema_automator/importers/cadsr_import_engine.py @@ -5,7 +5,7 @@ """ import logging import urllib -from typing import Union, Dict, Tuple, List, Any, Optional, Iterable +from typing import Union, Dict, Tuple, List, Any, Optional, Iterable, Iterator from dataclasses import dataclass @@ -19,6 +19,7 @@ from schema_automator.importers.import_engine import ImportEngine import schema_automator.metamodels.cadsr as cadsr +ID_LABEL_PAIR = Tuple[str, str] TMAP = { "DATE": "date", @@ -38,6 +39,28 @@ "Floating-point": "float", } +def extract_concepts(concepts: List[cadsr.Concept]) -> Tuple[ID_LABEL_PAIR, List[str]]: + main = None + rest = [] + if not concepts: + raise ValueError("No concepts") + for concept in concepts: + if concept.evsSource != "NCI_CONCEPT_CODE": + continue + id = f"NCIT:{concept.conceptCode.strip()}" + pair = id, concept.longName + if concept.primaryIndicator == "Yes": + if main: + raise ValueError(f"Multiple primary for: {concepts}") + main = pair + else: + rest.append(id) + if not main: + logging.warning(f"No primary, using arbitrary from {rest}") + main = rest[0] + rest = rest[1:] + return main, rest + @dataclass class CADSRImportEngine(ImportEngine): """ @@ -94,19 +117,30 @@ def convert(self, paths: Iterable[str], id: str=None, name: str=None, **kwargs) title=cde.preferredName, description=cde.preferredDefinition, aliases=[cde.longName], + conforms_to=f"cadsr:DataElement", source=source, ) + # each data element belongs to a concept + # (may be reused across classes?) slots[slot.name] = slot concept = cde.DataElementConcept - concept_name = urllib.parse.quote(camelcase(f"{ctxt} {concept.preferredName}")) - parent_concept_name = urllib.parse.quote(camelcase(concept.longName)) + # a concept is linked to a class + objectClass = concept.ObjectClass + # NCIT concepts describing the class + mainConcept, mappings = extract_concepts(objectClass.Concepts) + class_name = objectClass.longName + concept_name = urllib.parse.quote(camelcase(f"{ctxt} {class_name}")) + parent_concept_name = urllib.parse.quote(class_name) if parent_concept_name not in classes: parent_cls = ClassDefinition( name=parent_concept_name, - title=concept.preferredName, - description=concept.preferredDefinition, + title=objectClass.preferredName, + description=objectClass.preferredDefinition, #aliases=[concept.longName], - class_uri=f"cadsr:{concept.publicId}", + class_uri=f"cadsr:{objectClass.publicId}", + exact_mappings=[mainConcept[0]], + broad_mappings=mappings, + conforms_to=f"cadsr:ObjectClass", ) classes[parent_concept_name] = parent_cls if concept_name not in classes: @@ -117,14 +151,23 @@ def convert(self, paths: Iterable[str], id: str=None, name: str=None, **kwargs) aliases=[concept.longName], class_uri=f"cadsr:{concept.publicId}", is_a=parent_concept_name, + conforms_to=f"cadsr:DataElementConcept", ) classes[concept_name] = cls else: cls = classes[concept_name] cls.slots.append(slot.name) - objectClass = concept.ObjectClass - # TODO + # In theory the ObjectClass should link to a general class of utility in NCIT. + # In practice the actual concept may not be so useful. E.g. in 2724331 + # "Agent Adverse Event Attribution Name" the DataConcept is + # Agent (C1708) defined as "An active power or cause (as principle, + # substance, physical or biological factor, etc.) that produces a specific effect." + # which is very upper-ontological + #for ocConcept in objectClass.Concepts: + # if ocConcept.evsSource == "NCI_CONCEPT_CODE": + # cls.is_a = f"NCIT:{ocConcept.conceptCode}" valueDomain = cde.ValueDomain + # TODO conceptualDomain = valueDomain.ConceptualDomain pvs = valueDomain.PermissibleValues if pvs: @@ -140,7 +183,7 @@ def convert(self, paths: Iterable[str], id: str=None, name: str=None, **kwargs) rng = enum_name for pv in pvs: # url encode the value to escape symbols like <, >, etc. - pv_value = urllib.parse.quote(pv.value) + pv_value = urllib.parse.quote(pv.value).replace("%20", " ") tgt_pv = PermissibleValue( text=pv_value, title=pv.value, @@ -151,9 +194,10 @@ def convert(self, paths: Iterable[str], id: str=None, name: str=None, **kwargs) tgt_pv.title = vm.preferredName if not tgt_pv.description: tgt_pv.description = vm.preferredDefinition - for c in vm.Concepts: - code = c.conceptCode.strip() - tgt_pv.meaning = f"NCIT:{code}" + if vm.Concepts: + mainConcept, mappings = extract_concepts(vm.Concepts) + tgt_pv.meaning = mainConcept[0] + tgt_pv.broad_mappings = mappings else: datatype = valueDomain.dataType rng = TMAP.get(datatype, "string") @@ -179,6 +223,56 @@ def convert(self, paths: Iterable[str], id: str=None, name: str=None, **kwargs) schema.enums = enums return schema + def as_rows(self, paths: Iterable[str], **kwargs) -> Iterator[Dict]: + for path in paths: + logging.info(f"Loading {path}") + with (open(path) as file): + container: cadsr.DataElementContainer + container = json_loader.load(file, target_class=cadsr.DataElementContainer) + cde = container.DataElement + yield from self._obj_as_rows(cde, path) + + def _obj_as_rows(self, e: Union[cadsr.DataElement, cadsr.DataElementConcept, cadsr.Concept, cadsr.Property, cadsr.ObjectClass, cadsr.ConceptualDomain, + cadsr.ValueDomain, cadsr.PermissibleValue, cadsr.ValueMeaning], parent_id: str) -> Iterator[Dict]: + if isinstance(e, cadsr.Concept): + obj = { + "id": e.conceptCode, + "context": e.evsSource, + "longName": e.longName, + } + elif isinstance(e, cadsr.CDEPermissibleValue): + obj = { + "id": e.publicId, + "value": e.value, + "valueDescription": e.valueDescription, + } + else: + obj = { + "id": e.publicId, + "preferredName": e.preferredName, + "context": e.context, + "longName": e.longName, + } + obj["parentId"] = parent_id + obj["type"] = type(e).class_name + id = obj["id"] + yield obj + if isinstance(e, cadsr.DataElement): + yield from self._obj_as_rows(e.DataElementConcept, id) + yield from self._obj_as_rows(e.ValueDomain, id) + elif isinstance(e, cadsr.DataElementConcept): + yield from self._obj_as_rows(e.ObjectClass, id) + yield from self._obj_as_rows(e.Property, id) + yield from self._obj_as_rows(e.ConceptualDomain, id) + elif isinstance(e, cadsr.ValueDomain): + for pv in e.PermissibleValues: + yield from self._obj_as_rows(pv.ValueMeaning, id) + if isinstance(e, (cadsr.ObjectClass, cadsr.Property, cadsr.PermissibleValue)): + for c in e.Concepts: + yield from self._obj_as_rows(c, id) + + + diff --git a/schema_automator/importers/jsonschema_import_engine.py b/schema_automator/importers/jsonschema_import_engine.py index de7cd89..661200d 100644 --- a/schema_automator/importers/jsonschema_import_engine.py +++ b/schema_automator/importers/jsonschema_import_engine.py @@ -5,30 +5,40 @@ import click import yaml import logging -from copy import copy -from typing import Any, Tuple, Dict, Union, List, Optional +from typing import Any, Tuple, Dict, List, Optional -from deprecation import deprecated from linkml.utils.schema_builder import SchemaBuilder -from linkml_runtime.linkml_model import SchemaDefinition, Element, ClassDefinition, \ +from linkml_runtime.linkml_model import SchemaDefinition, ClassDefinition, \ SlotDefinition, EnumDefinition, \ - ClassDefinitionName, \ - SlotDefinitionName, Prefix + ClassDefinitionName, Prefix from linkml_runtime.linkml_model.meta import ReachabilityQuery, AnonymousEnumExpression from linkml_runtime.utils.formatutils import underscore, camelcase from schema_automator.importers.import_engine import ImportEngine -from schema_automator.utils.schemautils import minify_schema, write_schema +from schema_automator.utils.schemautils import write_schema # TODO: move to core. https://github.com/linkml/linkml/issues/104 RESERVED = ['in', 'not', 'def'] + +def json_schema_from_open_api(oa: Dict) -> Dict: + """ + Convert an OpenAPI schema to a JSON-Schema schema + + :param oa: + :return: + """ + schemas = oa.get('components', {}).get('schemas', {}) + schema = {'$defs': schemas} + return schema + @dataclass class JsonSchemaImportEngine(ImportEngine): """ A :ref:`ImportEngine` that imports a JSON-Schema representation to a LinkML Schema """ use_attributes: bool = False + is_openapi: bool = False def convert(self, input: str, name=None, format = 'json', **kwargs) -> SchemaDefinition: """ @@ -111,6 +121,8 @@ def load(self, input: str, name=None, format = 'json', **kwargs): return self.convert(input, name=name, format=format, **kwargs) def loads(self, obj: Any, name=None, **kwargs) -> SchemaDefinition: + if self.is_openapi: + obj = json_schema_from_open_api(obj) return self.translate_schema(obj, name, **kwargs) def _class_name(self, cn: str) -> str: diff --git a/schema_automator/importers/kwalify_import_engine.py b/schema_automator/importers/kwalify_import_engine.py new file mode 100644 index 0000000..08956cb --- /dev/null +++ b/schema_automator/importers/kwalify_import_engine.py @@ -0,0 +1,109 @@ +from typing import Union, Dict, Tuple, List, Any, Optional + +from dataclasses import dataclass + +import yaml +from linkml.utils.schema_builder import SchemaBuilder +from linkml_runtime.linkml_model.meta import SchemaDefinition, SlotDefinition, EnumDefinition, \ + PermissibleValue, UniqueKey, ClassDefinition +from linkml_runtime.utils.formatutils import camelcase + +from schema_automator.importers.import_engine import ImportEngine +import schema_automator.metamodels.frictionless as fl + + +# maps from kwalify to linkml +TYPE_MAPPING = { + "str": "string", + "int": "integer", + "float": "float", + "bool": "boolean", + "timestamp": "datetime", +} + + + +@dataclass +class KwalifyImportEngine(ImportEngine): + """ + An ImportEngine that imports Kwalify schemas + """ + + def convert(self, file: str, id: str=None, name: str=None, class_name: str=None, **kwargs) -> SchemaDefinition: + """ + Converts one or more Kwalify files into a Schema + + :param files: + :param kwargs: + :return: + """ + sb = SchemaBuilder() + schema = sb.schema + if id: + schema.id = id + if not name: + name = "example" + if name: + schema.name = name + kwalify = yaml.safe_load(open(file)) + if kwalify["type"] != "map": + raise ValueError(f"Expected map, got {kwalify['type']}") + if class_name is None: + class_name = camelcase(name) + self.convert_to_class(sb, kwalify["mapping"], class_name) + sb.add_defaults() + if name: + schema.default_prefix = name + return sb.schema + + def convert_to_class(self, sb: SchemaBuilder, kwalify_map: Dict[str, Any], name: str): + """ + Convert a Kwalify map to a class + + :param sb: + :param kwalify: + :param name: + :return: + """ + cls = ClassDefinition(name=name) + sb.schema.classes[name] = cls + for slot_name, v in kwalify_map.items(): + if isinstance(v, list): + if len(v) != 1: + raise ValueError(f"Expected single element in list, got {v}") + v = v[0] + slot = SlotDefinition(name=slot_name, required=v.get('required', False)) + pattern = v.get('pattern', None) + if pattern: + # remove outer /..../ + slot.pattern = pattern[1:-1] + + typ = v['type'] + if typ == 'seq': + slot.multivalued = True + seq = v['sequence'] + if len(seq) != 1: + raise ValueError(f"Expected single element in sequence, got {seq}") + v = seq[0] + typ = v['type'] + if typ == 'map': + range_cls_name = camelcase(slot_name) + self.convert_to_class(sb, v["mapping"], range_cls_name) + slot.range = range_cls_name + elif typ == 'seq': + raise NotImplementedError("Sequences of sequences not supported") + else: + slot.range = TYPE_MAPPING.get(typ, "string") + pvs = v.get('enum', None) + if pvs: + enum_name = f"{name}_{slot_name}_enum" + sb.add_enum(EnumDefinition(name=enum_name, permissible_values=pvs)) + slot.range = enum_name + cls.attributes[slot_name] = slot + + + + + + + diff --git a/schema_automator/importers/rdfs_import_engine.py b/schema_automator/importers/rdfs_import_engine.py index a51c5a5..3abc4cb 100644 --- a/schema_automator/importers/rdfs_import_engine.py +++ b/schema_automator/importers/rdfs_import_engine.py @@ -1,7 +1,5 @@ -import click import logging -import yaml -from typing import Union, Dict, Tuple, List, Any +from typing import Dict, List, Any from collections import defaultdict from linkml.utils.schema_builder import SchemaBuilder @@ -16,6 +14,7 @@ from dataclasses import dataclass, field +from linkml_runtime.utils.formatutils import underscore from linkml_runtime.utils.introspection import package_schemaview from rdflib import Graph, RDF, OWL, URIRef, RDFS, SKOS, SDO, Namespace from schema_automator.importers.import_engine import ImportEngine @@ -66,9 +65,12 @@ def __post_init__(self): self.reverse_metamodel_mappings[v].append(k) if self.initial_metamodel_mappings: for k, vs in self.initial_metamodel_mappings.items(): + if not isinstance(vs, list): + vs = [vs] self.metamodel_mappings[k].extend(vs) for v in vs: - self.reverse_metamodel_mappings[v].append(k) + self.reverse_metamodel_mappings[URIRef(v)].append(k) + logging.info(f"Adding mapping {k} -> {v}") for e in sv.all_elements().values(): mappings = [] for ms in sv.get_mappings(e.name, expand=True).values(): @@ -185,6 +187,7 @@ def _dict_for_subject(self, g: Graph, s: URIRef) -> Dict[str, Any]: if pp == RDF.type: continue metaslot_name = self._element_from_iri(pp) + logging.debug(f"Mapping {pp} -> {metaslot_name}") if metaslot_name not in self.defclass_slots: continue if metaslot_name is None: @@ -192,14 +195,15 @@ def _dict_for_subject(self, g: Graph, s: URIRef) -> Dict[str, Any]: continue if metaslot_name == "name": metaslot_name = "title" - v = self._object_to_value(obj) metaslot = self.metamodel.get_slot(metaslot_name) + v = self._object_to_value(obj, metaslot=metaslot) + metaslot_name_safe = underscore(metaslot_name) if not metaslot or metaslot.multivalued: - if metaslot_name not in init_dict: - init_dict[metaslot_name] = [] - init_dict[metaslot_name].append(v) + if metaslot_name_safe not in init_dict: + init_dict[metaslot_name_safe] = [] + init_dict[metaslot_name_safe].append(v) else: - init_dict[metaslot_name] = v + init_dict[metaslot_name_safe] = v return init_dict def _rdfs_metamodel_iri(self, name: str) -> List[URIRef]: @@ -209,11 +213,13 @@ def _element_from_iri(self, iri: URIRef) -> str: r = self.reverse_metamodel_mappings.get(iri, []) if len(r) > 0: if len(r) > 1: - logging.info(f"Multiple mappings for {iri}: {r}") + logging.debug(f"Multiple mappings for {iri}: {r}") return r[0] - def _object_to_value(self, obj: Any) -> Any: + def _object_to_value(self, obj: Any, metaslot: SlotDefinition = None) -> Any: if isinstance(obj, URIRef): + if metaslot.range == "uriorcurie" or metaslot.range == "uri": + return str(obj) return self.iri_to_name(obj) if isinstance(obj, Literal): return obj.value diff --git a/tests/resources/cadsr-cde-217609.json b/tests/resources/cadsr-cde-217609.json deleted file mode 100644 index e69de29..0000000 diff --git a/tests/resources/cadsr-cde-996.json b/tests/resources/cadsr-cde-996.json index 98087cb..af15bd5 100644 --- a/tests/resources/cadsr-cde-996.json +++ b/tests/resources/cadsr-cde-996.json @@ -1 +1,741 @@ -{"DataElement":{"publicId":"996","version":"5","preferredName":"Prior Chemotherapy Administered End Date","preferredDefinition":"the end date for previous chemotherapy administered as treatment for this cancer.","longName":"PRIOR_CT_ADM_END_DT","context":"CTEP","contextVersion":"2.31","DataElementConcept":{"publicId":"2188711","version":"1","preferredName":"Prior Chemotherapy Administered","preferredDefinition":"information related to prior administration of chemotherapy.","longName":"PRIOR_CT_ADM","context":"CTEP","contextVersion":"2.31","ObjectClass":{"publicId":"2206391","version":"1","preferredName":"Prior Chemotherapy","preferredDefinition":"Earlier in time or order.:The use of synthetic or naturally-occurring chemicals for the treatment of diseases. Although this term may be used to describe any therapy involving the use of chemical-based agents, it is most commonly used to refer to the variety of chemical-based agents employed to treat cancer. Cancer chemotherapy works by arresting or killing the growth and spread of cancer cells. Because cancer cells usually divide much faster than normal cells, they are often very sensitive to the inhibitory actions of chemotherapeutic agents. Chemotherapy may also include agents that enhance immune function or alter hormonal activity. (NCI04)","longName":"C25629:C15632","context":"NCIP","contextVersion":"1","Concepts":[{"longName":"Prior","conceptCode":"C25629","definition":"Earlier in time or order.","evsSource":"NCI_CONCEPT_CODE","primaryIndicator":"No","displayOrder":"1"},{"longName":"Chemotherapy","conceptCode":"C15632","definition":"The use of synthetic or naturally-occurring chemicals for the treatment of diseases.","evsSource":"NCI_CONCEPT_CODE","primaryIndicator":"Yes","displayOrder":"0"}],"origin":null,"workflowStatus":"RELEASED","registrationStatus":"Application","id":"F37D0428-F3A3-6787-E034-0003BA3F9857","latestVersionIndicator":"Yes","beginDate":"2005-03-29","endDate":null,"createdBy":"SBR","dateCreated":"2005-03-29","modifiedBy":"ONEDATA","dateModified":"2005-03-29","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"Property":{"publicId":"2177665","version":"1","preferredName":"Administered","preferredDefinition":"Given.","longName":"Administered","context":"CTEP","contextVersion":"2.31","Concepts":[{"longName":"Administered","conceptCode":"C25382","definition":"The act of having given something (e.g., a medication or test).","evsSource":"NCI_CONCEPT_CODE","primaryIndicator":"Yes","displayOrder":"0"}],"origin":"NCI Thesaurus","workflowStatus":"RELEASED","registrationStatus":"Application","id":"AE29A78C-516D-3A05-E034-0003BA12F5E7","latestVersionIndicator":"Yes","beginDate":"2002-10-29","endDate":null,"createdBy":"SBREXT","dateCreated":"2002-10-29","modifiedBy":"SBR","dateModified":"2005-03-29","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"ConceptualDomain":{"publicId":"2008538","version":"1","preferredName":"Therapies","preferredDefinition":"actions or administration of therapeutic agents to produce an effect that is intended to alter the course of a pathologic process (NCI).","longName":"TX","context":"CTEP","contextVersion":"2.31","origin":null,"workflowStatus":"RELEASED","registrationStatus":"Application","id":"B214D04D-9F05-1CA5-E034-0003BA12F5E7","latestVersionIndicator":"Yes","beginDate":"2002-12-18","endDate":null,"createdBy":"MSUPLEY","dateCreated":"2002-12-18","modifiedBy":"SBR","dateModified":"2003-10-29","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"origin":null,"workflowStatus":"RELEASED","registrationStatus":"Application","id":"E54DEB21-FF53-61DD-E034-0003BA3F9857","latestVersionIndicator":"Yes","beginDate":"2004-09-30","endDate":null,"createdBy":"CAMPBELB","dateCreated":"2004-09-30","modifiedBy":"SBR","dateModified":"2016-06-06","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"ValueDomain":{"publicId":"2188674","version":"1","preferredName":"End Date","preferredDefinition":"The date on which an observation or an event ended.","longName":"END_DT","context":"NCI Standards","contextVersion":"1","type":"Non-enumerated","dataType":"DATE","minLength":null,"maxLength":"8","minValue":null,"maxValue":null,"decimalPlace":null,"format":"mm/dd/yy","PermissibleValues":[],"ConceptualDomain":{"publicId":"2008561","version":"1","preferredName":"Occurrences","preferredDefinition":"dates, times, and durations.","longName":"OCURS","context":"CTEP","contextVersion":"2.31","origin":null,"workflowStatus":"RELEASED","registrationStatus":"Application","id":"B53BD1AB-090B-398B-E034-0003BA12F5E7","latestVersionIndicator":"Yes","beginDate":"2003-01-27","endDate":null,"createdBy":"MSUPLEY","dateCreated":"2003-01-27","modifiedBy":"SBR","dateModified":"2003-10-29","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"RepresentationTerm":{"publicId":"2184285","version":"1","preferredName":"Date","preferredDefinition":"A particular day specified as the time something has, or will, happen.","longName":"Date","context":"CTEP","contextVersion":"2.31","Concepts":[{"longName":"Date","conceptCode":"C25164","definition":"The particular day, month and year an event has happened or will happen.","evsSource":"NCI_CONCEPT_CODE","primaryIndicator":"Yes","displayOrder":"0"}],"origin":"NCI Thesaurus","workflowStatus":"RELEASED","registrationStatus":"Application","id":"DB6C8AC6-1B1A-3E75-E034-0003BA12F5E7","latestVersionIndicator":"Yes","beginDate":"2004-05-27","endDate":null,"createdBy":"SBREXT","dateCreated":"2004-05-27","modifiedBy":"SBR","dateModified":"2005-04-06","changeDescription":null,"administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"origin":null,"workflowStatus":"RELEASED","registrationStatus":"Qualified","id":"E53ADB93-5DF7-315A-E034-0003BA3F9857","latestVersionIndicator":"Yes","beginDate":"2004-09-29","endDate":null,"createdBy":"CAMPBELB","dateCreated":"2004-09-29","modifiedBy":"KNABLEJ","dateModified":"2017-08-23","changeDescription":"8/23/17 jk transferred context, cap first letter in def, and added CSI, registration status per Round 5 finalization task.","administrativeNotes":null,"unresolvedIssues":null,"deletedIndicator":"No"},"ClassificationSchemes":[{"publicId":"2008587","version":"2","longName":"Type of Disease","context":"CTEP","ClassificationSchemeItems":[{"publicId":"2811949","version":"1","longName":"Brain","context":"CTEP"},{"publicId":"2811832","version":"1","longName":"Lung","context":"CTEP"},{"publicId":"2811871","version":"1","longName":"Colorectal","context":"CTEP"},{"publicId":"10000607","version":"1","longName":"Sarcoma","context":"CTEP"},{"publicId":"2811907","version":"1","longName":"Bladder","context":"CTEP"},{"publicId":"2811831","version":"1","longName":"Breast","context":"CTEP"},{"publicId":"2811908","version":"1","longName":"Gynecologic","context":"CTEP"},{"publicId":"2811909","version":"1","longName":"Leukemia","context":"CTEP"},{"publicId":"2811910","version":"1","longName":"Prostate","context":"CTEP"},{"publicId":"2811911","version":"1","longName":"Upper GI","context":"CTEP"},{"publicId":"2811913","version":"1","longName":"Lymphoma","context":"CTEP"},{"publicId":"2811950","version":"1","longName":"Multiple Myeloma","context":"CTEP"}]},{"publicId":"2008589","version":"2","longName":"Type of Category","context":"CTEP","ClassificationSchemeItems":[{"publicId":"2811959","version":"1","longName":"Patient Char.","context":"CTEP"},{"publicId":"2811963","version":"1","longName":"Treatment","context":"CTEP"}]},{"publicId":"2008594","version":"2.31","longName":"Trial Type Usages (CDE Disease Committees)","context":"CTEP","ClassificationSchemeItems":[{"publicId":"2811904","version":"1","longName":"Multiple Myeloma","context":"CTEP"},{"publicId":"2811905","version":"1","longName":"Primary Amyloidosis","context":"CTEP"},{"publicId":"2811906","version":"1","longName":"Waldenstrom Macrogl","context":"CTEP"},{"publicId":"2811920","version":"1","longName":"Non-local Prostate","context":"CTEP"},{"publicId":"2811938","version":"1","longName":"Recurrent Gyn","context":"CTEP"},{"publicId":"2811943","version":"1","longName":"Hodgkin's Lymphoma","context":"CTEP"},{"publicId":"2811944","version":"1","longName":"NonHodgkins Lymphoma","context":"CTEP"}]},{"publicId":"2552643","version":"1","longName":"Training Class Examples","context":"Training","ClassificationSchemeItems":[{"publicId":"3637837","version":"1","longName":"Training","context":"Training"}]},{"publicId":"2961451","version":"1","longName":"Children's Oncology Group (COG)","context":"COG","ClassificationSchemeItems":[{"publicId":"3303197","version":"1","longName":"Phase 1/Pilot Consortium","context":"COG"}]},{"publicId":"3335728","version":"1","longName":"Protocols","context":"ABTC","ClassificationSchemeItems":[{"publicId":"3335732","version":"1","longName":"ABTC 0904","context":"ABTC"}]},{"publicId":"4057943","version":"1","longName":"Disease Site","context":"NRG","ClassificationSchemeItems":[{"publicId":"4104890","version":"1","longName":"GOG-0229L","context":"NRG"},{"publicId":"4104883","version":"1","longName":"GOG-0240","context":"NRG"},{"publicId":"4104897","version":"1","longName":"GOG-0250","context":"NRG"},{"publicId":"4104891","version":"1","longName":"GOG-0229N","context":"NRG"},{"publicId":"4104901","version":"1","longName":"GOG-0286B","context":"NRG"},{"publicId":"4104899","version":"1","longName":"GOG-0261","context":"NRG"},{"publicId":"4104892","version":"1","longName":"GOG-0229O","context":"NRG"},{"publicId":"4104941","version":"1","longName":"GOG-0281","context":"NRG"},{"publicId":"10000705","version":"1","longName":"GOG-0281","context":"NRG"},{"publicId":"10000276","version":"1","longName":"GOG-0283","context":"NRG"},{"publicId":"4104930","version":"1","longName":"GOG-0283","context":"NRG"},{"publicId":"10000275","version":"1","longName":"GOG-0283","context":"NRG"}]}],"AlternateNames":[{"name":"0062915","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0002355","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0002531","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0061399","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0058422","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0002464","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"0065215","type":"HISTORICAL_CDE_ID","context":"CTEP"},{"name":"PRIOR_CT_ADM_END_DT","type":"USED_BY","context":"CTEP"},{"name":"ABTC","type":"USED_BY","context":"ABTC"},{"name":"COG","type":"USED_BY","context":"COG"},{"name":"PRIOR_CT_ADM_END_DT","type":"USED_BY","context":"COG"},{"name":"PRIOR_CT_ADM_END_DT","type":"USED_BY","context":"Alliance"},{"name":"PRIOR_CT_ADM_END_DT","type":"USED_BY","context":"NRG"},{"name":"ECOG-ACRIN","type":"USED_BY","context":"ECOG-ACRIN"},{"name":"CMSTDAT_PRICHEMO","type":"OID, Alliance","context":"Alliance"}],"ReferenceDocuments":[{"name":"Date Prior Chemotherapy Ended","type":"Preferred Question Text","description":"Date Prior Chemotherapy Ended","url":null,"context":"CTEP"},{"name":"CRF Text","type":"Alternate Question Text","description":"Prior Chemotherapy End Date","url":null,"context":"CTEP"},{"name":"Prior Chemotherapy Stop Date","type":"Alternate Question Text","description":"Prior Chemotherapy Stop Date","url":null,"context":"CTEP"},{"name":"COG_CRF_TEXT_1","type":"Alternate Question Text","description":"Date of last dose of indicated agent","url":null,"context":"CTEP"},{"name":"CRF Text2","type":"Alternate Question Text","description":"Last day of chemotherapy","url":null,"context":"CTEP"},{"name":"CRF Text 1","type":"Alternate Question Text","description":"Date Ended","url":null,"context":"CTEP"},{"name":"CRF Text3","type":"Alternate Question Text","description":"Date last chemotherapy treatment received","url":null,"context":"CTEP"},{"name":"CRF Text4","type":"Alternate Question Text","description":"Date of completion of prior chemotherapy","url":null,"context":"CTEP"},{"name":"COG_CRF_TEXT_2","type":"Alternate Question Text","description":"Date last Myelosuppressive Chemotherapy treatment received","url":null,"context":"COG"},{"name":"ECOG CRF Text 1","type":"Alternate Question Text","description":"Date of last prior chemotherapy","url":null,"context":"ECOG-ACRIN"},{"name":"ECOG CRF Text 2","type":"Alternate Question Text","description":"Date prior anthracycline therapy ended","url":null,"context":"ECOG-ACRIN"},{"name":"ECOG CRF Text 3","type":"Alternate Question Text","description":"Date prior systemic doxorubicin ended","url":null,"context":"ECOG-ACRIN"},{"name":"ECOG CRF Text 4","type":"Alternate Question Text","description":"Date prior Brentuximab ended","url":null,"context":"ECOG-ACRIN"},{"name":"NRG_CRF_Text 1","type":"Alternate Question Text","description":"Date Prior Systemic Therapy Ended","url":null,"context":"NRG"},{"name":"CRF Text5","type":"Alternate Question Text","description":"last date of chemotherapy","url":null,"context":"Alliance"},{"name":"Prior Therapies Form","type":"Alternate Question Text","description":"Date (most recent) prior chemotherapy ended","url":null,"context":"ECOG-ACRIN"},{"name":"CRF Text6","type":"Alternate Question Text","description":"last day of chemotherapy","url":null,"context":"Alliance"},{"name":"CRF Text7","type":"Alternate Question Text","description":"last day of neoadjuvant chemotherapy","url":null,"context":"Alliance"},{"name":"CRF Text8","type":"Alternate Question Text","description":"date of last chemotherapy","url":null,"context":"Alliance"},{"name":"CRF Text9","type":"Alternate Question Text","description":"Chemotherapy Completion Date","url":null,"context":"Alliance"},{"name":"Alliance A092105","type":"Alternate Question Text","description":"If Yes, Chemotherapy Completion Date","url":null,"context":"Alliance"}],"origin":null,"workflowStatus":"RELEASED","registrationStatus":"Qualified","id":"E55143E8-160F-321B-E034-0003BA3F9857","latestVersionIndicator":"Yes","beginDate":"2004-09-30","endDate":null,"createdBy":"CAMPBELB","dateCreated":"2004-09-30","modifiedBy":"ZHWENDY","dateModified":"2023-04-06","changeDescription":"ISO compliance.","administrativeNotes":"2023/4/4: Added AQT for Alliance.wz","unresolvedIssues":null,"deletedIndicator":"No"}} \ No newline at end of file +{ + "DataElement": { + "publicId": "996", + "version": "5", + "preferredName": "Prior Chemotherapy Administered End Date", + "preferredDefinition": "the end date for previous chemotherapy administered as treatment for this cancer.", + "longName": "PRIOR_CT_ADM_END_DT", + "context": "CTEP", + "contextVersion": "2.31", + "DataElementConcept": { + "publicId": "2188711", + "version": "1", + "preferredName": "Prior Chemotherapy Administered", + "preferredDefinition": "information related to prior administration of chemotherapy.", + "longName": "PRIOR_CT_ADM", + "context": "CTEP", + "contextVersion": "2.31", + "ObjectClass": { + "publicId": "2206391", + "version": "1", + "preferredName": "Prior Chemotherapy", + "preferredDefinition": "Earlier in time or order.:The use of synthetic or naturally-occurring chemicals for the treatment of diseases. Although this term may be used to describe any therapy involving the use of chemical-based agents, it is most commonly used to refer to the variety of chemical-based agents employed to treat cancer. Cancer chemotherapy works by arresting or killing the growth and spread of cancer cells. Because cancer cells usually divide much faster than normal cells, they are often very sensitive to the inhibitory actions of chemotherapeutic agents. Chemotherapy may also include agents that enhance immune function or alter hormonal activity. (NCI04)", + "longName": "C25629:C15632", + "context": "NCIP", + "contextVersion": "1", + "Concepts": [ + { + "longName": "Prior", + "conceptCode": "C25629", + "definition": "Earlier in time or order.", + "evsSource": "NCI_CONCEPT_CODE", + "primaryIndicator": "No", + "displayOrder": "1" + }, + { + "longName": "Chemotherapy", + "conceptCode": "C15632", + "definition": "The use of synthetic or naturally-occurring chemicals for the treatment of diseases.", + "evsSource": "NCI_CONCEPT_CODE", + "primaryIndicator": "Yes", + "displayOrder": "0" + } + ], + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "F37D0428-F3A3-6787-E034-0003BA3F9857", + "latestVersionIndicator": "Yes", + "beginDate": "2005-03-29", + "endDate": null, + "createdBy": "SBR", + "dateCreated": "2005-03-29", + "modifiedBy": "ONEDATA", + "dateModified": "2005-03-29", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "Property": { + "publicId": "2177665", + "version": "1", + "preferredName": "Administered", + "preferredDefinition": "Given.", + "longName": "Administered", + "context": "CTEP", + "contextVersion": "2.31", + "Concepts": [ + { + "longName": "Administered", + "conceptCode": "C25382", + "definition": "The act of having given something (e.g., a medication or test).", + "evsSource": "NCI_CONCEPT_CODE", + "primaryIndicator": "Yes", + "displayOrder": "0" + } + ], + "origin": "NCI Thesaurus", + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "AE29A78C-516D-3A05-E034-0003BA12F5E7", + "latestVersionIndicator": "Yes", + "beginDate": "2002-10-29", + "endDate": null, + "createdBy": "SBREXT", + "dateCreated": "2002-10-29", + "modifiedBy": "SBR", + "dateModified": "2005-03-29", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "ConceptualDomain": { + "publicId": "2008538", + "version": "1", + "preferredName": "Therapies", + "preferredDefinition": "actions or administration of therapeutic agents to produce an effect that is intended to alter the course of a pathologic process (NCI).", + "longName": "TX", + "context": "CTEP", + "contextVersion": "2.31", + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "B214D04D-9F05-1CA5-E034-0003BA12F5E7", + "latestVersionIndicator": "Yes", + "beginDate": "2002-12-18", + "endDate": null, + "createdBy": "MSUPLEY", + "dateCreated": "2002-12-18", + "modifiedBy": "SBR", + "dateModified": "2003-10-29", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "E54DEB21-FF53-61DD-E034-0003BA3F9857", + "latestVersionIndicator": "Yes", + "beginDate": "2004-09-30", + "endDate": null, + "createdBy": "CAMPBELB", + "dateCreated": "2004-09-30", + "modifiedBy": "SBR", + "dateModified": "2016-06-06", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "ValueDomain": { + "publicId": "2188674", + "version": "1", + "preferredName": "End Date", + "preferredDefinition": "The date on which an observation or an event ended.", + "longName": "END_DT", + "context": "NCI Standards", + "contextVersion": "1", + "type": "Non-enumerated", + "dataType": "DATE", + "minLength": null, + "maxLength": "8", + "minValue": null, + "maxValue": null, + "decimalPlace": null, + "format": "mm/dd/yy", + "PermissibleValues": [], + "ConceptualDomain": { + "publicId": "2008561", + "version": "1", + "preferredName": "Occurrences", + "preferredDefinition": "dates, times, and durations.", + "longName": "OCURS", + "context": "CTEP", + "contextVersion": "2.31", + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "B53BD1AB-090B-398B-E034-0003BA12F5E7", + "latestVersionIndicator": "Yes", + "beginDate": "2003-01-27", + "endDate": null, + "createdBy": "MSUPLEY", + "dateCreated": "2003-01-27", + "modifiedBy": "SBR", + "dateModified": "2003-10-29", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "RepresentationTerm": { + "publicId": "2184285", + "version": "1", + "preferredName": "Date", + "preferredDefinition": "A particular day specified as the time something has, or will, happen.", + "longName": "Date", + "context": "CTEP", + "contextVersion": "2.31", + "Concepts": [ + { + "longName": "Date", + "conceptCode": "C25164", + "definition": "The particular day, month and year an event has happened or will happen.", + "evsSource": "NCI_CONCEPT_CODE", + "primaryIndicator": "Yes", + "displayOrder": "0" + } + ], + "origin": "NCI Thesaurus", + "workflowStatus": "RELEASED", + "registrationStatus": "Application", + "id": "DB6C8AC6-1B1A-3E75-E034-0003BA12F5E7", + "latestVersionIndicator": "Yes", + "beginDate": "2004-05-27", + "endDate": null, + "createdBy": "SBREXT", + "dateCreated": "2004-05-27", + "modifiedBy": "SBR", + "dateModified": "2005-04-06", + "changeDescription": null, + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Qualified", + "id": "E53ADB93-5DF7-315A-E034-0003BA3F9857", + "latestVersionIndicator": "Yes", + "beginDate": "2004-09-29", + "endDate": null, + "createdBy": "CAMPBELB", + "dateCreated": "2004-09-29", + "modifiedBy": "KNABLEJ", + "dateModified": "2017-08-23", + "changeDescription": "8/23/17 jk transferred context, cap first letter in def, and added CSI, registration status per Round 5 finalization task.", + "administrativeNotes": null, + "unresolvedIssues": null, + "deletedIndicator": "No" + }, + "ClassificationSchemes": [ + { + "publicId": "2008587", + "version": "2", + "longName": "Type of Disease", + "context": "CTEP", + "ClassificationSchemeItems": [ + { + "publicId": "2811949", + "version": "1", + "longName": "Brain", + "context": "CTEP" + }, + { + "publicId": "2811832", + "version": "1", + "longName": "Lung", + "context": "CTEP" + }, + { + "publicId": "2811871", + "version": "1", + "longName": "Colorectal", + "context": "CTEP" + }, + { + "publicId": "10000607", + "version": "1", + "longName": "Sarcoma", + "context": "CTEP" + }, + { + "publicId": "2811907", + "version": "1", + "longName": "Bladder", + "context": "CTEP" + }, + { + "publicId": "2811831", + "version": "1", + "longName": "Breast", + "context": "CTEP" + }, + { + "publicId": "2811908", + "version": "1", + "longName": "Gynecologic", + "context": "CTEP" + }, + { + "publicId": "2811909", + "version": "1", + "longName": "Leukemia", + "context": "CTEP" + }, + { + "publicId": "2811910", + "version": "1", + "longName": "Prostate", + "context": "CTEP" + }, + { + "publicId": "2811911", + "version": "1", + "longName": "Upper GI", + "context": "CTEP" + }, + { + "publicId": "2811913", + "version": "1", + "longName": "Lymphoma", + "context": "CTEP" + }, + { + "publicId": "2811950", + "version": "1", + "longName": "Multiple Myeloma", + "context": "CTEP" + } + ] + }, + { + "publicId": "2008589", + "version": "2", + "longName": "Type of Category", + "context": "CTEP", + "ClassificationSchemeItems": [ + { + "publicId": "2811959", + "version": "1", + "longName": "Patient Char.", + "context": "CTEP" + }, + { + "publicId": "2811963", + "version": "1", + "longName": "Treatment", + "context": "CTEP" + } + ] + }, + { + "publicId": "2008594", + "version": "2.31", + "longName": "Trial Type Usages (CDE Disease Committees)", + "context": "CTEP", + "ClassificationSchemeItems": [ + { + "publicId": "2811904", + "version": "1", + "longName": "Multiple Myeloma", + "context": "CTEP" + }, + { + "publicId": "2811905", + "version": "1", + "longName": "Primary Amyloidosis", + "context": "CTEP" + }, + { + "publicId": "2811906", + "version": "1", + "longName": "Waldenstrom Macrogl", + "context": "CTEP" + }, + { + "publicId": "2811920", + "version": "1", + "longName": "Non-local Prostate", + "context": "CTEP" + }, + { + "publicId": "2811938", + "version": "1", + "longName": "Recurrent Gyn", + "context": "CTEP" + }, + { + "publicId": "2811943", + "version": "1", + "longName": "Hodgkin's Lymphoma", + "context": "CTEP" + }, + { + "publicId": "2811944", + "version": "1", + "longName": "NonHodgkins Lymphoma", + "context": "CTEP" + } + ] + }, + { + "publicId": "2552643", + "version": "1", + "longName": "Training Class Examples", + "context": "Training", + "ClassificationSchemeItems": [ + { + "publicId": "3637837", + "version": "1", + "longName": "Training", + "context": "Training" + } + ] + }, + { + "publicId": "2961451", + "version": "1", + "longName": "Children's Oncology Group (COG)", + "context": "COG", + "ClassificationSchemeItems": [ + { + "publicId": "3303197", + "version": "1", + "longName": "Phase 1/Pilot Consortium", + "context": "COG" + } + ] + }, + { + "publicId": "3335728", + "version": "1", + "longName": "Protocols", + "context": "ABTC", + "ClassificationSchemeItems": [ + { + "publicId": "3335732", + "version": "1", + "longName": "ABTC 0904", + "context": "ABTC" + } + ] + }, + { + "publicId": "4057943", + "version": "1", + "longName": "Disease Site", + "context": "NRG", + "ClassificationSchemeItems": [ + { + "publicId": "4104890", + "version": "1", + "longName": "GOG-0229L", + "context": "NRG" + }, + { + "publicId": "4104883", + "version": "1", + "longName": "GOG-0240", + "context": "NRG" + }, + { + "publicId": "4104897", + "version": "1", + "longName": "GOG-0250", + "context": "NRG" + }, + { + "publicId": "4104891", + "version": "1", + "longName": "GOG-0229N", + "context": "NRG" + }, + { + "publicId": "4104901", + "version": "1", + "longName": "GOG-0286B", + "context": "NRG" + }, + { + "publicId": "4104899", + "version": "1", + "longName": "GOG-0261", + "context": "NRG" + }, + { + "publicId": "4104892", + "version": "1", + "longName": "GOG-0229O", + "context": "NRG" + }, + { + "publicId": "4104941", + "version": "1", + "longName": "GOG-0281", + "context": "NRG" + }, + { + "publicId": "10000705", + "version": "1", + "longName": "GOG-0281", + "context": "NRG" + }, + { + "publicId": "10000276", + "version": "1", + "longName": "GOG-0283", + "context": "NRG" + }, + { + "publicId": "4104930", + "version": "1", + "longName": "GOG-0283", + "context": "NRG" + }, + { + "publicId": "10000275", + "version": "1", + "longName": "GOG-0283", + "context": "NRG" + } + ] + } + ], + "AlternateNames": [ + { + "name": "0062915", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0002355", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0002531", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0061399", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0058422", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0002464", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "0065215", + "type": "HISTORICAL_CDE_ID", + "context": "CTEP" + }, + { + "name": "PRIOR_CT_ADM_END_DT", + "type": "USED_BY", + "context": "CTEP" + }, + { + "name": "ABTC", + "type": "USED_BY", + "context": "ABTC" + }, + { + "name": "COG", + "type": "USED_BY", + "context": "COG" + }, + { + "name": "PRIOR_CT_ADM_END_DT", + "type": "USED_BY", + "context": "COG" + }, + { + "name": "PRIOR_CT_ADM_END_DT", + "type": "USED_BY", + "context": "Alliance" + }, + { + "name": "PRIOR_CT_ADM_END_DT", + "type": "USED_BY", + "context": "NRG" + }, + { + "name": "ECOG-ACRIN", + "type": "USED_BY", + "context": "ECOG-ACRIN" + }, + { + "name": "CMSTDAT_PRICHEMO", + "type": "OID, Alliance", + "context": "Alliance" + } + ], + "ReferenceDocuments": [ + { + "name": "Date Prior Chemotherapy Ended", + "type": "Preferred Question Text", + "description": "Date Prior Chemotherapy Ended", + "url": null, + "context": "CTEP" + }, + { + "name": "CRF Text", + "type": "Alternate Question Text", + "description": "Prior Chemotherapy End Date", + "url": null, + "context": "CTEP" + }, + { + "name": "Prior Chemotherapy Stop Date", + "type": "Alternate Question Text", + "description": "Prior Chemotherapy Stop Date", + "url": null, + "context": "CTEP" + }, + { + "name": "COG_CRF_TEXT_1", + "type": "Alternate Question Text", + "description": "Date of last dose of indicated agent", + "url": null, + "context": "CTEP" + }, + { + "name": "CRF Text2", + "type": "Alternate Question Text", + "description": "Last day of chemotherapy", + "url": null, + "context": "CTEP" + }, + { + "name": "CRF Text 1", + "type": "Alternate Question Text", + "description": "Date Ended", + "url": null, + "context": "CTEP" + }, + { + "name": "CRF Text3", + "type": "Alternate Question Text", + "description": "Date last chemotherapy treatment received", + "url": null, + "context": "CTEP" + }, + { + "name": "CRF Text4", + "type": "Alternate Question Text", + "description": "Date of completion of prior chemotherapy", + "url": null, + "context": "CTEP" + }, + { + "name": "COG_CRF_TEXT_2", + "type": "Alternate Question Text", + "description": "Date last Myelosuppressive Chemotherapy treatment received", + "url": null, + "context": "COG" + }, + { + "name": "ECOG CRF Text 1", + "type": "Alternate Question Text", + "description": "Date of last prior chemotherapy", + "url": null, + "context": "ECOG-ACRIN" + }, + { + "name": "ECOG CRF Text 2", + "type": "Alternate Question Text", + "description": "Date prior anthracycline therapy ended", + "url": null, + "context": "ECOG-ACRIN" + }, + { + "name": "ECOG CRF Text 3", + "type": "Alternate Question Text", + "description": "Date prior systemic doxorubicin ended", + "url": null, + "context": "ECOG-ACRIN" + }, + { + "name": "ECOG CRF Text 4", + "type": "Alternate Question Text", + "description": "Date prior Brentuximab ended", + "url": null, + "context": "ECOG-ACRIN" + }, + { + "name": "NRG_CRF_Text 1", + "type": "Alternate Question Text", + "description": "Date Prior Systemic Therapy Ended", + "url": null, + "context": "NRG" + }, + { + "name": "CRF Text5", + "type": "Alternate Question Text", + "description": "last date of chemotherapy", + "url": null, + "context": "Alliance" + }, + { + "name": "Prior Therapies Form", + "type": "Alternate Question Text", + "description": "Date (most recent) prior chemotherapy ended", + "url": null, + "context": "ECOG-ACRIN" + }, + { + "name": "CRF Text6", + "type": "Alternate Question Text", + "description": "last day of chemotherapy", + "url": null, + "context": "Alliance" + }, + { + "name": "CRF Text7", + "type": "Alternate Question Text", + "description": "last day of neoadjuvant chemotherapy", + "url": null, + "context": "Alliance" + }, + { + "name": "CRF Text8", + "type": "Alternate Question Text", + "description": "date of last chemotherapy", + "url": null, + "context": "Alliance" + }, + { + "name": "CRF Text9", + "type": "Alternate Question Text", + "description": "Chemotherapy Completion Date", + "url": null, + "context": "Alliance" + }, + { + "name": "Alliance A092105", + "type": "Alternate Question Text", + "description": "If Yes, Chemotherapy Completion Date", + "url": null, + "context": "Alliance" + } + ], + "origin": null, + "workflowStatus": "RELEASED", + "registrationStatus": "Qualified", + "id": "E55143E8-160F-321B-E034-0003BA3F9857", + "latestVersionIndicator": "Yes", + "beginDate": "2004-09-30", + "endDate": null, + "createdBy": "CAMPBELB", + "dateCreated": "2004-09-30", + "modifiedBy": "ZHWENDY", + "dateModified": "2023-04-06", + "changeDescription": "ISO compliance.", + "administrativeNotes": "2023/4/4: Added AQT for Alliance.wz", + "unresolvedIssues": null, + "deletedIndicator": "No" + } +} diff --git a/tests/resources/cadsr-swagger.json b/tests/resources/cadsr-swagger.json index 8053b9d..b4966f1 100644 --- a/tests/resources/cadsr-swagger.json +++ b/tests/resources/cadsr-swagger.json @@ -1,1436 +1,1570 @@ { - "swagger" : "2.0", - "info" : { - "description" : "API for caDSR object structures.", - "version" : "1.0", - "title" : "NCI API" + "swagger": "2.0", + "info": { + "description": "API for caDSR object structures.", + "version": "1.0", + "title": "NCI API" }, - "host" : "cadsrapi.cancer.gov", - "basePath" : "/rad/NCIAPI/1.0/api", - "tags" : [ { - "name" : "Data Element", - "description" : "A unit of data for which the definition, identification, representation and permissible values are specified by means of a set of attributes." - } ], - "schemes" : [ "https" ], - "consumes" : [ "application/json" ], - "produces" : [ "application/json", "application/xml" ], - "paths" : { - "/DataElement/{publicId}" : { - "get" : { - "tags" : [ "Data Element" ], - "description" : "GET full representation of Data Element object including all of it's lower level objects such as Value Domain, Data Element Concept, and Classifications, Reference Documents including Question Texts.\r\n\r\nExamples:\r\n\r\n- To get the latest version of Data Element with publicID of 62:\r\n /DataElement/62\r\n\r\n\r\n- To get specific version (e.g. version 4) of Data Element with publicId of 62:\r\n /DataElement/62?version=4", - "operationId" : "DataElementpublicId_GET_1", - "parameters" : [ { - "name" : "publicId", - "in" : "path", - "description" : "The unique identifier for an Administered Item within a Registration Authority. Example: 62", - "required" : true, - "type" : "string" - }, { - "name" : "version", - "in" : "query", - "description" : "The unique version identifier of the Administered Item.", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "OK", - "schema" : { - "$ref" : "#/definitions/DataElementpublicId_GET_response" + "host": "cadsrapi.cancer.gov", + "basePath": "/rad/NCIAPI/1.0/api", + "tags": [ + { + "name": "Data Element", + "description": "A unit of data for which the definition, identification, representation and permissible values are specified by means of a set of attributes." + } + ], + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "paths": { + "/DataElement/{publicId}": { + "get": { + "tags": [ + "Data Element" + ], + "description": "GET full representation of Data Element object including all of it's lower level objects such as Value Domain, Data Element Concept, and Classifications, Reference Documents including Question Texts.\r\n\r\nExamples:\r\n\r\n- To get the latest version of Data Element with publicID of 62:\r\n /DataElement/62\r\n\r\n\r\n- To get specific version (e.g. version 4) of Data Element with publicId of 62:\r\n /DataElement/62?version=4", + "operationId": "DataElementpublicId_GET_1", + "parameters": [ + { + "name": "publicId", + "in": "path", + "description": "The unique identifier for an Administered Item within a Registration Authority. Example: 62", + "required": true, + "type": "string" + }, + { + "name": "version", + "in": "query", + "description": "The unique version identifier of the Administered Item.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/DataElementpublicId_GET_response" } }, - "401" : { - "description" : "Access Denied" + "401": { + "description": "Access Denied" } } } }, - "/DataElement/query" : { - "get" : { - "tags" : [ "Data Element" ], - "description" : "GET list of Data Element objects with top level properties ONLY. \r\n\r\nExamples:\r\n\r\n- To get all versions of Data Element with publicID of 62:\r\n /DataElement?publicId=62", - "operationId" : "DataElementquery_GET_2", - "consumes" : [ "application/json" ], - "produces" : [ "application/json", "application/xml" ], - "parameters" : [ { - "name" : "publicId", - "in" : "query", - "description" : "The unique identifier for an Administered Item within a Registration Authority. Example: 62", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "OK", - "schema" : { - "$ref" : "#/definitions/DataElementquery_GET_response" + "/DataElement/query": { + "get": { + "tags": [ + "Data Element" + ], + "description": "GET list of Data Element objects with top level properties ONLY. \r\n\r\nExamples:\r\n\r\n- To get all versions of Data Element with publicID of 62:\r\n /DataElement?publicId=62", + "operationId": "DataElementquery_GET_2", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "publicId", + "in": "query", + "description": "The unique identifier for an Administered Item within a Registration Authority. Example: 62", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/DataElementquery_GET_response" } }, - "401" : { - "description" : "Access Denied" + "401": { + "description": "Access Denied" } } } }, - "/DataElement/query/Concept" : { - "get" : { - "tags" : [ "Data Element" ], - "description" : "Search for Data Element objects by Concept fields. User may search by either Concept Name (conceptLongName) or Concept Code (conceptCode). \r\n
\r\nConcept search may also utilize the exactMatch flag. For example if \"Gender\" is the search term and exactMatch is set to false, the search will return wildcard concept names that CONTAIN \"*Gender*\". If exactMatch is set to true the search will return concept names that ONLY match \"Gender\". The same rules apply to conceptCode as well.\r\n
\r\nConcept searches are not case sensitive. For example, search terms \"Gender\" and \"geNdEr\" will return the same results.\r\n
\r\nThe user may also \"filter\" the initial results by fields such as Primary Indicator, Order, Status, etc. At a minimum, either conceptLongName or conceptCode must be provided in the search query or no results will be returned. \r\n
\r\nThe maximum number of results per query is 1000. Please refine your search to bring back fewer results.", - "operationId" : "DataElementqueryConcept_GET_3", - "parameters" : [ { - "name" : "conceptLongName", - "in" : "query", - "description" : "A name by which an Administered Item (e.g. Concept) is designated within a specific Context. Example: \"Gender\".", - "required" : false, - "type" : "string" - }, { - "name" : "conceptCode", - "in" : "query", - "description" : "A code by which a Concept is designated. An example code would be \"C17357\".", - "required" : false, - "type" : "string" - }, { - "name" : "exactMatch", - "in" : "query", - "description" : "A flag to indicate the search term should look for an exact match. The default value is \"false\".", - "required" : false, - "type" : "string" - }, { - "name" : "conceptPrimaryIndicatorFilter", - "in" : "query", - "description" : "Filter results on the Primary Indicator field. Examples are 1 for true, 0 for false. If no value is specified, all results will be returned.", - "required" : false, - "type" : "string" - }, { - "name" : "conceptDisplayOrderFilter", - "in" : "query", - "description" : "Filter results on the Display Order field. Examples are ordered values 0, 1, 2, etc. If no value is specified, all results will be returned.", - "required" : false, - "type" : "string" - }, { - "name" : "itemTypeFilter", - "in" : "query", - "description" : "Filter results returning only the parent objects the Concept is attributed to. Examples are \"Object Class\", \"Property\", \"Value Meaning\" or \"Representation Term\". If no value is specified, all results will be returned.", - "required" : false, - "type" : "string" - }, { - "name" : "workflowStatusFilter", - "in" : "query", - "description" : "Filter results on the Workflow Status of the Data Element. Example is \"RELEASED\". If no value is specified, all results will be returned.", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "OK", - "schema" : { - "$ref" : "#/definitions/DataElementqueryConcept_GET_response" + "/DataElement/query/Concept": { + "get": { + "tags": [ + "Data Element" + ], + "description": "Search for Data Element objects by Concept fields. User may search by either Concept Name (conceptLongName) or Concept Code (conceptCode). \r\n
\r\nConcept search may also utilize the exactMatch flag. For example if \"Gender\" is the search term and exactMatch is set to false, the search will return wildcard concept names that CONTAIN \"*Gender*\". If exactMatch is set to true the search will return concept names that ONLY match \"Gender\". The same rules apply to conceptCode as well.\r\n
\r\nConcept searches are not case sensitive. For example, search terms \"Gender\" and \"geNdEr\" will return the same results.\r\n
\r\nThe user may also \"filter\" the initial results by fields such as Primary Indicator, Order, Status, etc. At a minimum, either conceptLongName or conceptCode must be provided in the search query or no results will be returned. \r\n
\r\nThe maximum number of results per query is 1000. Please refine your search to bring back fewer results.", + "operationId": "DataElementqueryConcept_GET_3", + "parameters": [ + { + "name": "conceptLongName", + "in": "query", + "description": "A name by which an Administered Item (e.g. Concept) is designated within a specific Context. Example: \"Gender\".", + "required": false, + "type": "string" + }, + { + "name": "conceptCode", + "in": "query", + "description": "A code by which a Concept is designated. An example code would be \"C17357\".", + "required": false, + "type": "string" + }, + { + "name": "exactMatch", + "in": "query", + "description": "A flag to indicate the search term should look for an exact match. The default value is \"false\".", + "required": false, + "type": "string" + }, + { + "name": "conceptPrimaryIndicatorFilter", + "in": "query", + "description": "Filter results on the Primary Indicator field. Examples are 1 for true, 0 for false. If no value is specified, all results will be returned.", + "required": false, + "type": "string" + }, + { + "name": "conceptDisplayOrderFilter", + "in": "query", + "description": "Filter results on the Display Order field. Examples are ordered values 0, 1, 2, etc. If no value is specified, all results will be returned.", + "required": false, + "type": "string" + }, + { + "name": "itemTypeFilter", + "in": "query", + "description": "Filter results returning only the parent objects the Concept is attributed to. Examples are \"Object Class\", \"Property\", \"Value Meaning\" or \"Representation Term\". If no value is specified, all results will be returned.", + "required": false, + "type": "string" + }, + { + "name": "workflowStatusFilter", + "in": "query", + "description": "Filter results on the Workflow Status of the Data Element. Example is \"RELEASED\". If no value is specified, all results will be returned.", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/DataElementqueryConcept_GET_response" } }, - "401" : { - "description" : "Access Denied" + "401": { + "description": "Access Denied" } } } }, - "/DataElement/getCRDCList" : { - "get" : { - "tags" : [ "Data Element" ], - "description" : "GET full representation of CRDC Data Elements.\r\n\r\nThere are no input parameters.", - "operationId" : "DataElementgetCRDCList_GET_4", - "parameters" : [ ], - "responses" : { - "200" : { - "description" : "OK", - "schema" : { - "$ref" : "#/definitions/DataElementgetCRDCList_GET_response" + "/DataElement/getCRDCList": { + "get": { + "tags": [ + "Data Element" + ], + "description": "GET full representation of CRDC Data Elements.\r\n\r\nThere are no input parameters.", + "operationId": "DataElementgetCRDCList_GET_4", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/DataElementgetCRDCList_GET_response" } }, - "401" : { - "description" : "Access Denied" + "401": { + "description": "Access Denied" } } } }, - "/DataElement/query/Context" : { - "get" : { - "tags" : [ "Data Element" ], - "description" : "GET list of Data Element objects by Context name with top level properties.\r\n\r\nExamples:\r\n\r\n- To get all versions of Data Element with context: NCI Standards\r\n /DataElement?contextName=NCI Standards", - "operationId" : "DataElementqueryContext_GET_5", - "parameters" : [ { - "name" : "contextName", - "in" : "query", - "description" : "The name of a Context object. Example: NCI Standards", - "required" : false, - "type" : "string" - } ], - "responses" : { - "200" : { - "description" : "OK", - "schema" : { - "$ref" : "#/definitions/DataElementqueryContext_GET_response" + "/DataElement/query/Context": { + "get": { + "tags": [ + "Data Element" + ], + "description": "GET list of Data Element objects by Context name with top level properties.\r\n\r\nExamples:\r\n\r\n- To get all versions of Data Element with context: NCI Standards\r\n /DataElement?contextName=NCI Standards", + "operationId": "DataElementqueryContext_GET_5", + "parameters": [ + { + "name": "contextName", + "in": "query", + "description": "The name of a Context object. Example: NCI Standards", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/DataElementqueryContext_GET_response" } }, - "401" : { - "description" : "Access Denied" + "401": { + "description": "Access Denied" } } } } }, - "definitions" : { - "ClassificationScheme" : { - "required" : [ "context", "longName", "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string" - }, - "longName" : { - "type" : "string" - }, - "context" : { - "type" : "string" - }, - "ClassificationSchemeItems" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/ClassificationSchemeItem" + "definitions": { + "ClassificationScheme": { + "required": [ + "context", + "longName", + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string" + }, + "longName": { + "type": "string" + }, + "context": { + "type": "string" + }, + "ClassificationSchemeItems": { + "type": "array", + "items": { + "$ref": "#/definitions/ClassificationSchemeItem" } } } }, - "Property" : { - "required" : [ "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "Concepts" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Concept" + "Property": { + "required": [ + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "Concepts": { + "type": "array", + "items": { + "$ref": "#/definitions/Concept" } }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "DataElementpublicId_GET_response" : { - "required" : [ "DataElement" ], - "properties" : { - "DataElement" : { - "$ref" : "#/definitions/DataElement" + "DataElementpublicId_GET_response": { + "required": [ + "DataElement" + ], + "properties": { + "DataElement": { + "$ref": "#/definitions/DataElement" } } }, - "DataElementgetCRDCList_GET_response" : { - "required" : [ "CRDCDataElements" ], - "properties" : { - "CRDCDataElements" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/CRDCDataElement" + "DataElementgetCRDCList_GET_response": { + "required": [ + "CRDCDataElements" + ], + "properties": { + "CRDCDataElements": { + "type": "array", + "items": { + "$ref": "#/definitions/CRDCDataElement" } } } }, - "DataElementqueryContext_GET_response" : { - "required" : [ "DataElementQueryResults", "numRecords" ], - "properties" : { - "numRecords" : { - "type" : "string" - }, - "DataElementQueryResults" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DataElementQuery" + "DataElementqueryContext_GET_response": { + "required": [ + "DataElementQueryResults", + "numRecords" + ], + "properties": { + "numRecords": { + "type": "string" + }, + "DataElementQueryResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DataElementQuery" } } } }, - "AlternateName" : { - "required" : [ "context", "name", "type" ], - "properties" : { - "name" : { - "type" : "string" - }, - "type" : { - "type" : "string" - }, - "context" : { - "type" : "string" + "AlternateName": { + "required": [ + "context", + "name", + "type" + ], + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "context": { + "type": "string" } } }, - "CRDCDataElement" : { - "properties" : { - "CDE Public ID" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "Version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "CRDC Name" : { - "type" : "string", - "description" : "CRDC Name" - }, - "CRD Domain" : { - "type" : "string", - "description" : "CRDC Domain" - }, - "Example" : { - "type" : "string", - "description" : "CRDC Example" - }, - "VD Type" : { - "type" : "string", - "description" : "Value Domain type" - }, - "Coding Instruction" : { - "type" : "string", - "description" : "CRDC Coding Instructions" - }, - "Instructions" : { - "type" : "string", - "description" : "CRDC Instructions" - }, - "CRDC Definition" : { - "type" : "string", - "description" : "CRD Definition" - }, - "CDE Long Name" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "Registration Status" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." - }, - "Workflow Status" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." - }, - "Owned By" : { - "type" : "string", - "description" : "Who owns the Data Element" - }, - "Used By" : { - "type" : "string", - "description" : "Who is using the Data Element" - }, - "Deep Link" : { - "type" : "string" - }, - "permissibleValues" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/permissibleValue" + "CRDCDataElement": { + "properties": { + "CDE Public ID": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "Version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "CRDC Name": { + "type": "string", + "description": "CRDC Name" + }, + "CRD Domain": { + "type": "string", + "description": "CRDC Domain" + }, + "Example": { + "type": "string", + "description": "CRDC Example" + }, + "VD Type": { + "type": "string", + "description": "Value Domain type" + }, + "Coding Instruction": { + "type": "string", + "description": "CRDC Coding Instructions" + }, + "Instructions": { + "type": "string", + "description": "CRDC Instructions" + }, + "CRDC Definition": { + "type": "string", + "description": "CRD Definition" + }, + "CDE Long Name": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "Registration Status": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." + }, + "Workflow Status": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + }, + "Owned By": { + "type": "string", + "description": "Who owns the Data Element" + }, + "Used By": { + "type": "string", + "description": "Who is using the Data Element" + }, + "Deep Link": { + "type": "string" + }, + "permissibleValues": { + "type": "array", + "items": { + "$ref": "#/definitions/permissibleValue" } } } }, - "ConceptualDomain" : { - "required" : [ "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." - }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." - }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." - }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." - }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." - }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." - }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." - }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." - }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." - }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" - }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" - }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." - }, - "administrativeNotes" : { - "type" : "string" - }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." - }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "ConceptualDomain": { + "required": [ + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." + }, + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + }, + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." + }, + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." + }, + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." + }, + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." + }, + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." + }, + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." + }, + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." + }, + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" + }, + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" + }, + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." + }, + "administrativeNotes": { + "type": "string" + }, + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." + }, + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "ClassificationSchemeItem" : { - "required" : [ "context", "longName", "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string" - }, - "longName" : { - "type" : "string" - }, - "context" : { - "type" : "string" + "ClassificationSchemeItem": { + "required": [ + "context", + "longName", + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string" + }, + "longName": { + "type": "string" + }, + "context": { + "type": "string" } } }, - "DataElementqueryConcept_GET_response" : { - "required" : [ "DataElementQueryResults", "numRecords" ], - "properties" : { - "numRecords" : { - "type" : "string" - }, - "DataElementQueryResults" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DataElementQuery" + "DataElementqueryConcept_GET_response": { + "required": [ + "DataElementQueryResults", + "numRecords" + ], + "properties": { + "numRecords": { + "type": "string" + }, + "DataElementQueryResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DataElementQuery" } } } }, - "DataElement" : { - "required" : [ "AlternateNames", "ClassificationSchemes", "DataElementConcept", "ReferenceDocuments", "ValueDomain", "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "DataElementConcept" : { - "$ref" : "#/definitions/DataElementConcept" - }, - "ValueDomain" : { - "$ref" : "#/definitions/ValueDomain" - }, - "ClassificationSchemes" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/ClassificationScheme" + "DataElement": { + "required": [ + "AlternateNames", + "ClassificationSchemes", + "DataElementConcept", + "ReferenceDocuments", + "ValueDomain", + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "DataElementConcept": { + "$ref": "#/definitions/DataElementConcept" + }, + "ValueDomain": { + "$ref": "#/definitions/ValueDomain" + }, + "ClassificationSchemes": { + "type": "array", + "items": { + "$ref": "#/definitions/ClassificationScheme" } }, - "AlternateNames" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AlternateName" + "AlternateNames": { + "type": "array", + "items": { + "$ref": "#/definitions/AlternateName" } }, - "ReferenceDocuments" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/ReferenceDocument" + "ReferenceDocuments": { + "type": "array", + "items": { + "$ref": "#/definitions/ReferenceDocument" } }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "ValueDomain" : { - "required" : [ "ConceptualDomain", "PermissibleValues", "RepresentationTerm", "characterSet", "context", "contextVersion", "dataType", "decimalPlace", "format", "longName", "maxLength", "maxValue", "minLength", "minValue", "preferredDefinition", "preferredName", "publicId", "type", "unitOfMeasure", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "type" : { - "type" : "string" - }, - "dataType" : { - "type" : "string" - }, - "unitOfMeasure" : { - "type" : "string" - }, - "characterSet" : { - "type" : "string" - }, - "minLength" : { - "type" : "string" - }, - "maxLength" : { - "type" : "string" - }, - "minValue" : { - "type" : "string" - }, - "maxValue" : { - "type" : "string" - }, - "decimalPlace" : { - "type" : "string" - }, - "format" : { - "type" : "string" - }, - "PermissibleValues" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/PermissibleValue" + "ValueDomain": { + "required": [ + "ConceptualDomain", + "PermissibleValues", + "RepresentationTerm", + "characterSet", + "context", + "contextVersion", + "dataType", + "decimalPlace", + "format", + "longName", + "maxLength", + "maxValue", + "minLength", + "minValue", + "preferredDefinition", + "preferredName", + "publicId", + "type", + "unitOfMeasure", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "type": { + "type": "string" + }, + "dataType": { + "type": "string" + }, + "unitOfMeasure": { + "type": "string" + }, + "characterSet": { + "type": "string" + }, + "minLength": { + "type": "string" + }, + "maxLength": { + "type": "string" + }, + "minValue": { + "type": "string" + }, + "maxValue": { + "type": "string" + }, + "decimalPlace": { + "type": "string" + }, + "format": { + "type": "string" + }, + "PermissibleValues": { + "type": "array", + "items": { + "$ref": "#/definitions/PermissibleValue" } }, - "ConceptualDomain" : { - "$ref" : "#/definitions/ConceptualDomain" + "ConceptualDomain": { + "$ref": "#/definitions/ConceptualDomain" }, - "RepresentationTerm" : { - "$ref" : "#/definitions/RepresentationTerm" + "RepresentationTerm": { + "$ref": "#/definitions/RepresentationTerm" }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "ObjectClass" : { - "required" : [ "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "Concepts" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Concept" + "ObjectClass": { + "required": [ + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "Concepts": { + "type": "array", + "items": { + "$ref": "#/definitions/Concept" } }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "DataElementquery_GET_response" : { - "required" : [ "DataElementQueryResults", "numRecords" ], - "properties" : { - "numRecords" : { - "type" : "string" - }, - "DataElementQueryResults" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/DataElementQuery" + "DataElementquery_GET_response": { + "required": [ + "DataElementQueryResults", + "numRecords" + ], + "properties": { + "numRecords": { + "type": "string" + }, + "DataElementQueryResults": { + "type": "array", + "items": { + "$ref": "#/definitions/DataElementQuery" } } } }, - "Concept" : { - "properties" : { - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." + "Concept": { + "properties": { + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." }, - "conceptCode" : { - "type" : "string" + "conceptCode": { + "type": "string" }, - "definition" : { - "type" : "string" + "definition": { + "type": "string" }, - "evsSource" : { - "type" : "string", - "description" : "The name of the EVS concept code that was the source for the concept identifier." + "evsSource": { + "type": "string", + "description": "The name of the EVS concept code that was the source for the concept identifier." }, - "primaryIndicator" : { - "type" : "string" + "primaryIndicator": { + "type": "string" }, - "displayOrder" : { - "type" : "string" + "displayOrder": { + "type": "string" } } }, - "DataElementConcept" : { - "required" : [ "ConceptualDomain", "ObjectClass", "Property", "context", "contextVersion", "longName", "preferredDefinition", "preferredName", "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "ObjectClass" : { - "$ref" : "#/definitions/ObjectClass" - }, - "Property" : { - "$ref" : "#/definitions/Property" - }, - "ConceptualDomain" : { - "$ref" : "#/definitions/ConceptualDomain" - }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." - }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." - }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." - }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." - }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." - }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." - }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." - }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." - }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." - }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" - }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" - }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." - }, - "administrativeNotes" : { - "type" : "string" - }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." - }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "DataElementConcept": { + "required": [ + "ConceptualDomain", + "ObjectClass", + "Property", + "context", + "contextVersion", + "longName", + "preferredDefinition", + "preferredName", + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "ObjectClass": { + "$ref": "#/definitions/ObjectClass" + }, + "Property": { + "$ref": "#/definitions/Property" + }, + "ConceptualDomain": { + "$ref": "#/definitions/ConceptualDomain" + }, + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." + }, + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + }, + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." + }, + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." + }, + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." + }, + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." + }, + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." + }, + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." + }, + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." + }, + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" + }, + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" + }, + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." + }, + "administrativeNotes": { + "type": "string" + }, + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." + }, + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "ValueMeaning" : { - "required" : [ "context", "contextVersion", "longName", "preferredDefinition", "preferredName", "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "Concepts" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Concept" + "ValueMeaning": { + "required": [ + "context", + "contextVersion", + "longName", + "preferredDefinition", + "preferredName", + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "Concepts": { + "type": "array", + "items": { + "$ref": "#/definitions/Concept" } }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "RepresentationTerm" : { - "required" : [ "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "context" : { - "type" : "string", - "description" : "An associated gov.nih.nci.cadsr.domain.Context object" - }, - "contextVersion" : { - "type" : "string" - }, - "Concepts" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Concept" + "RepresentationTerm": { + "required": [ + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "context": { + "type": "string", + "description": "An associated gov.nih.nci.cadsr.domain.Context object" + }, + "contextVersion": { + "type": "string" + }, + "Concepts": { + "type": "array", + "items": { + "$ref": "#/definitions/Concept" } }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" }, - "changeDescription" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." + "changeDescription": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." }, - "administrativeNotes" : { - "type" : "string" + "administrativeNotes": { + "type": "string" }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "ReferenceDocument" : { - "properties" : { - "name" : { - "type" : "string" + "ReferenceDocument": { + "properties": { + "name": { + "type": "string" }, - "type" : { - "type" : "string" + "type": { + "type": "string" }, - "description" : { - "type" : "string" + "description": { + "type": "string" }, - "url" : { - "type" : "string" + "url": { + "type": "string" }, - "context" : { - "type" : "string" + "context": { + "type": "string" } } }, - "PermissibleValue" : { - "required" : [ "ValueMeaning", "publicId", "value", "valueDescription" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for a Permissible Value" - }, - "value" : { - "type" : "string", - "description" : "A representation of a Value Meaning in a specific Value Domain the actual Value." - }, - "valueDescription" : { - "type" : "string", - "description" : "The text of the most desirable meaning for Value" - }, - "ValueMeaning" : { - "$ref" : "#/definitions/ValueMeaning" - }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." - }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." - }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." - }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." - }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." - }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." - }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" - }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" - }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "PermissibleValue": { + "required": [ + "ValueMeaning", + "publicId", + "value", + "valueDescription" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for a Permissible Value" + }, + "value": { + "type": "string", + "description": "A representation of a Value Meaning in a specific Value Domain the actual Value." + }, + "valueDescription": { + "type": "string", + "description": "The text of the most desirable meaning for Value" + }, + "ValueMeaning": { + "$ref": "#/definitions/ValueMeaning" + }, + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." + }, + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." + }, + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." + }, + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." + }, + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." + }, + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." + }, + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" + }, + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" + }, + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "DataElementQuery" : { - "required" : [ "publicId", "version" ], - "properties" : { - "publicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "version" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "preferredName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context. Referred to as Short Name." - }, - "preferredDefinition" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "longName" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "contextName" : { - "type" : "string", - "description" : "A 30 character limit name by which an Administered Item is designated within a specific Context." - }, - "contextVersion" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "dataElementConceptPublicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "dataElementConceptVersion" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "valueDomainPublicId" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "valueDomainVersion" : { - "type" : "string", - "description" : "The unique version identifier of the Administered Item." - }, - "origin" : { - "type" : "string", - "description" : "The source (document, project, discipline or model) for the Administered Item." - }, - "workflowStatus" : { - "type" : "string", - "description" : "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." - }, - "registrationStatus" : { - "type" : "string", - "description" : "A designation of the status in the registration life-cycle of an Administered Item." - }, - "id" : { - "type" : "string", - "description" : "The 36 character caDSR database identifier." - }, - "latestVersionIndicator" : { - "type" : "string", - "description" : "The present form of an Administered Item." - }, - "beginDate" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." - }, - "endDate" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." - }, - "createdBy" : { - "type" : "string", - "description" : "This is a description of createdBy." - }, - "dateCreated" : { - "type" : "string", - "description" : "The date the Administered Item was created." - }, - "modifiedBy" : { - "type" : "string", - "description" : "Username of the person who modified the record" - }, - "dateModified" : { - "type" : "string", - "description" : "Date on which the record was modified; last date the object was modified" - }, - "changeNote" : { - "type" : "string", - "description" : "The description of what has changed in the Administered Item since the prior version of the Administered Item." - }, - "administrativeNotes" : { - "type" : "string" - }, - "unresolvedIssues" : { - "type" : "string", - "description" : "Any problem that remains unresolved regarding proper documentation of the Administered Item." - }, - "deletedIndicator" : { - "type" : "string", - "description" : "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." + "DataElementQuery": { + "required": [ + "publicId", + "version" + ], + "properties": { + "publicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "version": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "preferredName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context. Referred to as Short Name." + }, + "preferredDefinition": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "longName": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "contextName": { + "type": "string", + "description": "A 30 character limit name by which an Administered Item is designated within a specific Context." + }, + "contextVersion": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "dataElementConceptPublicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "dataElementConceptVersion": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "valueDomainPublicId": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "valueDomainVersion": { + "type": "string", + "description": "The unique version identifier of the Administered Item." + }, + "origin": { + "type": "string", + "description": "The source (document, project, discipline or model) for the Administered Item." + }, + "workflowStatus": { + "type": "string", + "description": "A name of a designation of the status in the administrative life-cycle of a Context Owner for handling new administered items." + }, + "registrationStatus": { + "type": "string", + "description": "A designation of the status in the registration life-cycle of an Administered Item." + }, + "id": { + "type": "string", + "description": "The 36 character caDSR database identifier." + }, + "latestVersionIndicator": { + "type": "string", + "description": "The present form of an Administered Item." + }, + "beginDate": { + "type": "string", + "description": "The particular day, month and year this item became allowed." + }, + "endDate": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." + }, + "createdBy": { + "type": "string", + "description": "This is a description of createdBy." + }, + "dateCreated": { + "type": "string", + "description": "The date the Administered Item was created." + }, + "modifiedBy": { + "type": "string", + "description": "Username of the person who modified the record" + }, + "dateModified": { + "type": "string", + "description": "Date on which the record was modified; last date the object was modified" + }, + "changeNote": { + "type": "string", + "description": "The description of what has changed in the Administered Item since the prior version of the Administered Item." + }, + "administrativeNotes": { + "type": "string" + }, + "unresolvedIssues": { + "type": "string", + "description": "Any problem that remains unresolved regarding proper documentation of the Administered Item." + }, + "deletedIndicator": { + "type": "string", + "description": "An indicator that characterizes the item as eliminated from the registry, thought the physical record still exists." } } }, - "permissibleValue" : { - "properties" : { - "Permissible Value" : { - "type" : "string", - "description" : "A representation of a Value Meaning in a specific Value Domain the actual Value." - }, - "VM Long Name" : { - "type" : "string", - "description" : "A 255 character limit name for an item in the registry." - }, - "VM Public ID" : { - "type" : "string", - "description" : "The unique identifier for an Administered Item within a Registration Authority." - }, - "Concept Code" : { - "type" : "string" - }, - "VM Description" : { - "type" : "string", - "description" : "The text of the most desirable meaning for the Administered Item." - }, - "Begin Date" : { - "type" : "string", - "description" : "The particular day, month and year this item became allowed." - }, - "End Date" : { - "type" : "string", - "description" : "The day, month and year this item becomes no longer allowed." + "permissibleValue": { + "properties": { + "Permissible Value": { + "type": "string", + "description": "A representation of a Value Meaning in a specific Value Domain the actual Value." + }, + "VM Long Name": { + "type": "string", + "description": "A 255 character limit name for an item in the registry." + }, + "VM Public ID": { + "type": "string", + "description": "The unique identifier for an Administered Item within a Registration Authority." + }, + "Concept Code": { + "type": "string" + }, + "VM Description": { + "type": "string", + "description": "The text of the most desirable meaning for the Administered Item." + }, + "Begin Date": { + "type": "string", + "description": "The particular day, month and year this item became allowed." + }, + "End Date": { + "type": "string", + "description": "The day, month and year this item becomes no longer allowed." } }, - "description" : "List of Permissible Values" + "description": "List of Permissible Values" } } } diff --git a/tests/resources/test.kwalify.yaml b/tests/resources/test.kwalify.yaml new file mode 100644 index 0000000..a913c49 --- /dev/null +++ b/tests/resources/test.kwalify.yaml @@ -0,0 +1,71 @@ +type: map +mapping: + "id": + type: str + required: true + "title": + type: str + required: true + "preferred label": + type: str + required: true + "type": + type: str + required: true + enum: [blacklist, binning subset, ribbon, tag] + "status": + type: str + required: true + enum: [active, obsolete] + "description": + type: str + required: true + "taxon": + - type: map + mapping: + "id": + type: str + required: true + pattern: /NCBITaxon\:\d+/ + "label": + type: str + required: true + "github": + - type: map + mapping: + "tracker": + type: string + required: true+ + pattern: /https:\/\/github\.com\/geneontology[^\s]+/ + "contact": + - type: map + mapping: + "email": + type: str + required: true + pattern: /[^\s]+@[^\s]+\.[^\s]+/ + "label": + type: str + required: true + "contributors": + - type: map + mapping: + "email": + type: str + required: true + pattern: /[^\s]+@[^\s]+\.[^\s]+/ + "label": + type: str + required: true + "orcid": + type: str + required: false + pattern: /https:\/\/orcid.org\/\d{4}\-\d{4}\-\d{4}\-\d{4}/ + "github": + type: str + required: false + + + + + diff --git a/tests/resources/test2.kwalify.yaml b/tests/resources/test2.kwalify.yaml new file mode 100644 index 0000000..59ee1c9 --- /dev/null +++ b/tests/resources/test2.kwalify.yaml @@ -0,0 +1,149 @@ +#### +#### Use kwalify and this schema to validate the config files. +#### Example: +#### kwalify -E -m ./metadata/datasets.schema.yaml +#### kwalify -E -f ./metadata/datasets.schema.yaml ./metadata/FOO.yaml +#### +#### To convert to JSON once passed: +#### ./node_modules/yamljs/bin/yaml2json -p ./metadata/datasets.yaml > ./metadata/datasets.json +#### +type: map +mapping: + "id": + type: str + required: true + unique: true + "label": + type: str + required: true + unique: true + "description": + type: str + required: true + unique: true + "project_name": + type: str + required: false + unique: false + "contact_email": + type: str + required: false + unique: false + "project_url": + type: str + required: false + unique: false + "funding_source": + type: str + required: false + unique: false + "email_report": + type: str + required: false + unique: false + "filter_out": + type: map + required: false + mapping: + "evidence": + type: seq + required: false + sequence: + - type: str + pattern: /ECO:[0-9]{7}/ + "evidence_reference": + type: seq + required: false + sequence: + - type: map + mapping: + "evidence": + type: str + required: true + pattern: /ECO:[0-9]{7}/ + "reference": + type: str + required: true + "annotation_properties": + type: seq + required: false + sequence: + - type: str + "datasets": + type: seq + required: true + sequence: + - type: map + mapping: + "id": + type: str + required: true + unique: true + "label": + type: str + required: true + unique: true + "description": + type: str + required: true + unique: true + "url": + type: str + required: false + unique: true + "type": + type: str + required: true + unique: false + "dataset": + type: str + required: true + unique: false + "submitter": + type: str + required: true + unique: false + "compression": + type: str + required: false + unique: false + enum: ['', gzip] + "source": + type: str + required: false + unique: false + "mirror_of": + type: str + required: false + unique: false + "species_code": + type: str + required: false + unique: false + "merges_into": + type: str + required: false + unique: false + "import": + type: bool + required: false + "entity_type": + type: str + required: false + unique: false + "aggregates": + type: str + required: false + unique: false + "status": + type: str + required: false + unique: false + "taxa": + type: seq + required: false + sequence: + - type: str + "exclude": + type: bool + required: false diff --git a/tests/test_importers/test_cadsr_importer.py b/tests/test_importers/test_cadsr_importer.py index d97bdbd..da1ea8e 100644 --- a/tests/test_importers/test_cadsr_importer.py +++ b/tests/test_importers/test_cadsr_importer.py @@ -23,4 +23,13 @@ def test_cadsr_import(): _sv = SchemaView(schema) with open(OWL_OUT, "w", encoding="utf-8") as stream: owlgen = OwlSchemaGenerator(OUT, add_root_classes=True, metaclasses=False, type_objects=False) - stream.write(owlgen.serialize()) \ No newline at end of file + stream.write(owlgen.serialize()) + + +def test_cadsr_to_table(): + ie = CADSRImportEngine() + paths = [os.path.join(INPUT_DIR, f"cadsr-cde-{i}.json") for i in IDS] + rows = list(ie.as_rows(paths)) + assert rows + for row in rows: + print(row) diff --git a/tests/test_importers/test_kwalify_importer.py b/tests/test_importers/test_kwalify_importer.py new file mode 100644 index 0000000..12b9c9c --- /dev/null +++ b/tests/test_importers/test_kwalify_importer.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +import os +from pathlib import Path + +import pytest +from linkml.generators.pythongen import PythonGenerator +from linkml_runtime import SchemaView +from schema_automator.importers.kwalify_import_engine import KwalifyImportEngine +from schema_automator.utils import write_schema +from tests import INPUT_DIR, OUTPUT_DIR + + +EXPECTED_TEST1 = """ + status: + range: MySchema_status_enum + required: true + description: + range: string + required: true + taxon: + range: Taxon + required: false +""" + + +@pytest.mark.parametrize('test_input,schema_id, schema_name,class_name,expected', [ + ("test2", None, None, None, None), + ("test", None, None, None, None), + ("test", None, "my_schema", None, [EXPECTED_TEST1]), +]) +def test_kwalify_import(test_input, schema_id, schema_name, class_name, expected): + """ + Test importing kwalify + """ + ie = KwalifyImportEngine() + in_path = Path(INPUT_DIR) / f"{test_input}.kwalify.yaml" + out_path = str(Path(OUTPUT_DIR) / f"{test_input}-from-kwalify.yaml") + schema = ie.convert(in_path, + id=schema_id, name=schema_name, + class_name=class_name) + write_schema(schema, out_path) + schema_str = open(out_path).read() + py_str = PythonGenerator(out_path).serialize() + assert py_str is not None + _sv = SchemaView(schema) + if expected: + for e in expected: + assert e in schema_str + + + +