From fcbac16653c5f872b658b700d409362b524627e9 Mon Sep 17 00:00:00 2001 From: Dave Iberson-Hurst Date: Wed, 20 Dec 2023 13:57:38 +0100 Subject: [PATCH 1/5] Fix bug, should be a list of administrations --- model/study_intervention.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/study_intervention.py b/model/study_intervention.py index 2f9b367..fde1afa 100644 --- a/model/study_intervention.py +++ b/model/study_intervention.py @@ -9,7 +9,7 @@ class StudyIntervention(ApiBaseModelWithIdNameLabelAndDesc): type: Code minimumResponseDuration: Quantity codes: List[Code] = [] - administrations: AgentAdministration + administrations: List[AgentAdministration] productDesignation: Code pharmacologicClass: Code instanceType: Literal['StudyIntervention'] = 'StudyIntervention' From ef363925b8929cc853537ce1b32df98eed960d8d Mon Sep 17 00:00:00 2001 From: Dave Iberson-Hurst Date: Wed, 20 Dec 2023 15:17:39 +0100 Subject: [PATCH 2/5] Consistency and style tweaks --- model/administration_duration.py | 10 +++++----- model/agent_administration.py | 10 +++++----- model/biomedical_concept.py | 2 +- model/characteristic.py | 2 +- model/code.py | 2 +- model/eligibility_criteria.py | 2 +- model/encounter.py | 2 +- model/geographic_scope.py | 4 ++-- model/intercurrent_event.py | 4 ++-- model/objective.py | 2 +- model/response_code.py | 2 +- model/study_amendment.py | 2 +- model/study_design.py | 2 +- model/study_identifier.py | 4 ++-- model/syntax_template.py | 2 +- model/transition_rule.py | 2 +- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/model/administration_duration.py b/model/administration_duration.py index 386fe29..42b05bd 100644 --- a/model/administration_duration.py +++ b/model/administration_duration.py @@ -3,8 +3,8 @@ from typing import Literal class AdministrationDuration(ApiBaseModelWithId): - quantity: Quantity - description: str - durationWillVary: bool - reasonDurationWillVary: str - instanceType: Literal['AdministrationDuration'] = 'AdministrationDuration' + quantity: Quantity + description: str + durationWillVary: bool + reasonDurationWillVary: str + instanceType: Literal['AdministrationDuration'] = 'AdministrationDuration' diff --git a/model/agent_administration.py b/model/agent_administration.py index b566a53..99d425f 100644 --- a/model/agent_administration.py +++ b/model/agent_administration.py @@ -5,8 +5,8 @@ from typing import Literal class AgentAdministration(ApiBaseModelWithIdNameLabelAndDesc): - duration: AdministrationDuration - dose: Quantity - route: Code - frequency: Code - instanceType: Literal['AgentAdministration'] = 'AgentAdministration' + duration: AdministrationDuration + dose: Quantity + route: Code + frequency: Code + instanceType: Literal['AgentAdministration'] = 'AgentAdministration' diff --git a/model/biomedical_concept.py b/model/biomedical_concept.py index 2f6e61f..209a42e 100644 --- a/model/biomedical_concept.py +++ b/model/biomedical_concept.py @@ -8,4 +8,4 @@ class BiomedicalConcept(ApiBaseModelWithIdNameAndLabel): reference: str properties: List[BiomedicalConceptProperty] = [] code: AliasCode - instanceType: Literal['BiomedicalConcept'] = 'BiomedicalConcept' \ No newline at end of file + instanceType: Literal['BiomedicalConcept'] = 'BiomedicalConcept' diff --git a/model/characteristic.py b/model/characteristic.py index 04c418b..6416977 100644 --- a/model/characteristic.py +++ b/model/characteristic.py @@ -2,4 +2,4 @@ from .syntax_template import SyntaxTemplate class Characteristic(SyntaxTemplate): - instanceType: Literal['Characteristic'] = 'Characteristic' \ No newline at end of file + instanceType: Literal['Characteristic'] = 'Characteristic' diff --git a/model/code.py b/model/code.py index 2139bcc..de76cfe 100644 --- a/model/code.py +++ b/model/code.py @@ -1,5 +1,5 @@ -from .api_base_model import ApiBaseModelWithId from typing import Literal +from .api_base_model import ApiBaseModelWithId class Code(ApiBaseModelWithId): code: str diff --git a/model/eligibility_criteria.py b/model/eligibility_criteria.py index eb56d7b..885a8be 100644 --- a/model/eligibility_criteria.py +++ b/model/eligibility_criteria.py @@ -8,4 +8,4 @@ class EligibilityCriteria(SyntaxTemplate): nextId: Union[str, None] = None previousId: Union[str, None] = None contextId: Union[str, None] = None - instanceType: Literal['EligibilityCriteria'] = 'EligibilityCriteria' \ No newline at end of file + instanceType: Literal['EligibilityCriteria'] = 'EligibilityCriteria' diff --git a/model/encounter.py b/model/encounter.py index 2293215..6f230c0 100644 --- a/model/encounter.py +++ b/model/encounter.py @@ -12,4 +12,4 @@ class Encounter(ApiBaseModelWithIdNameLabelAndDesc): contactModes: List[Code] = [] transitionStartRule: Union[TransitionRule, None] = None transitionEndRule: Union[TransitionRule, None] = None - instanceType: Literal['Encounter'] = 'Encounter' \ No newline at end of file + instanceType: Literal['Encounter'] = 'Encounter' diff --git a/model/geographic_scope.py b/model/geographic_scope.py index 7d07006..889c170 100644 --- a/model/geographic_scope.py +++ b/model/geographic_scope.py @@ -6,8 +6,8 @@ class GeographicScope(ApiBaseModelWithId): type: Code code: Union[AliasCode, None] = None - instanceType: Literal['GeographicScope'] + instanceType: Literal['GeographicScope'] = 'GeographicScope' class SubjectEnrollment(GeographicScope): quantity: str - instanceType: Literal['SubjectEnrollment'] = 'SubjectEnrollment' \ No newline at end of file + instanceType: Literal['SubjectEnrollment'] = 'SubjectEnrollment' diff --git a/model/intercurrent_event.py b/model/intercurrent_event.py index 436f919..dc55ce2 100644 --- a/model/intercurrent_event.py +++ b/model/intercurrent_event.py @@ -1,6 +1,6 @@ -from .api_base_model import ApiBaseModelWithIdNameLabelAndDesc from typing import Literal +from .api_base_model import ApiBaseModelWithIdNameLabelAndDesc class IntercurrentEvent(ApiBaseModelWithIdNameLabelAndDesc): strategy: str - instanceType: Literal['IntercurrentEvent'] = 'IntercurrentEvent' \ No newline at end of file + instanceType: Literal['IntercurrentEvent'] = 'IntercurrentEvent' diff --git a/model/objective.py b/model/objective.py index 6833066..5fee361 100644 --- a/model/objective.py +++ b/model/objective.py @@ -6,4 +6,4 @@ class Objective(SyntaxTemplate): level: Union[Code, None] = None endpoints: List[Endpoint] = [] - instanceType: Literal['Objective'] = 'Objective' \ No newline at end of file + instanceType: Literal['Objective'] = 'Objective' diff --git a/model/response_code.py b/model/response_code.py index 437b5fa..2c70b38 100644 --- a/model/response_code.py +++ b/model/response_code.py @@ -1,6 +1,6 @@ +from typing import Literal from .api_base_model import ApiBaseModelWithId from .code import Code -from typing import Literal class ResponseCode(ApiBaseModelWithId): isEnabled: bool diff --git a/model/study_amendment.py b/model/study_amendment.py index ccb4611..0bbabf5 100644 --- a/model/study_amendment.py +++ b/model/study_amendment.py @@ -11,4 +11,4 @@ class StudyAmendment(ApiBaseModelWithId): secondaryReasons: List[StudyAmendmentReason] = [] enrollments: List[SubjectEnrollment] previousId: Union[str, None] = None - instanceType: Literal['StudyAmendment'] = 'StudyAmendment' \ No newline at end of file + instanceType: Literal['StudyAmendment'] = 'StudyAmendment' diff --git a/model/study_design.py b/model/study_design.py index 1dec57c..ffb112b 100644 --- a/model/study_design.py +++ b/model/study_design.py @@ -53,4 +53,4 @@ class StudyDesign(ApiBaseModelWithIdNameLabelAndDesc): dictionaries: List[SyntaxTemplateDictionary] = [] conditions: List[Condition] = [] organizations: List[ResearchOrganization] = [] - instanceType: Literal['StudyDesign'] = 'StudyDesign' \ No newline at end of file + instanceType: Literal['StudyDesign'] = 'StudyDesign' diff --git a/model/study_identifier.py b/model/study_identifier.py index b31c2ab..679755a 100644 --- a/model/study_identifier.py +++ b/model/study_identifier.py @@ -1,8 +1,8 @@ +from typing import Literal from .api_base_model import ApiBaseModelWithId from .organization import Organization -from typing import Literal class StudyIdentifier(ApiBaseModelWithId): studyIdentifier: str studyIdentifierScope: Organization - instanceType: Literal['StudyIdentifier'] = 'StudyIdentifier' \ No newline at end of file + instanceType: Literal['StudyIdentifier'] = 'StudyIdentifier' diff --git a/model/syntax_template.py b/model/syntax_template.py index 6ee45c0..bc3ca6d 100644 --- a/model/syntax_template.py +++ b/model/syntax_template.py @@ -4,4 +4,4 @@ class SyntaxTemplate(ApiBaseModelWithIdNameLabelAndDesc): text: str dictionaryId: Union[str, None] = None - instanceType: Literal['SyntaxTemplate'] = 'SyntaxTemplate' \ No newline at end of file + instanceType: Literal['SyntaxTemplate'] = 'SyntaxTemplate' diff --git a/model/transition_rule.py b/model/transition_rule.py index 0eb28b9..1aa03f8 100644 --- a/model/transition_rule.py +++ b/model/transition_rule.py @@ -3,4 +3,4 @@ class TransitionRule(ApiBaseModelWithIdNameLabelAndDesc): text: str - instanceType: Literal['TransitionRule'] = 'TransitionRule' \ No newline at end of file + instanceType: Literal['TransitionRule'] = 'TransitionRule' From b17c99e6b2a3a21d26381165ec47a76ef8aea15b Mon Sep 17 00:00:00 2001 From: Dave Iberson-Hurst Date: Wed, 20 Dec 2023 15:19:07 +0100 Subject: [PATCH 3/5] Update specification --- docs/USDM_API.json | 24 ++++++++++++++++-------- docs/USDM_API.yaml | 14 ++++++++++---- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/USDM_API.json b/docs/USDM_API.json index c0bc3d1..49cf04f 100644 --- a/docs/USDM_API.json +++ b/docs/USDM_API.json @@ -1908,14 +1908,14 @@ }, "instanceType": { "const": "GeographicScope", - "title": "Instancetype" + "title": "Instancetype", + "default": "GeographicScope" } }, "type": "object", "required": [ "id", - "type", - "instanceType" + "type" ], "title": "GeographicScope" }, @@ -1941,14 +1941,14 @@ }, "instanceType": { "const": "GeographicScope", - "title": "Instancetype" + "title": "Instancetype", + "default": "GeographicScope" } }, "type": "object", "required": [ "id", - "type", - "instanceType" + "type" ], "title": "GeographicScope" }, @@ -5044,7 +5044,11 @@ "default": [] }, "administrations": { - "$ref": "#/components/schemas/AgentAdministration-Input" + "items": { + "$ref": "#/components/schemas/AgentAdministration-Input" + }, + "type": "array", + "title": "Administrations" }, "productDesignation": { "$ref": "#/components/schemas/Code" @@ -5123,7 +5127,11 @@ "default": [] }, "administrations": { - "$ref": "#/components/schemas/AgentAdministration-Output" + "items": { + "$ref": "#/components/schemas/AgentAdministration-Output" + }, + "type": "array", + "title": "Administrations" }, "productDesignation": { "$ref": "#/components/schemas/Code" diff --git a/docs/USDM_API.yaml b/docs/USDM_API.yaml index a605339..a5e3916 100644 --- a/docs/USDM_API.yaml +++ b/docs/USDM_API.yaml @@ -1228,11 +1228,11 @@ components: instanceType: const: GeographicScope title: Instancetype + default: GeographicScope type: object required: - id - type - - instanceType title: GeographicScope GeographicScope-Output: properties: @@ -1249,11 +1249,11 @@ components: instanceType: const: GeographicScope title: Instancetype + default: GeographicScope type: object required: - id - type - - instanceType title: GeographicScope GovernanceDate-Input: properties: @@ -3229,7 +3229,10 @@ components: title: Codes default: [] administrations: - $ref: '#/components/schemas/AgentAdministration-Input' + items: + $ref: '#/components/schemas/AgentAdministration-Input' + type: array + title: Administrations productDesignation: $ref: '#/components/schemas/Code' pharmacologicClass: @@ -3282,7 +3285,10 @@ components: title: Codes default: [] administrations: - $ref: '#/components/schemas/AgentAdministration-Output' + items: + $ref: '#/components/schemas/AgentAdministration-Output' + type: array + title: Administrations productDesignation: $ref: '#/components/schemas/Code' pharmacologicClass: From 20f5be5fdbefd622134868649ec174566f0a0896 Mon Sep 17 00:00:00 2001 From: Dave Iberson-Hurst Date: Fri, 22 Dec 2023 09:27:08 +0100 Subject: [PATCH 4/5] Fix bug, quantity updated to class from string --- model/geographic_scope.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/geographic_scope.py b/model/geographic_scope.py index 889c170..da68d63 100644 --- a/model/geographic_scope.py +++ b/model/geographic_scope.py @@ -2,6 +2,7 @@ from .api_base_model import ApiBaseModelWithId from .code import Code from .alias_code import AliasCode +from .quantity import Quantity class GeographicScope(ApiBaseModelWithId): type: Code @@ -9,5 +10,5 @@ class GeographicScope(ApiBaseModelWithId): instanceType: Literal['GeographicScope'] = 'GeographicScope' class SubjectEnrollment(GeographicScope): - quantity: str + quantity: Quantity instanceType: Literal['SubjectEnrollment'] = 'SubjectEnrollment' From 90f63a8f56ad9973b8d428da52b10bad091f4285 Mon Sep 17 00:00:00 2001 From: Dave Iberson-Hurst Date: Fri, 22 Dec 2023 14:28:16 +0100 Subject: [PATCH 5/5] Update specification --- docs/USDM_API.json | 6 ++---- docs/USDM_API.yaml | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/USDM_API.json b/docs/USDM_API.json index 49cf04f..6176457 100644 --- a/docs/USDM_API.json +++ b/docs/USDM_API.json @@ -5756,8 +5756,7 @@ "default": "SubjectEnrollment" }, "quantity": { - "type": "string", - "title": "Quantity" + "$ref": "#/components/schemas/Quantity" } }, "type": "object", @@ -5794,8 +5793,7 @@ "default": "SubjectEnrollment" }, "quantity": { - "type": "string", - "title": "Quantity" + "$ref": "#/components/schemas/Quantity" } }, "type": "object", diff --git a/docs/USDM_API.yaml b/docs/USDM_API.yaml index a5e3916..e7f2f0a 100644 --- a/docs/USDM_API.yaml +++ b/docs/USDM_API.yaml @@ -3702,8 +3702,7 @@ components: title: Instancetype default: SubjectEnrollment quantity: - type: string - title: Quantity + $ref: '#/components/schemas/Quantity' type: object required: - id @@ -3727,8 +3726,7 @@ components: title: Instancetype default: SubjectEnrollment quantity: - type: string - title: Quantity + $ref: '#/components/schemas/Quantity' type: object required: - id