diff --git a/src/fhir/generator/generate_classes_serializer_index.py b/src/fhir/generator/generate_classes_serializer_index.py new file mode 100644 index 000000000..ecb9bc8c7 --- /dev/null +++ b/src/fhir/generator/generate_classes_serializer_index.py @@ -0,0 +1,109 @@ +# This file implements the code generator for generating schema and resolvers for FHIR +# It reads the FHIR XML schema and generates resolvers in the resolvers folder and schema in the schema folder + +import os +import shutil +from os import path +from pathlib import Path +from typing import Union, List, Dict, Any + +from fhir_xml_schema_parser import FhirXmlSchemaParser +from search_parameters import search_parameter_queries +from fhir_xml_schema_parser import FhirEntity + + +def my_copytree( + src: Union[Path, str], + dst: Union[Path, str], + symlinks: bool = False, + # ignore: Union[ + # None, + # Callable[[str, List[str]], Iterable[str]], + # Callable[[Union[str, os.PathLike[str]], List[str]], Iterable[str]], + # ] = None, +) -> None: + for item in os.listdir(src): + s = os.path.join(src, item) + d = os.path.join(dst, item) + if os.path.isdir(s): + shutil.copytree(s, d, symlinks) + else: + shutil.copy2(s, d) + + +def clean_duplicate_lines(file_path: Union[Path, str]) -> None: + print(f"Removing duplicate lines from {file_path}") + with open(file_path, "r") as file: + lines: List[str] = file.readlines() + new_lines: List[str] = [] + for line in lines: + if ( + not line.strip() + or not line.lstrip().startswith("from") + or ( + line not in new_lines + and line.lstrip() not in [c.lstrip() for c in new_lines] + ) + ): + new_lines.append(line) + with open(file_path, "w") as file: + file.writelines(new_lines) + + +def main() -> int: + data_dir: Path = Path(__file__).parent.joinpath("./") + fhir_dir = Path(__file__).parent.joinpath("../") + serializers_dir: Path = fhir_dir.joinpath("serializers/4_0_0/") + template_name = 'template.javascript.class_serializer.index.jinja2' + + # clean out old stuff + serializers_resources_folder = serializers_dir.joinpath("resources") + indexFilePath = serializers_resources_folder.joinpath("index.js") + if os.path.exists(indexFilePath): + os.remove(indexFilePath) + + serializers_complex_types_folder = serializers_dir.joinpath("complex_types") + complexTypeIndexFilePath = serializers_complex_types_folder.joinpath("index.js") + if os.path.exists(complexTypeIndexFilePath): + os.remove(complexTypeIndexFilePath) + + fhir_entities: List[FhirEntity] = [f for f in FhirXmlSchemaParser.generate_classes() if f.is_resource] + + with open(data_dir.joinpath(template_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = indexFilePath + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entities=fhir_entities, + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + + fhir_entities: List[FhirEntity] = [f for f in FhirXmlSchemaParser.generate_classes() + if f.type_ == "Element" and f.cleaned_name != "Resource"] + + with open(data_dir.joinpath(template_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = complexTypeIndexFilePath + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entities=fhir_entities, + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + + return 0 + + +if __name__ == "__main__": + exit(main()) diff --git a/src/fhir/generator/generate_serializers.py b/src/fhir/generator/generate_serializers.py new file mode 100644 index 000000000..77576ddb0 --- /dev/null +++ b/src/fhir/generator/generate_serializers.py @@ -0,0 +1,225 @@ +# This file implements the code generator for generating schema and resolvers for FHIR +# It reads the FHIR XML schema and generates resolvers in the resolvers folder and schema in the schema folder + +import os +import shutil +from os import path +from pathlib import Path +from typing import Union, List, Dict, Any + +from fhir_xml_schema_parser import FhirXmlSchemaParser +from search_parameters import search_parameter_queries +from fhir_xml_schema_parser import FhirEntity + + +def my_copytree( + src: Union[Path, str], + dst: Union[Path, str], + symlinks: bool = False, + # ignore: Union[ + # None, + # Callable[[str, List[str]], Iterable[str]], + # Callable[[Union[str, os.PathLike[str]], List[str]], Iterable[str]], + # ] = None, +) -> None: + for item in os.listdir(src): + s = os.path.join(src, item) + d = os.path.join(dst, item) + if os.path.isdir(s): + shutil.copytree(s, d, symlinks) + else: + shutil.copy2(s, d) + + +def clean_duplicate_lines(file_path: Union[Path, str]) -> None: + print(f"Removing duplicate lines from {file_path}") + with open(file_path, "r") as file: + lines: List[str] = file.readlines() + new_lines: List[str] = [] + for line in lines: + if ( + not line.strip() + or not line.lstrip().startswith("from") + or ( + line not in new_lines + and line.lstrip() not in [c.lstrip() for c in new_lines] + ) + ): + new_lines.append(line) + with open(file_path, "w") as file: + file.writelines(new_lines) + + +def main() -> int: + data_dir: Path = Path(__file__).parent.joinpath("./") + fhir_dir = Path(__file__).parent.joinpath("../") + serializers_dir: Path = fhir_dir.joinpath("serializers/4_0_0/") + serializer_template_file_name = 'template.javascript.class_serializer.jinja2' + + # clean out old stuff for serializers + serializers_resources_folder = serializers_dir.joinpath("resources") + if os.path.exists(serializers_resources_folder): + shutil.rmtree(serializers_resources_folder) + os.mkdir(serializers_resources_folder) + + serializers_complex_types_folder = serializers_dir.joinpath("complex_types") + if os.path.exists(serializers_complex_types_folder): + shutil.rmtree(serializers_complex_types_folder) + os.mkdir(serializers_complex_types_folder) + + serializers_backbone_elements_folder = serializers_dir.joinpath("backbone_elements") + if os.path.exists(serializers_backbone_elements_folder): + shutil.rmtree(serializers_backbone_elements_folder) + os.mkdir(serializers_backbone_elements_folder) + + fhir_entities: List[FhirEntity] = FhirXmlSchemaParser.generate_classes() + + # now print the result + for fhir_entity in fhir_entities: + # use template to generate new code files + resource_name: str = fhir_entity.cleaned_name + entity_file_name = fhir_entity.name_snake_case + if fhir_entity.is_value_set: # valueset + pass + + elif fhir_entity.is_resource: + search_parameters_for_all_resources: Dict[str, Dict[str, Any]] = ( + search_parameter_queries.get("Resource", {}) if fhir_entity.fhir_name != "Resource" else {} + ) + search_parameters_for_current_resource: Dict[str, Dict[str, Any]] = ( + search_parameter_queries.get(fhir_entity.fhir_name, {}) + ) + # write Javascript classes + with open(data_dir.joinpath(serializer_template_file_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = serializers_resources_folder.joinpath(f"{entity_file_name}.js") + print(f"Writing domain resource: {entity_file_name} to {file_path}...") + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entity=fhir_entity, + search_parameters_for_all_resources=search_parameters_for_all_resources, + search_parameters_for_current_resource=search_parameters_for_current_resource, + extra_properties=[ + { + "name": "_access", + "type": "Object" + }, + { + "name": "_sourceAssigningAuthority", + "type": "string" + }, + { + "name": "_uuid", + "type": "string" + }, + { + "name": "_sourceId", + "type": "string" + } + ] + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + elif fhir_entity.type_ == "BackboneElement" or fhir_entity.is_back_bone_element: + with open(data_dir.joinpath(serializer_template_file_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = serializers_backbone_elements_folder.joinpath(f"{entity_file_name}.js") + print(f"Writing back bone class: {entity_file_name} to {file_path}...") + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entity=fhir_entity, + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + elif fhir_entity.is_extension: # valueset + # write Javascript classes + with open(data_dir.joinpath(serializer_template_file_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = serializers_complex_types_folder.joinpath(f"{entity_file_name}.js") + print(f"Writing extension as complex type: {entity_file_name} to {file_path}...") + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entity=fhir_entity + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + elif fhir_entity.type_ == "Element": # valueset + # write Javascript classes + with open(data_dir.joinpath(serializer_template_file_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = serializers_complex_types_folder.joinpath(f"{entity_file_name}.js") + print(f"Writing complex type: {entity_file_name} to {file_path}...") + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + extra_properties = [ + { + "name": "_file_id", + "type": "string" + } + ] if entity_file_name == "attachment" else [] + result = template.render( + fhir_entity=fhir_entity, + extra_properties_for_reference=[ + { + "name": "_sourceAssigningAuthority", + "type": "string" + }, + { + "name": "_uuid", + "type": "string" + }, + { + "name": "_sourceId", + "type": "string" + } + ], + extra_properties=extra_properties, + extra_properties_for_json=extra_properties + ) + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + elif fhir_entity.type_ in ["Quantity"]: # valueset + with open(data_dir.joinpath(serializer_template_file_name), "r") as file: + template_contents = file.read() + from jinja2 import Template + + file_path = serializers_complex_types_folder.joinpath(f"{entity_file_name}.js") + print(f"Writing complex_type: {entity_file_name} to {file_path}...") + template = Template( + template_contents, trim_blocks=True, lstrip_blocks=True + ) + result = template.render( + fhir_entity=fhir_entity, + ) + + if not path.exists(file_path): + with open(file_path, "w") as file2: + file2.write(result) + else: + print(f"{resource_name}: {fhir_entity.type_} is not supported") + # print(result) + + return 0 + + +if __name__ == "__main__": + exit(main()) diff --git a/src/fhir/generator/template.javascript.class_serializer.index.jinja2 b/src/fhir/generator/template.javascript.class_serializer.index.jinja2 new file mode 100644 index 000000000..ef8a646b2 --- /dev/null +++ b/src/fhir/generator/template.javascript.class_serializer.index.jinja2 @@ -0,0 +1,19 @@ +// This file is auto-generated by generate_classes so do not edit manually +{% macro lower_case_first_letter(text) %} + {{- text[0]|lower }}{{ text[1:] -}} +{% endmacro %} +{% macro upper_case_first_letter(text) %} + {{- text[0]|upper }}{{ text[1:] -}} +{% endmacro %} + +{% for fhir_entity in fhir_entities %} +const {{ fhir_entity.cleaned_name | lower }}Serializer = require('./{{ lower_case_first_letter(fhir_entity.cleaned_name) }}'); +{% endfor %} + +module.exports = { +{% for fhir_entity in fhir_entities %} + {{ fhir_entity.cleaned_name | lower }}Serializer, +{% endfor %} +}; + + diff --git a/src/fhir/generator/template.javascript.class_serializer.jinja2 b/src/fhir/generator/template.javascript.class_serializer.jinja2 new file mode 100644 index 000000000..1bf6da436 --- /dev/null +++ b/src/fhir/generator/template.javascript.class_serializer.jinja2 @@ -0,0 +1,97 @@ +// This file is auto-generated by generate_classes so do not edit manually +{% macro lower_case_first_letter(text) %} + {{- text[0]|lower }}{{ text[1:] -}} +{% endmacro %} +{% macro upper_case_first_letter(text) %} + {{- text[0]|upper }}{{ text[1:] -}} +{% endmacro %} +{# Collect unique types and their import info #} +{% set imported_types = {} %} +{% for property in fhir_entity.properties %} + {% if property.cleaned_type != fhir_entity.cleaned_name %} + {% if property.is_resource %} + {% set _ = imported_types.update({property.cleaned_type: '../resources/' + lower_case_first_letter(property.type_snake_case) + '.js'}) %} + {% elif property.is_extension or property.is_complex or property.fhir_type == "Element" %} + {% set _ = imported_types.update({property.cleaned_type: '../complex_types/' + lower_case_first_letter(property.type_snake_case) + '.js'}) %} + {% elif property.fhir_type == "BackboneElement" %} + {% set _ = imported_types.update({property.cleaned_type: '../backbone_elements/' + lower_case_first_letter(property.type_snake_case) + '.js'}) %} + {% elif property.cleaned_type == "ResourceContainer" %} + {% set _ = imported_types.update({property.cleaned_type: '../simple_types/' + lower_case_first_letter(property.type_snake_case) + '.js'}) %} + {% endif %} + {% endif %} +{% endfor %} + +{# Generate unique imports #} +{% for type, path in imported_types.items() %} +const {{ type }}Serializer = require('{{ path }}'); +{% endfor %} + +class {{ fhir_entity.cleaned_name }}Serializer { + static propertyToSerializerMap = { + {% for property in fhir_entity.properties %} + {% if not property.is_v2_supported %} + {% if property.is_resource or property.is_extension or property.cleaned_type == "ResourceContainer" or property.fhir_type == "BackboneElement" or property.is_complex or property.fhir_type == "Element" %} + '{{ property.name }}': (value) => {{ property.cleaned_type }}Serializer.serialize(value), + {% else %} + '{{ property.name }}': null, + {% endif %} + {% endif %} + {% endfor %} + {% for extra_property in extra_properties_for_json %} + {% if extra_property.name != '_file_id' %} + {% if extra_property.is_resource or extra_property.is_extension or extra_property.cleaned_type == "ResourceContainer" or extra_property.fhir_type == "BackboneElement" or extra_property.is_complex or extra_property.fhir_type == "Element" %} + '{{ extra_property.name }}': (value) => {{ extra_property.cleaned_type }}Serializer.serialize(value), + {% else %} + '{{ extra_property.name }}': null, + {% endif %} + {% endif %} + {% endfor %} + {% if fhir_entity.is_resource %} + 'resourceType': null, + {% endif %} + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => {{ fhir_entity.cleaned_name }}Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in {{ fhir_entity.cleaned_name }}Serializer.propertyToSerializerMap) { + if ({{ fhir_entity.cleaned_name }}Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = {{ fhir_entity.cleaned_name }}Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = {{ fhir_entity.cleaned_name }}Serializer; diff --git a/src/fhir/serializers/4_0_0/backbone_elements/accountCoverage.js b/src/fhir/serializers/4_0_0/backbone_elements/accountCoverage.js new file mode 100644 index 000000000..046a4f22c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/accountCoverage.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class AccountCoverageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + coverage: (value) => ReferenceSerializer.serialize(value), + priority: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AccountCoverageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AccountCoverageSerializer.propertyToSerializerMap) { + if (AccountCoverageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AccountCoverageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AccountCoverageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/accountGuarantor.js b/src/fhir/serializers/4_0_0/backbone_elements/accountGuarantor.js new file mode 100644 index 000000000..50addb93b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/accountGuarantor.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class AccountGuarantorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + party: (value) => ReferenceSerializer.serialize(value), + onHold: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AccountGuarantorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AccountGuarantorSerializer.propertyToSerializerMap) { + if (AccountGuarantorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AccountGuarantorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AccountGuarantorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionDynamicValue.js b/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionDynamicValue.js new file mode 100644 index 000000000..be6323964 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionDynamicValue.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class ActivityDefinitionDynamicValueSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + path: null, + expression: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ActivityDefinitionDynamicValueSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ActivityDefinitionDynamicValueSerializer.propertyToSerializerMap) { + if (ActivityDefinitionDynamicValueSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ActivityDefinitionDynamicValueSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ActivityDefinitionDynamicValueSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionParticipant.js new file mode 100644 index 000000000..ff30154a1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/activityDefinitionParticipant.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ActivityDefinitionParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + role: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ActivityDefinitionParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ActivityDefinitionParticipantSerializer.propertyToSerializerMap) { + if (ActivityDefinitionParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ActivityDefinitionParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ActivityDefinitionParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionProperty.js new file mode 100644 index 000000000..519b122fc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionProperty.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class AdministrableProductDefinitionPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueDate: null, + valueBoolean: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdministrableProductDefinitionPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdministrableProductDefinitionPropertySerializer.propertyToSerializerMap) { + if (AdministrableProductDefinitionPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdministrableProductDefinitionPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdministrableProductDefinitionPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionRouteOfAdministration.js b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionRouteOfAdministration.js new file mode 100644 index 000000000..2a34ddf91 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionRouteOfAdministration.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const AdministrableProductDefinitionTargetSpeciesSerializer = require('../backbone_elements/administrableProductDefinitionTargetSpecies.js'); + +class AdministrableProductDefinitionRouteOfAdministrationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + firstDose: (value) => QuantitySerializer.serialize(value), + maxSingleDose: (value) => QuantitySerializer.serialize(value), + maxDosePerDay: (value) => QuantitySerializer.serialize(value), + maxDosePerTreatmentPeriod: (value) => RatioSerializer.serialize(value), + maxTreatmentPeriod: (value) => QuantitySerializer.serialize(value), + targetSpecies: (value) => AdministrableProductDefinitionTargetSpeciesSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdministrableProductDefinitionRouteOfAdministrationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdministrableProductDefinitionRouteOfAdministrationSerializer.propertyToSerializerMap) { + if (AdministrableProductDefinitionRouteOfAdministrationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdministrableProductDefinitionRouteOfAdministrationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdministrableProductDefinitionRouteOfAdministrationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionTargetSpecies.js b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionTargetSpecies.js new file mode 100644 index 000000000..d0877ffb3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionTargetSpecies.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AdministrableProductDefinitionWithdrawalPeriodSerializer = require('../backbone_elements/administrableProductDefinitionWithdrawalPeriod.js'); + +class AdministrableProductDefinitionTargetSpeciesSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + withdrawalPeriod: (value) => AdministrableProductDefinitionWithdrawalPeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdministrableProductDefinitionTargetSpeciesSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdministrableProductDefinitionTargetSpeciesSerializer.propertyToSerializerMap) { + if (AdministrableProductDefinitionTargetSpeciesSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdministrableProductDefinitionTargetSpeciesSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdministrableProductDefinitionTargetSpeciesSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionWithdrawalPeriod.js b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionWithdrawalPeriod.js new file mode 100644 index 000000000..1e8dab150 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/administrableProductDefinitionWithdrawalPeriod.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class AdministrableProductDefinitionWithdrawalPeriodSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + tissue: (value) => CodeableConceptSerializer.serialize(value), + value: (value) => QuantitySerializer.serialize(value), + supportingInformation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdministrableProductDefinitionWithdrawalPeriodSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdministrableProductDefinitionWithdrawalPeriodSerializer.propertyToSerializerMap) { + if (AdministrableProductDefinitionWithdrawalPeriodSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdministrableProductDefinitionWithdrawalPeriodSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdministrableProductDefinitionWithdrawalPeriodSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/adverseEventCausality.js b/src/fhir/serializers/4_0_0/backbone_elements/adverseEventCausality.js new file mode 100644 index 000000000..8e72c0b7b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/adverseEventCausality.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class AdverseEventCausalitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + assessment: (value) => CodeableConceptSerializer.serialize(value), + productRelatedness: null, + author: (value) => ReferenceSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdverseEventCausalitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdverseEventCausalitySerializer.propertyToSerializerMap) { + if (AdverseEventCausalitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdverseEventCausalitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdverseEventCausalitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/adverseEventSuspectEntity.js b/src/fhir/serializers/4_0_0/backbone_elements/adverseEventSuspectEntity.js new file mode 100644 index 000000000..e74463ffb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/adverseEventSuspectEntity.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AdverseEventCausalitySerializer = require('../backbone_elements/adverseEventCausality.js'); + +class AdverseEventSuspectEntitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + instance: (value) => ReferenceSerializer.serialize(value), + causality: (value) => AdverseEventCausalitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdverseEventSuspectEntitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdverseEventSuspectEntitySerializer.propertyToSerializerMap) { + if (AdverseEventSuspectEntitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdverseEventSuspectEntitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdverseEventSuspectEntitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/allergyIntoleranceReaction.js b/src/fhir/serializers/4_0_0/backbone_elements/allergyIntoleranceReaction.js new file mode 100644 index 000000000..14d0b48c4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/allergyIntoleranceReaction.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class AllergyIntoleranceReactionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + substance: (value) => CodeableConceptSerializer.serialize(value), + manifestation: (value) => CodeableConceptSerializer.serialize(value), + description: null, + onset: null, + severity: null, + exposureRoute: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AllergyIntoleranceReactionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AllergyIntoleranceReactionSerializer.propertyToSerializerMap) { + if (AllergyIntoleranceReactionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AllergyIntoleranceReactionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AllergyIntoleranceReactionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/appointmentParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/appointmentParticipant.js new file mode 100644 index 000000000..e6a4f92c4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/appointmentParticipant.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class AppointmentParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value), + required: null, + status: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AppointmentParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AppointmentParticipantSerializer.propertyToSerializerMap) { + if (AppointmentParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AppointmentParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AppointmentParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/auditEventAgent.js b/src/fhir/serializers/4_0_0/backbone_elements/auditEventAgent.js new file mode 100644 index 000000000..af369389b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/auditEventAgent.js @@ -0,0 +1,70 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const AuditEventNetworkSerializer = require('../backbone_elements/auditEventNetwork.js'); + +class AuditEventAgentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + who: (value) => ReferenceSerializer.serialize(value), + altId: null, + name: null, + requestor: null, + location: (value) => ReferenceSerializer.serialize(value), + policy: null, + media: (value) => CodingSerializer.serialize(value), + network: (value) => AuditEventNetworkSerializer.serialize(value), + purposeOfUse: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventAgentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventAgentSerializer.propertyToSerializerMap) { + if (AuditEventAgentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventAgentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventAgentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/auditEventDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/auditEventDetail.js new file mode 100644 index 000000000..93ea8afbe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/auditEventDetail.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class AuditEventDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + valueString: null, + valueBase64Binary: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventDetailSerializer.propertyToSerializerMap) { + if (AuditEventDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/auditEventEntity.js b/src/fhir/serializers/4_0_0/backbone_elements/auditEventEntity.js new file mode 100644 index 000000000..7fb30ae30 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/auditEventEntity.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const AuditEventDetailSerializer = require('../backbone_elements/auditEventDetail.js'); + +class AuditEventEntitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + what: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value), + role: (value) => CodingSerializer.serialize(value), + lifecycle: (value) => CodingSerializer.serialize(value), + securityLabel: (value) => CodingSerializer.serialize(value), + name: null, + description: null, + query: null, + detail: (value) => AuditEventDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventEntitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventEntitySerializer.propertyToSerializerMap) { + if (AuditEventEntitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventEntitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventEntitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/auditEventNetwork.js b/src/fhir/serializers/4_0_0/backbone_elements/auditEventNetwork.js new file mode 100644 index 000000000..e735678fa --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/auditEventNetwork.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class AuditEventNetworkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + address: null, + type: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventNetworkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventNetworkSerializer.propertyToSerializerMap) { + if (AuditEventNetworkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventNetworkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventNetworkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/auditEventSource.js b/src/fhir/serializers/4_0_0/backbone_elements/auditEventSource.js new file mode 100644 index 000000000..af1fb48ad --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/auditEventSource.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class AuditEventSourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + site: null, + observer: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventSourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventSourceSerializer.propertyToSerializerMap) { + if (AuditEventSourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventSourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventSourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductCollection.js b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductCollection.js new file mode 100644 index 000000000..4b89b92ec --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductCollection.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class BiologicallyDerivedProductCollectionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + collector: (value) => ReferenceSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value), + collectedDateTime: null, + collectedPeriod: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BiologicallyDerivedProductCollectionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BiologicallyDerivedProductCollectionSerializer.propertyToSerializerMap) { + if (BiologicallyDerivedProductCollectionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BiologicallyDerivedProductCollectionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BiologicallyDerivedProductCollectionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductManipulation.js b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductManipulation.js new file mode 100644 index 000000000..36b188359 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductManipulation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class BiologicallyDerivedProductManipulationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + timeDateTime: null, + timePeriod: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BiologicallyDerivedProductManipulationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BiologicallyDerivedProductManipulationSerializer.propertyToSerializerMap) { + if (BiologicallyDerivedProductManipulationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BiologicallyDerivedProductManipulationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BiologicallyDerivedProductManipulationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductProcessing.js b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductProcessing.js new file mode 100644 index 000000000..6ca272b9a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductProcessing.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class BiologicallyDerivedProductProcessingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + procedure: (value) => CodeableConceptSerializer.serialize(value), + additive: (value) => ReferenceSerializer.serialize(value), + timeDateTime: null, + timePeriod: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BiologicallyDerivedProductProcessingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BiologicallyDerivedProductProcessingSerializer.propertyToSerializerMap) { + if (BiologicallyDerivedProductProcessingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BiologicallyDerivedProductProcessingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BiologicallyDerivedProductProcessingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductStorage.js b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductStorage.js new file mode 100644 index 000000000..1ef362aed --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/biologicallyDerivedProductStorage.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class BiologicallyDerivedProductStorageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + temperature: null, + scale: null, + duration: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BiologicallyDerivedProductStorageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BiologicallyDerivedProductStorageSerializer.propertyToSerializerMap) { + if (BiologicallyDerivedProductStorageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BiologicallyDerivedProductStorageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BiologicallyDerivedProductStorageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/bundleEntry.js b/src/fhir/serializers/4_0_0/backbone_elements/bundleEntry.js new file mode 100644 index 000000000..20b59f49c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/bundleEntry.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const BundleLinkSerializer = require('../backbone_elements/bundleLink.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const BundleSearchSerializer = require('../backbone_elements/bundleSearch.js'); +const BundleRequestSerializer = require('../backbone_elements/bundleRequest.js'); +const BundleResponseSerializer = require('../backbone_elements/bundleResponse.js'); + +class BundleEntrySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + link: (value) => BundleLinkSerializer.serialize(value), + fullUrl: null, + resource: (value) => ResourceContainerSerializer.serialize(value), + search: (value) => BundleSearchSerializer.serialize(value), + request: (value) => BundleRequestSerializer.serialize(value), + response: (value) => BundleResponseSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleEntrySerializer.propertyToSerializerMap) { + if (BundleEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleEntrySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/bundleLink.js b/src/fhir/serializers/4_0_0/backbone_elements/bundleLink.js new file mode 100644 index 000000000..5f51334db --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/bundleLink.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class BundleLinkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relation: null, + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleLinkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleLinkSerializer.propertyToSerializerMap) { + if (BundleLinkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleLinkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleLinkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/bundleRequest.js b/src/fhir/serializers/4_0_0/backbone_elements/bundleRequest.js new file mode 100644 index 000000000..86813cb5b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/bundleRequest.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class BundleRequestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + method: null, + url: null, + ifNoneMatch: null, + ifModifiedSince: null, + ifMatch: null, + ifNoneExist: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleRequestSerializer.propertyToSerializerMap) { + if (BundleRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/bundleResponse.js b/src/fhir/serializers/4_0_0/backbone_elements/bundleResponse.js new file mode 100644 index 000000000..255549912 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/bundleResponse.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); + +class BundleResponseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + location: null, + etag: null, + lastModified: null, + outcome: (value) => ResourceContainerSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleResponseSerializer.propertyToSerializerMap) { + if (BundleResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/bundleSearch.js b/src/fhir/serializers/4_0_0/backbone_elements/bundleSearch.js new file mode 100644 index 000000000..0ab75bf2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/bundleSearch.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class BundleSearchSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + score: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleSearchSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleSearchSerializer.propertyToSerializerMap) { + if (BundleSearchSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleSearchSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleSearchSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementDocument.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementDocument.js new file mode 100644 index 000000000..94cccd087 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementDocument.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementDocumentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + documentation: null, + profile: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementDocumentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementDocumentSerializer.propertyToSerializerMap) { + if (CapabilityStatementDocumentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementDocumentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementDocumentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementEndpoint.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementEndpoint.js new file mode 100644 index 000000000..e50e0c73f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementEndpoint.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class CapabilityStatementEndpointSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + protocol: (value) => CodingSerializer.serialize(value), + address: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementEndpointSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementEndpointSerializer.propertyToSerializerMap) { + if (CapabilityStatementEndpointSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementEndpointSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementEndpointSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementImplementation.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementImplementation.js new file mode 100644 index 000000000..a1d3b3ef9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementImplementation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CapabilityStatementImplementationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + url: null, + custodian: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementImplementationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementImplementationSerializer.propertyToSerializerMap) { + if (CapabilityStatementImplementationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementImplementationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementImplementationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction.js new file mode 100644 index 000000000..66e69cf31 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementInteractionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementInteractionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementInteractionSerializer.propertyToSerializerMap) { + if (CapabilityStatementInteractionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementInteractionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementInteractionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction1.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction1.js new file mode 100644 index 000000000..4cde62b9f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementInteraction1.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementInteraction1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementInteraction1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementInteraction1Serializer.propertyToSerializerMap) { + if (CapabilityStatementInteraction1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementInteraction1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementInteraction1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementMessaging.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementMessaging.js new file mode 100644 index 000000000..9bfef6f29 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementMessaging.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CapabilityStatementEndpointSerializer = require('../backbone_elements/capabilityStatementEndpoint.js'); +const CapabilityStatementSupportedMessageSerializer = require('../backbone_elements/capabilityStatementSupportedMessage.js'); + +class CapabilityStatementMessagingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + endpoint: (value) => CapabilityStatementEndpointSerializer.serialize(value), + reliableCache: null, + documentation: null, + supportedMessage: (value) => CapabilityStatementSupportedMessageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementMessagingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementMessagingSerializer.propertyToSerializerMap) { + if (CapabilityStatementMessagingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementMessagingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementMessagingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementOperation.js new file mode 100644 index 000000000..1a89b77b5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementOperation.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + definition: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementOperationSerializer.propertyToSerializerMap) { + if (CapabilityStatementOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementResource.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementResource.js new file mode 100644 index 000000000..41fd5d280 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementResource.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CapabilityStatementInteractionSerializer = require('../backbone_elements/capabilityStatementInteraction.js'); +const CapabilityStatementSearchParamSerializer = require('../backbone_elements/capabilityStatementSearchParam.js'); +const CapabilityStatementOperationSerializer = require('../backbone_elements/capabilityStatementOperation.js'); + +class CapabilityStatementResourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + profile: null, + supportedProfile: null, + documentation: null, + interaction: (value) => CapabilityStatementInteractionSerializer.serialize(value), + versioning: null, + readHistory: null, + updateCreate: null, + conditionalCreate: null, + conditionalRead: null, + conditionalUpdate: null, + conditionalDelete: null, + referencePolicy: null, + searchInclude: null, + searchRevInclude: null, + searchParam: (value) => CapabilityStatementSearchParamSerializer.serialize(value), + operation: (value) => CapabilityStatementOperationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementResourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementResourceSerializer.propertyToSerializerMap) { + if (CapabilityStatementResourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementResourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementResourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementRest.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementRest.js new file mode 100644 index 000000000..1e46036a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementRest.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CapabilityStatementSecuritySerializer = require('../backbone_elements/capabilityStatementSecurity.js'); +const CapabilityStatementResourceSerializer = require('../backbone_elements/capabilityStatementResource.js'); +const CapabilityStatementInteraction1Serializer = require('../backbone_elements/capabilityStatementInteraction1.js'); +const CapabilityStatementSearchParamSerializer = require('../backbone_elements/capabilityStatementSearchParam.js'); +const CapabilityStatementOperationSerializer = require('../backbone_elements/capabilityStatementOperation.js'); + +class CapabilityStatementRestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + documentation: null, + security: (value) => CapabilityStatementSecuritySerializer.serialize(value), + resource: (value) => CapabilityStatementResourceSerializer.serialize(value), + interaction: (value) => CapabilityStatementInteraction1Serializer.serialize(value), + searchParam: (value) => CapabilityStatementSearchParamSerializer.serialize(value), + operation: (value) => CapabilityStatementOperationSerializer.serialize(value), + compartment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementRestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementRestSerializer.propertyToSerializerMap) { + if (CapabilityStatementRestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementRestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementRestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSearchParam.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSearchParam.js new file mode 100644 index 000000000..f12718d42 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSearchParam.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementSearchParamSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + definition: null, + type: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementSearchParamSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementSearchParamSerializer.propertyToSerializerMap) { + if (CapabilityStatementSearchParamSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementSearchParamSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementSearchParamSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSecurity.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSecurity.js new file mode 100644 index 000000000..bcf34b805 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSecurity.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CapabilityStatementSecuritySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + cors: null, + service: (value) => CodeableConceptSerializer.serialize(value), + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementSecuritySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementSecuritySerializer.propertyToSerializerMap) { + if (CapabilityStatementSecuritySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementSecuritySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementSecuritySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSoftware.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSoftware.js new file mode 100644 index 000000000..b107b574b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSoftware.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementSoftwareSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + version: null, + releaseDate: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementSoftwareSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementSoftwareSerializer.propertyToSerializerMap) { + if (CapabilityStatementSoftwareSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementSoftwareSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementSoftwareSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSupportedMessage.js b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSupportedMessage.js new file mode 100644 index 000000000..1ef0b5f9e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/capabilityStatementSupportedMessage.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CapabilityStatementSupportedMessageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + definition: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementSupportedMessageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementSupportedMessageSerializer.propertyToSerializerMap) { + if (CapabilityStatementSupportedMessageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementSupportedMessageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementSupportedMessageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/carePlanActivity.js b/src/fhir/serializers/4_0_0/backbone_elements/carePlanActivity.js new file mode 100644 index 000000000..fc5ab2a88 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/carePlanActivity.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CarePlanDetailSerializer = require('../backbone_elements/carePlanDetail.js'); + +class CarePlanActivitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + outcomeCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + outcomeReference: (value) => ReferenceSerializer.serialize(value), + progress: (value) => AnnotationSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + detail: (value) => CarePlanDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CarePlanActivitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CarePlanActivitySerializer.propertyToSerializerMap) { + if (CarePlanActivitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CarePlanActivitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CarePlanActivitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/carePlanDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/carePlanDetail.js new file mode 100644 index 000000000..918814e63 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/carePlanDetail.js @@ -0,0 +1,80 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class CarePlanDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + kind: null, + instantiatesCanonical: null, + instantiatesUri: null, + code: (value) => CodeableConceptSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + goal: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + doNotPerform: null, + scheduledTiming: (value) => TimingSerializer.serialize(value), + scheduledPeriod: (value) => PeriodSerializer.serialize(value), + scheduledString: null, + location: (value) => ReferenceSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + productCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + productReference: (value) => ReferenceSerializer.serialize(value), + dailyAmount: (value) => QuantitySerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CarePlanDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CarePlanDetailSerializer.propertyToSerializerMap) { + if (CarePlanDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CarePlanDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CarePlanDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/careTeamParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/careTeamParticipant.js new file mode 100644 index 000000000..b05a486d7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/careTeamParticipant.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class CareTeamParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + member: (value) => ReferenceSerializer.serialize(value), + onBehalfOf: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CareTeamParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CareTeamParticipantSerializer.propertyToSerializerMap) { + if (CareTeamParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CareTeamParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CareTeamParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/catalogEntryRelatedEntry.js b/src/fhir/serializers/4_0_0/backbone_elements/catalogEntryRelatedEntry.js new file mode 100644 index 000000000..071338cfc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/catalogEntryRelatedEntry.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CatalogEntryRelatedEntrySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relationtype: null, + item: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CatalogEntryRelatedEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CatalogEntryRelatedEntrySerializer.propertyToSerializerMap) { + if (CatalogEntryRelatedEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CatalogEntryRelatedEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CatalogEntryRelatedEntrySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionApplicability.js b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionApplicability.js new file mode 100644 index 000000000..c09c2cfa0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionApplicability.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ChargeItemDefinitionApplicabilitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + language: null, + expression: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemDefinitionApplicabilitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemDefinitionApplicabilitySerializer.propertyToSerializerMap) { + if (ChargeItemDefinitionApplicabilitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemDefinitionApplicabilitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemDefinitionApplicabilitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPriceComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPriceComponent.js new file mode 100644 index 000000000..b880281cd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPriceComponent.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ChargeItemDefinitionPriceComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + code: (value) => CodeableConceptSerializer.serialize(value), + factor: null, + amount: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemDefinitionPriceComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemDefinitionPriceComponentSerializer.propertyToSerializerMap) { + if (ChargeItemDefinitionPriceComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemDefinitionPriceComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemDefinitionPriceComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPropertyGroup.js b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPropertyGroup.js new file mode 100644 index 000000000..a01316619 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemDefinitionPropertyGroup.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ChargeItemDefinitionApplicabilitySerializer = require('../backbone_elements/chargeItemDefinitionApplicability.js'); +const ChargeItemDefinitionPriceComponentSerializer = require('../backbone_elements/chargeItemDefinitionPriceComponent.js'); + +class ChargeItemDefinitionPropertyGroupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + applicability: (value) => ChargeItemDefinitionApplicabilitySerializer.serialize(value), + priceComponent: (value) => ChargeItemDefinitionPriceComponentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemDefinitionPropertyGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemDefinitionPropertyGroupSerializer.propertyToSerializerMap) { + if (ChargeItemDefinitionPropertyGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemDefinitionPropertyGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemDefinitionPropertyGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/chargeItemPerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemPerformer.js new file mode 100644 index 000000000..55bb5ee70 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/chargeItemPerformer.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ChargeItemPerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemPerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemPerformerSerializer.propertyToSerializerMap) { + if (ChargeItemPerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemPerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemPerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationAbstract.js b/src/fhir/serializers/4_0_0/backbone_elements/citationAbstract.js new file mode 100644 index 000000000..784471f80 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationAbstract.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationAbstractSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + language: (value) => CodeableConceptSerializer.serialize(value), + text: null, + copyright: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationAbstractSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationAbstractSerializer.propertyToSerializerMap) { + if (CitationAbstractSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationAbstractSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationAbstractSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationAffiliationInfo.js b/src/fhir/serializers/4_0_0/backbone_elements/citationAffiliationInfo.js new file mode 100644 index 000000000..027a16465 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationAffiliationInfo.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class CitationAffiliationInfoSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + affiliation: null, + role: null, + identifier: (value) => IdentifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationAffiliationInfoSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationAffiliationInfoSerializer.propertyToSerializerMap) { + if (CitationAffiliationInfoSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationAffiliationInfoSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationAffiliationInfoSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationCitedArtifact.js b/src/fhir/serializers/4_0_0/backbone_elements/citationCitedArtifact.js new file mode 100644 index 000000000..1f10d88b1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationCitedArtifact.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CitationVersionSerializer = require('../backbone_elements/citationVersion.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CitationStatusDate1Serializer = require('../backbone_elements/citationStatusDate1.js'); +const CitationTitleSerializer = require('../backbone_elements/citationTitle.js'); +const CitationAbstractSerializer = require('../backbone_elements/citationAbstract.js'); +const CitationPartSerializer = require('../backbone_elements/citationPart.js'); +const CitationRelatesTo1Serializer = require('../backbone_elements/citationRelatesTo1.js'); +const CitationPublicationFormSerializer = require('../backbone_elements/citationPublicationForm.js'); +const CitationWebLocationSerializer = require('../backbone_elements/citationWebLocation.js'); +const CitationClassification1Serializer = require('../backbone_elements/citationClassification1.js'); +const CitationContributorshipSerializer = require('../backbone_elements/citationContributorship.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class CitationCitedArtifactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + relatedIdentifier: (value) => IdentifierSerializer.serialize(value), + dateAccessed: null, + version: (value) => CitationVersionSerializer.serialize(value), + currentState: (value) => CodeableConceptSerializer.serialize(value), + statusDate: (value) => CitationStatusDate1Serializer.serialize(value), + title: (value) => CitationTitleSerializer.serialize(value), + abstract: (value) => CitationAbstractSerializer.serialize(value), + part: (value) => CitationPartSerializer.serialize(value), + relatesTo: (value) => CitationRelatesTo1Serializer.serialize(value), + publicationForm: (value) => CitationPublicationFormSerializer.serialize(value), + webLocation: (value) => CitationWebLocationSerializer.serialize(value), + classification: (value) => CitationClassification1Serializer.serialize(value), + contributorship: (value) => CitationContributorshipSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationCitedArtifactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationCitedArtifactSerializer.propertyToSerializerMap) { + if (CitationCitedArtifactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationCitedArtifactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationCitedArtifactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationClassification.js b/src/fhir/serializers/4_0_0/backbone_elements/citationClassification.js new file mode 100644 index 000000000..a9272f0fd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationClassification.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationClassificationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + classifier: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationClassificationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationClassificationSerializer.propertyToSerializerMap) { + if (CitationClassificationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationClassificationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationClassificationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationClassification1.js b/src/fhir/serializers/4_0_0/backbone_elements/citationClassification1.js new file mode 100644 index 000000000..6420d4495 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationClassification1.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CitationWhoClassifiedSerializer = require('../backbone_elements/citationWhoClassified.js'); + +class CitationClassification1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + classifier: (value) => CodeableConceptSerializer.serialize(value), + whoClassified: (value) => CitationWhoClassifiedSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationClassification1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationClassification1Serializer.propertyToSerializerMap) { + if (CitationClassification1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationClassification1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationClassification1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationContributionInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/citationContributionInstance.js new file mode 100644 index 000000000..999c5e929 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationContributionInstance.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationContributionInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + time: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationContributionInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationContributionInstanceSerializer.propertyToSerializerMap) { + if (CitationContributionInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationContributionInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationContributionInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationContributorship.js b/src/fhir/serializers/4_0_0/backbone_elements/citationContributorship.js new file mode 100644 index 000000000..6127c709a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationContributorship.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CitationEntrySerializer = require('../backbone_elements/citationEntry.js'); +const CitationSummary1Serializer = require('../backbone_elements/citationSummary1.js'); + +class CitationContributorshipSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + complete: null, + entry: (value) => CitationEntrySerializer.serialize(value), + summary: (value) => CitationSummary1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationContributorshipSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationContributorshipSerializer.propertyToSerializerMap) { + if (CitationContributorshipSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationContributorshipSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationContributorshipSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationDateOfPublication.js b/src/fhir/serializers/4_0_0/backbone_elements/citationDateOfPublication.js new file mode 100644 index 000000000..e12b282ee --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationDateOfPublication.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CitationDateOfPublicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + date: null, + year: null, + month: null, + day: null, + season: null, + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationDateOfPublicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationDateOfPublicationSerializer.propertyToSerializerMap) { + if (CitationDateOfPublicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationDateOfPublicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationDateOfPublicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationEntry.js b/src/fhir/serializers/4_0_0/backbone_elements/citationEntry.js new file mode 100644 index 000000000..cec461c56 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationEntry.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CitationAffiliationInfoSerializer = require('../backbone_elements/citationAffiliationInfo.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CitationContributionInstanceSerializer = require('../backbone_elements/citationContributionInstance.js'); + +class CitationEntrySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + initials: null, + collectiveName: null, + identifier: (value) => IdentifierSerializer.serialize(value), + affiliationInfo: (value) => CitationAffiliationInfoSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + contributionType: (value) => CodeableConceptSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + contributionInstance: (value) => CitationContributionInstanceSerializer.serialize(value), + correspondingContact: null, + listOrder: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationEntrySerializer.propertyToSerializerMap) { + if (CitationEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationEntrySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationPart.js b/src/fhir/serializers/4_0_0/backbone_elements/citationPart.js new file mode 100644 index 000000000..8b7d408b6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationPart.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CitationPartSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + value: null, + baseCitation: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationPartSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationPartSerializer.propertyToSerializerMap) { + if (CitationPartSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationPartSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationPartSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationPeriodicRelease.js b/src/fhir/serializers/4_0_0/backbone_elements/citationPeriodicRelease.js new file mode 100644 index 000000000..681680db2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationPeriodicRelease.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CitationDateOfPublicationSerializer = require('../backbone_elements/citationDateOfPublication.js'); + +class CitationPeriodicReleaseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + citedMedium: (value) => CodeableConceptSerializer.serialize(value), + volume: null, + issue: null, + dateOfPublication: (value) => CitationDateOfPublicationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationPeriodicReleaseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationPeriodicReleaseSerializer.propertyToSerializerMap) { + if (CitationPeriodicReleaseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationPeriodicReleaseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationPeriodicReleaseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationPublicationForm.js b/src/fhir/serializers/4_0_0/backbone_elements/citationPublicationForm.js new file mode 100644 index 000000000..484bbc56f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationPublicationForm.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CitationPublishedInSerializer = require('../backbone_elements/citationPublishedIn.js'); +const CitationPeriodicReleaseSerializer = require('../backbone_elements/citationPeriodicRelease.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationPublicationFormSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + publishedIn: (value) => CitationPublishedInSerializer.serialize(value), + periodicRelease: (value) => CitationPeriodicReleaseSerializer.serialize(value), + articleDate: null, + lastRevisionDate: null, + language: (value) => CodeableConceptSerializer.serialize(value), + accessionNumber: null, + pageString: null, + firstPage: null, + lastPage: null, + pageCount: null, + copyright: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationPublicationFormSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationPublicationFormSerializer.propertyToSerializerMap) { + if (CitationPublicationFormSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationPublicationFormSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationPublicationFormSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationPublishedIn.js b/src/fhir/serializers/4_0_0/backbone_elements/citationPublishedIn.js new file mode 100644 index 000000000..d088cd2bb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationPublishedIn.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CitationPublishedInSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + title: null, + publisher: (value) => ReferenceSerializer.serialize(value), + publisherLocation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationPublishedInSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationPublishedInSerializer.propertyToSerializerMap) { + if (CitationPublishedInSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationPublishedInSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationPublishedInSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo.js b/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo.js new file mode 100644 index 000000000..b8a226b16 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class CitationRelatesToSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relationshipType: (value) => CodeableConceptSerializer.serialize(value), + targetClassifier: (value) => CodeableConceptSerializer.serialize(value), + targetUri: null, + targetIdentifier: (value) => IdentifierSerializer.serialize(value), + targetReference: (value) => ReferenceSerializer.serialize(value), + targetAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationRelatesToSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationRelatesToSerializer.propertyToSerializerMap) { + if (CitationRelatesToSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationRelatesToSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationRelatesToSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo1.js b/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo1.js new file mode 100644 index 000000000..801f7e05a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationRelatesTo1.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class CitationRelatesTo1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relationshipType: (value) => CodeableConceptSerializer.serialize(value), + targetClassifier: (value) => CodeableConceptSerializer.serialize(value), + targetUri: null, + targetIdentifier: (value) => IdentifierSerializer.serialize(value), + targetReference: (value) => ReferenceSerializer.serialize(value), + targetAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationRelatesTo1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationRelatesTo1Serializer.propertyToSerializerMap) { + if (CitationRelatesTo1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationRelatesTo1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationRelatesTo1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate.js b/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate.js new file mode 100644 index 000000000..7b1092f3a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class CitationStatusDateSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + activity: (value) => CodeableConceptSerializer.serialize(value), + actual: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationStatusDateSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationStatusDateSerializer.propertyToSerializerMap) { + if (CitationStatusDateSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationStatusDateSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationStatusDateSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate1.js b/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate1.js new file mode 100644 index 000000000..76e9d4663 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationStatusDate1.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class CitationStatusDate1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + activity: (value) => CodeableConceptSerializer.serialize(value), + actual: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationStatusDate1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationStatusDate1Serializer.propertyToSerializerMap) { + if (CitationStatusDate1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationStatusDate1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationStatusDate1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationSummary.js b/src/fhir/serializers/4_0_0/backbone_elements/citationSummary.js new file mode 100644 index 000000000..a29d6526a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationSummary.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationSummarySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + style: (value) => CodeableConceptSerializer.serialize(value), + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationSummarySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationSummarySerializer.propertyToSerializerMap) { + if (CitationSummarySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationSummarySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationSummarySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationSummary1.js b/src/fhir/serializers/4_0_0/backbone_elements/citationSummary1.js new file mode 100644 index 000000000..b77a3506e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationSummary1.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationSummary1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + style: (value) => CodeableConceptSerializer.serialize(value), + source: (value) => CodeableConceptSerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationSummary1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationSummary1Serializer.propertyToSerializerMap) { + if (CitationSummary1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationSummary1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationSummary1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationTitle.js b/src/fhir/serializers/4_0_0/backbone_elements/citationTitle.js new file mode 100644 index 000000000..1abb00c44 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationTitle.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationTitleSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + language: (value) => CodeableConceptSerializer.serialize(value), + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationTitleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationTitleSerializer.propertyToSerializerMap) { + if (CitationTitleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationTitleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationTitleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationVersion.js b/src/fhir/serializers/4_0_0/backbone_elements/citationVersion.js new file mode 100644 index 000000000..134c01551 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationVersion.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CitationVersionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + value: null, + baseCitation: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationVersionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationVersionSerializer.propertyToSerializerMap) { + if (CitationVersionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationVersionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationVersionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationWebLocation.js b/src/fhir/serializers/4_0_0/backbone_elements/citationWebLocation.js new file mode 100644 index 000000000..84d5bfb54 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationWebLocation.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CitationWebLocationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationWebLocationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationWebLocationSerializer.propertyToSerializerMap) { + if (CitationWebLocationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationWebLocationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationWebLocationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/citationWhoClassified.js b/src/fhir/serializers/4_0_0/backbone_elements/citationWhoClassified.js new file mode 100644 index 000000000..01dcbcf8c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/citationWhoClassified.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CitationWhoClassifiedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + person: (value) => ReferenceSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + publisher: (value) => ReferenceSerializer.serialize(value), + classifierCopyright: null, + freeToShare: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationWhoClassifiedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationWhoClassifiedSerializer.propertyToSerializerMap) { + if (CitationWhoClassifiedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationWhoClassifiedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationWhoClassifiedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimAccident.js b/src/fhir/serializers/4_0_0/backbone_elements/claimAccident.js new file mode 100644 index 000000000..5621fb866 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimAccident.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimAccidentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + date: null, + type: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimAccidentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimAccidentSerializer.propertyToSerializerMap) { + if (ClaimAccidentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimAccidentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimAccidentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimCareTeam.js b/src/fhir/serializers/4_0_0/backbone_elements/claimCareTeam.js new file mode 100644 index 000000000..7d936b2f7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimCareTeam.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClaimCareTeamSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + provider: (value) => ReferenceSerializer.serialize(value), + responsible: null, + role: (value) => CodeableConceptSerializer.serialize(value), + qualification: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimCareTeamSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimCareTeamSerializer.propertyToSerializerMap) { + if (ClaimCareTeamSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimCareTeamSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimCareTeamSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/claimDetail.js new file mode 100644 index 000000000..cac2c0711 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimDetail.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ClaimSubDetailSerializer = require('../backbone_elements/claimSubDetail.js'); + +class ClaimDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value), + subDetail: (value) => ClaimSubDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimDetailSerializer.propertyToSerializerMap) { + if (ClaimDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimDiagnosis.js b/src/fhir/serializers/4_0_0/backbone_elements/claimDiagnosis.js new file mode 100644 index 000000000..285b75b2e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimDiagnosis.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimDiagnosisSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + diagnosisCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + diagnosisReference: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + onAdmission: (value) => CodeableConceptSerializer.serialize(value), + packageCode: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimDiagnosisSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimDiagnosisSerializer.propertyToSerializerMap) { + if (ClaimDiagnosisSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimDiagnosisSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimDiagnosisSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimInsurance.js b/src/fhir/serializers/4_0_0/backbone_elements/claimInsurance.js new file mode 100644 index 000000000..de8c4e5e5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimInsurance.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimInsuranceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + focal: null, + identifier: (value) => IdentifierSerializer.serialize(value), + coverage: (value) => ReferenceSerializer.serialize(value), + businessArrangement: null, + preAuthRef: null, + claimResponse: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimInsuranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimInsuranceSerializer.propertyToSerializerMap) { + if (ClaimInsuranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimInsuranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimInsuranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimItem.js b/src/fhir/serializers/4_0_0/backbone_elements/claimItem.js new file mode 100644 index 000000000..a215b30ed --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimItem.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ClaimDetailSerializer = require('../backbone_elements/claimDetail.js'); + +class ClaimItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + careTeamSequence: null, + diagnosisSequence: null, + procedureSequence: null, + informationSequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + locationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + subSite: (value) => CodeableConceptSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + detail: (value) => ClaimDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimItemSerializer.propertyToSerializerMap) { + if (ClaimItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimPayee.js b/src/fhir/serializers/4_0_0/backbone_elements/claimPayee.js new file mode 100644 index 000000000..fed7001f0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimPayee.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimPayeeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + party: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimPayeeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimPayeeSerializer.propertyToSerializerMap) { + if (ClaimPayeeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimPayeeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimPayeeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimProcedure.js b/src/fhir/serializers/4_0_0/backbone_elements/claimProcedure.js new file mode 100644 index 000000000..7e7f693f4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimProcedure.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimProcedureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + type: (value) => CodeableConceptSerializer.serialize(value), + date: null, + procedureCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + procedureReference: (value) => ReferenceSerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimProcedureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimProcedureSerializer.propertyToSerializerMap) { + if (ClaimProcedureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimProcedureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimProcedureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimRelated.js b/src/fhir/serializers/4_0_0/backbone_elements/claimRelated.js new file mode 100644 index 000000000..1c0a4246d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimRelated.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class ClaimRelatedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + claim: (value) => ReferenceSerializer.serialize(value), + relationship: (value) => CodeableConceptSerializer.serialize(value), + reference: (value) => IdentifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimRelatedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimRelatedSerializer.propertyToSerializerMap) { + if (ClaimRelatedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimRelatedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimRelatedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAddItem.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAddItem.js new file mode 100644 index 000000000..2e1ffccff --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAddItem.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); +const ClaimResponseDetail1Serializer = require('../backbone_elements/claimResponseDetail1.js'); + +class ClaimResponseAddItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemSequence: null, + detailSequence: null, + subdetailSequence: null, + provider: (value) => ReferenceSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + locationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + subSite: (value) => CodeableConceptSerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value), + detail: (value) => ClaimResponseDetail1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseAddItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseAddItemSerializer.propertyToSerializerMap) { + if (ClaimResponseAddItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseAddItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseAddItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAdjudication.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAdjudication.js new file mode 100644 index 000000000..5f2e7e170 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseAdjudication.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ClaimResponseAdjudicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseAdjudicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseAdjudicationSerializer.propertyToSerializerMap) { + if (ClaimResponseAdjudicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseAdjudicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseAdjudicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail.js new file mode 100644 index 000000000..d67e461e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); +const ClaimResponseSubDetailSerializer = require('../backbone_elements/claimResponseSubDetail.js'); + +class ClaimResponseDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + detailSequence: null, + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value), + subDetail: (value) => ClaimResponseSubDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseDetailSerializer.propertyToSerializerMap) { + if (ClaimResponseDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail1.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail1.js new file mode 100644 index 000000000..9eab6e004 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseDetail1.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); +const ClaimResponseSubDetail1Serializer = require('../backbone_elements/claimResponseSubDetail1.js'); + +class ClaimResponseDetail1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value), + subDetail: (value) => ClaimResponseSubDetail1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseDetail1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseDetail1Serializer.propertyToSerializerMap) { + if (ClaimResponseDetail1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseDetail1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseDetail1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseError.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseError.js new file mode 100644 index 000000000..36fcc7ee7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseError.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClaimResponseErrorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemSequence: null, + detailSequence: null, + subDetailSequence: null, + code: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseErrorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseErrorSerializer.propertyToSerializerMap) { + if (ClaimResponseErrorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseErrorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseErrorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseInsurance.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseInsurance.js new file mode 100644 index 000000000..564f94f61 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseInsurance.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimResponseInsuranceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + focal: null, + coverage: (value) => ReferenceSerializer.serialize(value), + businessArrangement: null, + claimResponse: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseInsuranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseInsuranceSerializer.propertyToSerializerMap) { + if (ClaimResponseInsuranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseInsuranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseInsuranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseItem.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseItem.js new file mode 100644 index 000000000..d90be0f5b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseItem.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); +const ClaimResponseDetailSerializer = require('../backbone_elements/claimResponseDetail.js'); + +class ClaimResponseItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemSequence: null, + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value), + detail: (value) => ClaimResponseDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseItemSerializer.propertyToSerializerMap) { + if (ClaimResponseItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponsePayment.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponsePayment.js new file mode 100644 index 000000000..5071e824f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponsePayment.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class ClaimResponsePaymentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + adjustment: (value) => MoneySerializer.serialize(value), + adjustmentReason: (value) => CodeableConceptSerializer.serialize(value), + date: null, + amount: (value) => MoneySerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponsePaymentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponsePaymentSerializer.propertyToSerializerMap) { + if (ClaimResponsePaymentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponsePaymentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponsePaymentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseProcessNote.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseProcessNote.js new file mode 100644 index 000000000..203565791 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseProcessNote.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClaimResponseProcessNoteSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + number: null, + type: null, + text: null, + language: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseProcessNoteSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseProcessNoteSerializer.propertyToSerializerMap) { + if (ClaimResponseProcessNoteSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseProcessNoteSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseProcessNoteSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail.js new file mode 100644 index 000000000..4cc3b870a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); + +class ClaimResponseSubDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + subDetailSequence: null, + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseSubDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseSubDetailSerializer.propertyToSerializerMap) { + if (ClaimResponseSubDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseSubDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseSubDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail1.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail1.js new file mode 100644 index 000000000..d76e84530 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseSubDetail1.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); + +class ClaimResponseSubDetail1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseSubDetail1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseSubDetail1Serializer.propertyToSerializerMap) { + if (ClaimResponseSubDetail1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseSubDetail1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseSubDetail1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimResponseTotal.js b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseTotal.js new file mode 100644 index 000000000..1bb102133 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimResponseTotal.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ClaimResponseTotalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseTotalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseTotalSerializer.propertyToSerializerMap) { + if (ClaimResponseTotalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseTotalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseTotalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimSubDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/claimSubDetail.js new file mode 100644 index 000000000..6cd3faf27 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimSubDetail.js @@ -0,0 +1,70 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimSubDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimSubDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimSubDetailSerializer.propertyToSerializerMap) { + if (ClaimSubDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimSubDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimSubDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/claimSupportingInfo.js b/src/fhir/serializers/4_0_0/backbone_elements/claimSupportingInfo.js new file mode 100644 index 000000000..0d06271e5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/claimSupportingInfo.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClaimSupportingInfoSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + timingDate: null, + timingPeriod: (value) => PeriodSerializer.serialize(value), + valueBoolean: null, + valueString: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimSupportingInfoSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimSupportingInfoSerializer.propertyToSerializerMap) { + if (ClaimSupportingInfoSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimSupportingInfoSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimSupportingInfoSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionFinding.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionFinding.js new file mode 100644 index 000000000..46c5f1d58 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionFinding.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClinicalImpressionFindingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value), + basis: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalImpressionFindingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalImpressionFindingSerializer.propertyToSerializerMap) { + if (ClinicalImpressionFindingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalImpressionFindingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalImpressionFindingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionInvestigation.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionInvestigation.js new file mode 100644 index 000000000..a4d8644c7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalImpressionInvestigation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ClinicalImpressionInvestigationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + item: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalImpressionInvestigationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalImpressionInvestigationSerializer.propertyToSerializerMap) { + if (ClinicalImpressionInvestigationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalImpressionInvestigationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalImpressionInvestigationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionContraindication.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionContraindication.js new file mode 100644 index 000000000..2e6dda4c0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionContraindication.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ClinicalUseDefinitionOtherTherapySerializer = require('../backbone_elements/clinicalUseDefinitionOtherTherapy.js'); + +class ClinicalUseDefinitionContraindicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + diseaseSymptomProcedure: (value) => CodeableReferenceSerializer.serialize(value), + diseaseStatus: (value) => CodeableReferenceSerializer.serialize(value), + comorbidity: (value) => CodeableReferenceSerializer.serialize(value), + indication: (value) => ReferenceSerializer.serialize(value), + otherTherapy: (value) => ClinicalUseDefinitionOtherTherapySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionContraindicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionContraindicationSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionContraindicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionContraindicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionContraindicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionIndication.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionIndication.js new file mode 100644 index 000000000..79ba9378d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionIndication.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ClinicalUseDefinitionOtherTherapySerializer = require('../backbone_elements/clinicalUseDefinitionOtherTherapy.js'); + +class ClinicalUseDefinitionIndicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + diseaseSymptomProcedure: (value) => CodeableReferenceSerializer.serialize(value), + diseaseStatus: (value) => CodeableReferenceSerializer.serialize(value), + comorbidity: (value) => CodeableReferenceSerializer.serialize(value), + intendedEffect: (value) => CodeableReferenceSerializer.serialize(value), + durationRange: (value) => RangeSerializer.serialize(value), + durationString: null, + undesirableEffect: (value) => ReferenceSerializer.serialize(value), + otherTherapy: (value) => ClinicalUseDefinitionOtherTherapySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionIndicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionIndicationSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionIndicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionIndicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionIndicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteractant.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteractant.js new file mode 100644 index 000000000..5ea710067 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteractant.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClinicalUseDefinitionInteractantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value), + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionInteractantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionInteractantSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionInteractantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionInteractantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionInteractantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteraction.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteraction.js new file mode 100644 index 000000000..2e8d73602 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionInteraction.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ClinicalUseDefinitionInteractantSerializer = require('../backbone_elements/clinicalUseDefinitionInteractant.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); + +class ClinicalUseDefinitionInteractionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + interactant: (value) => ClinicalUseDefinitionInteractantSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + effect: (value) => CodeableReferenceSerializer.serialize(value), + incidence: (value) => CodeableConceptSerializer.serialize(value), + management: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionInteractionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionInteractionSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionInteractionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionInteractionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionInteractionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionOtherTherapy.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionOtherTherapy.js new file mode 100644 index 000000000..7dc4ea4f5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionOtherTherapy.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); + +class ClinicalUseDefinitionOtherTherapySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relationshipType: (value) => CodeableConceptSerializer.serialize(value), + therapy: (value) => CodeableReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionOtherTherapySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionOtherTherapySerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionOtherTherapySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionOtherTherapySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionOtherTherapySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionUndesirableEffect.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionUndesirableEffect.js new file mode 100644 index 000000000..83e55066c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionUndesirableEffect.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClinicalUseDefinitionUndesirableEffectSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + symptomConditionEffect: (value) => CodeableReferenceSerializer.serialize(value), + classification: (value) => CodeableConceptSerializer.serialize(value), + frequencyOfOccurrence: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionUndesirableEffectSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionUndesirableEffectSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionUndesirableEffectSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionUndesirableEffectSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionUndesirableEffectSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionWarning.js b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionWarning.js new file mode 100644 index 000000000..4cce60bd4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/clinicalUseDefinitionWarning.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ClinicalUseDefinitionWarningSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + code: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionWarningSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionWarningSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionWarningSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionWarningSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionWarningSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/codeSystemConcept.js b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemConcept.js new file mode 100644 index 000000000..3e1fe4daa --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemConcept.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeSystemDesignationSerializer = require('../backbone_elements/codeSystemDesignation.js'); +const CodeSystemProperty1Serializer = require('../backbone_elements/codeSystemProperty1.js'); + +class CodeSystemConceptSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + display: null, + definition: null, + designation: (value) => CodeSystemDesignationSerializer.serialize(value), + property: (value) => CodeSystemProperty1Serializer.serialize(value), + concept: (value) => CodeSystemConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemConceptSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemConceptSerializer.propertyToSerializerMap) { + if (CodeSystemConceptSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemConceptSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemConceptSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/codeSystemDesignation.js b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemDesignation.js new file mode 100644 index 000000000..d25cd118c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemDesignation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class CodeSystemDesignationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + language: null, + use: (value) => CodingSerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemDesignationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemDesignationSerializer.propertyToSerializerMap) { + if (CodeSystemDesignationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemDesignationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemDesignationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/codeSystemFilter.js b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemFilter.js new file mode 100644 index 000000000..d4c7bcc3b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemFilter.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CodeSystemFilterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + description: null, + operator: null, + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemFilterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemFilterSerializer.propertyToSerializerMap) { + if (CodeSystemFilterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemFilterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemFilterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty.js new file mode 100644 index 000000000..fbfbf0a57 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CodeSystemPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + uri: null, + description: null, + type: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemPropertySerializer.propertyToSerializerMap) { + if (CodeSystemPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty1.js b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty1.js new file mode 100644 index 000000000..89ee88a84 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/codeSystemProperty1.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class CodeSystemProperty1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + valueCode: null, + valueCoding: (value) => CodingSerializer.serialize(value), + valueString: null, + valueInteger: null, + valueBoolean: null, + valueDateTime: null, + valueDecimal: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemProperty1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemProperty1Serializer.propertyToSerializerMap) { + if (CodeSystemProperty1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemProperty1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemProperty1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/communicationPayload.js b/src/fhir/serializers/4_0_0/backbone_elements/communicationPayload.js new file mode 100644 index 000000000..bdbdb8fd4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/communicationPayload.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CommunicationPayloadSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + contentString: null, + contentAttachment: (value) => AttachmentSerializer.serialize(value), + contentReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CommunicationPayloadSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CommunicationPayloadSerializer.propertyToSerializerMap) { + if (CommunicationPayloadSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CommunicationPayloadSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CommunicationPayloadSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/communicationRequestPayload.js b/src/fhir/serializers/4_0_0/backbone_elements/communicationRequestPayload.js new file mode 100644 index 000000000..6aa7e9616 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/communicationRequestPayload.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CommunicationRequestPayloadSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + contentString: null, + contentAttachment: (value) => AttachmentSerializer.serialize(value), + contentReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CommunicationRequestPayloadSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CommunicationRequestPayloadSerializer.propertyToSerializerMap) { + if (CommunicationRequestPayloadSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CommunicationRequestPayloadSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CommunicationRequestPayloadSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/compartmentDefinitionResource.js b/src/fhir/serializers/4_0_0/backbone_elements/compartmentDefinitionResource.js new file mode 100644 index 000000000..7afd84bd3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/compartmentDefinitionResource.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CompartmentDefinitionResourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + param: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompartmentDefinitionResourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompartmentDefinitionResourceSerializer.propertyToSerializerMap) { + if (CompartmentDefinitionResourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompartmentDefinitionResourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompartmentDefinitionResourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/compositionAttester.js b/src/fhir/serializers/4_0_0/backbone_elements/compositionAttester.js new file mode 100644 index 000000000..d096577e5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/compositionAttester.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CompositionAttesterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + time: null, + party: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompositionAttesterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompositionAttesterSerializer.propertyToSerializerMap) { + if (CompositionAttesterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompositionAttesterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompositionAttesterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/compositionEvent.js b/src/fhir/serializers/4_0_0/backbone_elements/compositionEvent.js new file mode 100644 index 000000000..457141911 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/compositionEvent.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CompositionEventSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + detail: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompositionEventSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompositionEventSerializer.propertyToSerializerMap) { + if (CompositionEventSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompositionEventSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompositionEventSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/compositionRelatesTo.js b/src/fhir/serializers/4_0_0/backbone_elements/compositionRelatesTo.js new file mode 100644 index 000000000..5894a8a0d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/compositionRelatesTo.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CompositionRelatesToSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + targetIdentifier: (value) => IdentifierSerializer.serialize(value), + targetReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompositionRelatesToSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompositionRelatesToSerializer.propertyToSerializerMap) { + if (CompositionRelatesToSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompositionRelatesToSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompositionRelatesToSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/compositionSection.js b/src/fhir/serializers/4_0_0/backbone_elements/compositionSection.js new file mode 100644 index 000000000..408523a0a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/compositionSection.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); + +class CompositionSectionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + title: null, + code: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ReferenceSerializer.serialize(value), + focus: (value) => ReferenceSerializer.serialize(value), + text: (value) => NarrativeSerializer.serialize(value), + mode: null, + orderedBy: (value) => CodeableConceptSerializer.serialize(value), + entry: (value) => ReferenceSerializer.serialize(value), + emptyReason: (value) => CodeableConceptSerializer.serialize(value), + section: (value) => CompositionSectionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompositionSectionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompositionSectionSerializer.propertyToSerializerMap) { + if (CompositionSectionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompositionSectionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompositionSectionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conceptMapDependsOn.js b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapDependsOn.js new file mode 100644 index 000000000..c46d041fe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapDependsOn.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ConceptMapDependsOnSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + property: null, + system: null, + value: null, + display: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapDependsOnSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapDependsOnSerializer.propertyToSerializerMap) { + if (ConceptMapDependsOnSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapDependsOnSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapDependsOnSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conceptMapElement.js b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapElement.js new file mode 100644 index 000000000..5e7d87e5e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapElement.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ConceptMapTargetSerializer = require('../backbone_elements/conceptMapTarget.js'); + +class ConceptMapElementSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + display: null, + target: (value) => ConceptMapTargetSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapElementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapElementSerializer.propertyToSerializerMap) { + if (ConceptMapElementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapElementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapElementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conceptMapGroup.js b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapGroup.js new file mode 100644 index 000000000..753f1d211 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapGroup.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ConceptMapElementSerializer = require('../backbone_elements/conceptMapElement.js'); +const ConceptMapUnmappedSerializer = require('../backbone_elements/conceptMapUnmapped.js'); + +class ConceptMapGroupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + source: null, + sourceVersion: null, + target: null, + targetVersion: null, + element: (value) => ConceptMapElementSerializer.serialize(value), + unmapped: (value) => ConceptMapUnmappedSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapGroupSerializer.propertyToSerializerMap) { + if (ConceptMapGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conceptMapTarget.js b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapTarget.js new file mode 100644 index 000000000..34d7f65f7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapTarget.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ConceptMapDependsOnSerializer = require('../backbone_elements/conceptMapDependsOn.js'); + +class ConceptMapTargetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + display: null, + equivalence: null, + comment: null, + dependsOn: (value) => ConceptMapDependsOnSerializer.serialize(value), + product: (value) => ConceptMapDependsOnSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapTargetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapTargetSerializer.propertyToSerializerMap) { + if (ConceptMapTargetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapTargetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapTargetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conceptMapUnmapped.js b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapUnmapped.js new file mode 100644 index 000000000..5fcabb402 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conceptMapUnmapped.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ConceptMapUnmappedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + mode: null, + code: null, + display: null, + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapUnmappedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapUnmappedSerializer.propertyToSerializerMap) { + if (ConceptMapUnmappedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapUnmappedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapUnmappedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conditionEvidence.js b/src/fhir/serializers/4_0_0/backbone_elements/conditionEvidence.js new file mode 100644 index 000000000..d64b7da2a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conditionEvidence.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ConditionEvidenceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + detail: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConditionEvidenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConditionEvidenceSerializer.propertyToSerializerMap) { + if (ConditionEvidenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConditionEvidenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConditionEvidenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/conditionStage.js b/src/fhir/serializers/4_0_0/backbone_elements/conditionStage.js new file mode 100644 index 000000000..091aff1b6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/conditionStage.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ConditionStageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + summary: (value) => CodeableConceptSerializer.serialize(value), + assessment: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConditionStageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConditionStageSerializer.propertyToSerializerMap) { + if (ConditionStageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConditionStageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConditionStageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/consentActor.js b/src/fhir/serializers/4_0_0/backbone_elements/consentActor.js new file mode 100644 index 000000000..826f07b13 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/consentActor.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ConsentActorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentActorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentActorSerializer.propertyToSerializerMap) { + if (ConsentActorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentActorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentActorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/consentData.js b/src/fhir/serializers/4_0_0/backbone_elements/consentData.js new file mode 100644 index 000000000..a611f3a40 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/consentData.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ConsentDataSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + meaning: null, + reference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentDataSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentDataSerializer.propertyToSerializerMap) { + if (ConsentDataSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentDataSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentDataSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/consentPolicy.js b/src/fhir/serializers/4_0_0/backbone_elements/consentPolicy.js new file mode 100644 index 000000000..7c019d1f6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/consentPolicy.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ConsentPolicySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + authority: null, + uri: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentPolicySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentPolicySerializer.propertyToSerializerMap) { + if (ConsentPolicySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentPolicySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentPolicySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/consentProvision.js b/src/fhir/serializers/4_0_0/backbone_elements/consentProvision.js new file mode 100644 index 000000000..6ab785856 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/consentProvision.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ConsentActorSerializer = require('../backbone_elements/consentActor.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ConsentDataSerializer = require('../backbone_elements/consentData.js'); + +class ConsentProvisionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + period: (value) => PeriodSerializer.serialize(value), + actor: (value) => ConsentActorSerializer.serialize(value), + action: (value) => CodeableConceptSerializer.serialize(value), + securityLabel: (value) => CodingSerializer.serialize(value), + purpose: (value) => CodingSerializer.serialize(value), + class: (value) => CodingSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + dataPeriod: (value) => PeriodSerializer.serialize(value), + data: (value) => ConsentDataSerializer.serialize(value), + provision: (value) => ConsentProvisionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentProvisionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentProvisionSerializer.propertyToSerializerMap) { + if (ConsentProvisionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentProvisionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentProvisionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/consentVerification.js b/src/fhir/serializers/4_0_0/backbone_elements/consentVerification.js new file mode 100644 index 000000000..e724cf4d1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/consentVerification.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ConsentVerificationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + verified: null, + verifiedWith: (value) => ReferenceSerializer.serialize(value), + verificationDate: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentVerificationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentVerificationSerializer.propertyToSerializerMap) { + if (ConsentVerificationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentVerificationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentVerificationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractAction.js b/src/fhir/serializers/4_0_0/backbone_elements/contractAction.js new file mode 100644 index 000000000..55f351502 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractAction.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContractSubjectSerializer = require('../backbone_elements/contractSubject.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class ContractActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + doNotPerform: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ContractSubjectSerializer.serialize(value), + intent: (value) => CodeableConceptSerializer.serialize(value), + linkId: null, + status: (value) => CodeableConceptSerializer.serialize(value), + context: (value) => ReferenceSerializer.serialize(value), + contextLinkId: null, + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + requester: (value) => ReferenceSerializer.serialize(value), + requesterLinkId: null, + performerType: (value) => CodeableConceptSerializer.serialize(value), + performerRole: (value) => CodeableConceptSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + performerLinkId: null, + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + reason: null, + reasonLinkId: null, + note: (value) => AnnotationSerializer.serialize(value), + securityLabelNumber: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractActionSerializer.propertyToSerializerMap) { + if (ContractActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractAnswer.js b/src/fhir/serializers/4_0_0/backbone_elements/contractAnswer.js new file mode 100644 index 000000000..c12aca06a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractAnswer.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ContractAnswerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + valueBoolean: null, + valueDecimal: null, + valueInteger: null, + valueDate: null, + valueDateTime: null, + valueTime: null, + valueString: null, + valueUri: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractAnswerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractAnswerSerializer.propertyToSerializerMap) { + if (ContractAnswerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractAnswerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractAnswerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractAsset.js b/src/fhir/serializers/4_0_0/backbone_elements/contractAsset.js new file mode 100644 index 000000000..0321454ed --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractAsset.js @@ -0,0 +1,77 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContractContextSerializer = require('../backbone_elements/contractContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ContractAnswerSerializer = require('../backbone_elements/contractAnswer.js'); +const ContractValuedItemSerializer = require('../backbone_elements/contractValuedItem.js'); + +class ContractAssetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + scope: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + typeReference: (value) => ReferenceSerializer.serialize(value), + subtype: (value) => CodeableConceptSerializer.serialize(value), + relationship: (value) => CodingSerializer.serialize(value), + context: (value) => ContractContextSerializer.serialize(value), + condition: null, + periodType: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + usePeriod: (value) => PeriodSerializer.serialize(value), + text: null, + linkId: null, + answer: (value) => ContractAnswerSerializer.serialize(value), + securityLabelNumber: null, + valuedItem: (value) => ContractValuedItemSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractAssetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractAssetSerializer.propertyToSerializerMap) { + if (ContractAssetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractAssetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractAssetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractContentDefinition.js b/src/fhir/serializers/4_0_0/backbone_elements/contractContentDefinition.js new file mode 100644 index 000000000..fe3117d95 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractContentDefinition.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ContractContentDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + publisher: (value) => ReferenceSerializer.serialize(value), + publicationDate: null, + publicationStatus: null, + copyright: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractContentDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractContentDefinitionSerializer.propertyToSerializerMap) { + if (ContractContentDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractContentDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractContentDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractContext.js b/src/fhir/serializers/4_0_0/backbone_elements/contractContext.js new file mode 100644 index 000000000..05c729652 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractContext.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ContractContextSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractContextSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractContextSerializer.propertyToSerializerMap) { + if (ContractContextSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractContextSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractContextSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractFriendly.js b/src/fhir/serializers/4_0_0/backbone_elements/contractFriendly.js new file mode 100644 index 000000000..0545c1413 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractFriendly.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ContractFriendlySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + contentAttachment: (value) => AttachmentSerializer.serialize(value), + contentReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractFriendlySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractFriendlySerializer.propertyToSerializerMap) { + if (ContractFriendlySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractFriendlySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractFriendlySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractLegal.js b/src/fhir/serializers/4_0_0/backbone_elements/contractLegal.js new file mode 100644 index 000000000..0de970a86 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractLegal.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ContractLegalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + contentAttachment: (value) => AttachmentSerializer.serialize(value), + contentReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractLegalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractLegalSerializer.propertyToSerializerMap) { + if (ContractLegalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractLegalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractLegalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractOffer.js b/src/fhir/serializers/4_0_0/backbone_elements/contractOffer.js new file mode 100644 index 000000000..7dad47a5d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractOffer.js @@ -0,0 +1,70 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContractPartySerializer = require('../backbone_elements/contractParty.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContractAnswerSerializer = require('../backbone_elements/contractAnswer.js'); + +class ContractOfferSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + party: (value) => ContractPartySerializer.serialize(value), + topic: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + decision: (value) => CodeableConceptSerializer.serialize(value), + decisionMode: (value) => CodeableConceptSerializer.serialize(value), + answer: (value) => ContractAnswerSerializer.serialize(value), + text: null, + linkId: null, + securityLabelNumber: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractOfferSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractOfferSerializer.propertyToSerializerMap) { + if (ContractOfferSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractOfferSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractOfferSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractParty.js b/src/fhir/serializers/4_0_0/backbone_elements/contractParty.js new file mode 100644 index 000000000..d576facca --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractParty.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ContractPartySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractPartySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractPartySerializer.propertyToSerializerMap) { + if (ContractPartySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractPartySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractPartySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractRule.js b/src/fhir/serializers/4_0_0/backbone_elements/contractRule.js new file mode 100644 index 000000000..787740242 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractRule.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ContractRuleSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + contentAttachment: (value) => AttachmentSerializer.serialize(value), + contentReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractRuleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractRuleSerializer.propertyToSerializerMap) { + if (ContractRuleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractRuleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractRuleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractSecurityLabel.js b/src/fhir/serializers/4_0_0/backbone_elements/contractSecurityLabel.js new file mode 100644 index 000000000..090e3a90d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractSecurityLabel.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class ContractSecurityLabelSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + number: null, + classification: (value) => CodingSerializer.serialize(value), + category: (value) => CodingSerializer.serialize(value), + control: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractSecurityLabelSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractSecurityLabelSerializer.propertyToSerializerMap) { + if (ContractSecurityLabelSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractSecurityLabelSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractSecurityLabelSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractSigner.js b/src/fhir/serializers/4_0_0/backbone_elements/contractSigner.js new file mode 100644 index 000000000..816d27e52 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractSigner.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SignatureSerializer = require('../complex_types/signature.js'); + +class ContractSignerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value), + party: (value) => ReferenceSerializer.serialize(value), + signature: (value) => SignatureSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractSignerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractSignerSerializer.propertyToSerializerMap) { + if (ContractSignerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractSignerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractSignerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractSubject.js b/src/fhir/serializers/4_0_0/backbone_elements/contractSubject.js new file mode 100644 index 000000000..ab0e79b94 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractSubject.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ContractSubjectSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractSubjectSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractSubjectSerializer.propertyToSerializerMap) { + if (ContractSubjectSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractSubjectSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractSubjectSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractTerm.js b/src/fhir/serializers/4_0_0/backbone_elements/contractTerm.js new file mode 100644 index 000000000..a63e8dc82 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractTerm.js @@ -0,0 +1,76 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContractSecurityLabelSerializer = require('../backbone_elements/contractSecurityLabel.js'); +const ContractOfferSerializer = require('../backbone_elements/contractOffer.js'); +const ContractAssetSerializer = require('../backbone_elements/contractAsset.js'); +const ContractActionSerializer = require('../backbone_elements/contractAction.js'); + +class ContractTermSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + issued: null, + applies: (value) => PeriodSerializer.serialize(value), + topicCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + topicReference: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + text: null, + securityLabel: (value) => ContractSecurityLabelSerializer.serialize(value), + offer: (value) => ContractOfferSerializer.serialize(value), + asset: (value) => ContractAssetSerializer.serialize(value), + action: (value) => ContractActionSerializer.serialize(value), + group: (value) => ContractTermSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractTermSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractTermSerializer.propertyToSerializerMap) { + if (ContractTermSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractTermSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractTermSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/contractValuedItem.js b/src/fhir/serializers/4_0_0/backbone_elements/contractValuedItem.js new file mode 100644 index 000000000..58350a7ca --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/contractValuedItem.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ContractValuedItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + entityCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + entityReference: (value) => ReferenceSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + effectiveTime: null, + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + points: null, + net: (value) => MoneySerializer.serialize(value), + payment: null, + paymentDate: null, + responsible: (value) => ReferenceSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value), + linkId: null, + securityLabelNumber: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractValuedItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractValuedItemSerializer.propertyToSerializerMap) { + if (ContractValuedItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractValuedItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractValuedItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageClass.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageClass.js new file mode 100644 index 000000000..66c37934f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageClass.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CoverageClassSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + value: null, + name: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageClassSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageClassSerializer.propertyToSerializerMap) { + if (CoverageClassSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageClassSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageClassSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageCostToBeneficiary.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageCostToBeneficiary.js new file mode 100644 index 000000000..659f0c9a4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageCostToBeneficiary.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const CoverageExceptionSerializer = require('../backbone_elements/coverageException.js'); + +class CoverageCostToBeneficiarySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + exception: (value) => CoverageExceptionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageCostToBeneficiarySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageCostToBeneficiarySerializer.propertyToSerializerMap) { + if (CoverageCostToBeneficiarySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageCostToBeneficiarySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageCostToBeneficiarySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestDiagnosis.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestDiagnosis.js new file mode 100644 index 000000000..bcf21b5e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestDiagnosis.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CoverageEligibilityRequestDiagnosisSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + diagnosisCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + diagnosisReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityRequestDiagnosisSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityRequestDiagnosisSerializer.propertyToSerializerMap) { + if (CoverageEligibilityRequestDiagnosisSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityRequestDiagnosisSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityRequestDiagnosisSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestInsurance.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestInsurance.js new file mode 100644 index 000000000..88ac78ca4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestInsurance.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CoverageEligibilityRequestInsuranceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + focal: null, + coverage: (value) => ReferenceSerializer.serialize(value), + businessArrangement: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityRequestInsuranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityRequestInsuranceSerializer.propertyToSerializerMap) { + if (CoverageEligibilityRequestInsuranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityRequestInsuranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityRequestInsuranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestItem.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestItem.js new file mode 100644 index 000000000..08066ebe3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestItem.js @@ -0,0 +1,70 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const CoverageEligibilityRequestDiagnosisSerializer = require('../backbone_elements/coverageEligibilityRequestDiagnosis.js'); + +class CoverageEligibilityRequestItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + supportingInfoSequence: null, + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + facility: (value) => ReferenceSerializer.serialize(value), + diagnosis: (value) => CoverageEligibilityRequestDiagnosisSerializer.serialize(value), + detail: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityRequestItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityRequestItemSerializer.propertyToSerializerMap) { + if (CoverageEligibilityRequestItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityRequestItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityRequestItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestSupportingInfo.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestSupportingInfo.js new file mode 100644 index 000000000..919064b69 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityRequestSupportingInfo.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CoverageEligibilityRequestSupportingInfoSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + information: (value) => ReferenceSerializer.serialize(value), + appliesToAll: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityRequestSupportingInfoSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityRequestSupportingInfoSerializer.propertyToSerializerMap) { + if (CoverageEligibilityRequestSupportingInfoSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityRequestSupportingInfoSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityRequestSupportingInfoSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseBenefit.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseBenefit.js new file mode 100644 index 000000000..18fa6f561 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseBenefit.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class CoverageEligibilityResponseBenefitSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + allowedUnsignedInt: null, + allowedString: null, + allowedMoney: (value) => MoneySerializer.serialize(value), + usedUnsignedInt: null, + usedString: null, + usedMoney: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityResponseBenefitSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityResponseBenefitSerializer.propertyToSerializerMap) { + if (CoverageEligibilityResponseBenefitSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityResponseBenefitSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityResponseBenefitSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseError.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseError.js new file mode 100644 index 000000000..2034fd765 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseError.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class CoverageEligibilityResponseErrorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityResponseErrorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityResponseErrorSerializer.propertyToSerializerMap) { + if (CoverageEligibilityResponseErrorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityResponseErrorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityResponseErrorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseInsurance.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseInsurance.js new file mode 100644 index 000000000..66b4a7b9a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseInsurance.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CoverageEligibilityResponseItemSerializer = require('../backbone_elements/coverageEligibilityResponseItem.js'); + +class CoverageEligibilityResponseInsuranceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + coverage: (value) => ReferenceSerializer.serialize(value), + inforce: null, + benefitPeriod: (value) => PeriodSerializer.serialize(value), + item: (value) => CoverageEligibilityResponseItemSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityResponseInsuranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityResponseInsuranceSerializer.propertyToSerializerMap) { + if (CoverageEligibilityResponseInsuranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityResponseInsuranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityResponseInsuranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseItem.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseItem.js new file mode 100644 index 000000000..b95673b6c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageEligibilityResponseItem.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CoverageEligibilityResponseBenefitSerializer = require('../backbone_elements/coverageEligibilityResponseBenefit.js'); + +class CoverageEligibilityResponseItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + excluded: null, + name: null, + description: null, + network: (value) => CodeableConceptSerializer.serialize(value), + unit: (value) => CodeableConceptSerializer.serialize(value), + term: (value) => CodeableConceptSerializer.serialize(value), + benefit: (value) => CoverageEligibilityResponseBenefitSerializer.serialize(value), + authorizationRequired: null, + authorizationSupporting: (value) => CodeableConceptSerializer.serialize(value), + authorizationUrl: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityResponseItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityResponseItemSerializer.propertyToSerializerMap) { + if (CoverageEligibilityResponseItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityResponseItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityResponseItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/coverageException.js b/src/fhir/serializers/4_0_0/backbone_elements/coverageException.js new file mode 100644 index 000000000..6188d23be --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/coverageException.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class CoverageExceptionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageExceptionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageExceptionSerializer.propertyToSerializerMap) { + if (CoverageExceptionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageExceptionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageExceptionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueEvidence.js b/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueEvidence.js new file mode 100644 index 000000000..841eba0be --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueEvidence.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class DetectedIssueEvidenceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + detail: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DetectedIssueEvidenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DetectedIssueEvidenceSerializer.propertyToSerializerMap) { + if (DetectedIssueEvidenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DetectedIssueEvidenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DetectedIssueEvidenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueMitigation.js b/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueMitigation.js new file mode 100644 index 000000000..6919b6439 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/detectedIssueMitigation.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class DetectedIssueMitigationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => CodeableConceptSerializer.serialize(value), + date: null, + author: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DetectedIssueMitigationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DetectedIssueMitigationSerializer.propertyToSerializerMap) { + if (DetectedIssueMitigationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DetectedIssueMitigationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DetectedIssueMitigationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionCapability.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionCapability.js new file mode 100644 index 000000000..a0d01d206 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionCapability.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class DeviceDefinitionCapabilitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + description: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionCapabilitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionCapabilitySerializer.propertyToSerializerMap) { + if (DeviceDefinitionCapabilitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionCapabilitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionCapabilitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionDeviceName.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionDeviceName.js new file mode 100644 index 000000000..c94f0d78b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionDeviceName.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceDefinitionDeviceNameSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionDeviceNameSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionDeviceNameSerializer.propertyToSerializerMap) { + if (DeviceDefinitionDeviceNameSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionDeviceNameSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionDeviceNameSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionMaterial.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionMaterial.js new file mode 100644 index 000000000..a6fe0ae8a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionMaterial.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class DeviceDefinitionMaterialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + substance: (value) => CodeableConceptSerializer.serialize(value), + alternate: null, + allergenicIndicator: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionMaterialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionMaterialSerializer.propertyToSerializerMap) { + if (DeviceDefinitionMaterialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionMaterialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionMaterialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionProperty.js new file mode 100644 index 000000000..48f7f31f6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionProperty.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class DeviceDefinitionPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueCode: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionPropertySerializer.propertyToSerializerMap) { + if (DeviceDefinitionPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionSpecialization.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionSpecialization.js new file mode 100644 index 000000000..e7079c46d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionSpecialization.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceDefinitionSpecializationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + systemType: null, + version: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionSpecializationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionSpecializationSerializer.propertyToSerializerMap) { + if (DeviceDefinitionSpecializationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionSpecializationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionSpecializationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionUdiDeviceIdentifier.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionUdiDeviceIdentifier.js new file mode 100644 index 000000000..491d929d3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDefinitionUdiDeviceIdentifier.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceDefinitionUdiDeviceIdentifierSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + deviceIdentifier: null, + issuer: null, + jurisdiction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionUdiDeviceIdentifierSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionUdiDeviceIdentifierSerializer.propertyToSerializerMap) { + if (DeviceDefinitionUdiDeviceIdentifierSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionUdiDeviceIdentifierSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionUdiDeviceIdentifierSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceDeviceName.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceDeviceName.js new file mode 100644 index 000000000..7348b85eb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceDeviceName.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceDeviceNameSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDeviceNameSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDeviceNameSerializer.propertyToSerializerMap) { + if (DeviceDeviceNameSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDeviceNameSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDeviceNameSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceMetricCalibration.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceMetricCalibration.js new file mode 100644 index 000000000..ae623b6d1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceMetricCalibration.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceMetricCalibrationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + state: null, + time: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceMetricCalibrationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceMetricCalibrationSerializer.propertyToSerializerMap) { + if (DeviceMetricCalibrationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceMetricCalibrationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceMetricCalibrationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceProperty.js new file mode 100644 index 000000000..862afe086 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceProperty.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class DevicePropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueCode: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DevicePropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DevicePropertySerializer.propertyToSerializerMap) { + if (DevicePropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DevicePropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DevicePropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceRequestParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceRequestParameter.js new file mode 100644 index 000000000..e9887de8e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceRequestParameter.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class DeviceRequestParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueBoolean: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceRequestParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceRequestParameterSerializer.propertyToSerializerMap) { + if (DeviceRequestParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceRequestParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceRequestParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceSpecialization.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceSpecialization.js new file mode 100644 index 000000000..34c9ce5c2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceSpecialization.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class DeviceSpecializationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + systemType: (value) => CodeableConceptSerializer.serialize(value), + version: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceSpecializationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceSpecializationSerializer.propertyToSerializerMap) { + if (DeviceSpecializationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceSpecializationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceSpecializationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceUdiCarrier.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceUdiCarrier.js new file mode 100644 index 000000000..dbaeec270 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceUdiCarrier.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DeviceUdiCarrierSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + deviceIdentifier: null, + issuer: null, + jurisdiction: null, + carrierAIDC: null, + carrierHRF: null, + entryType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceUdiCarrierSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceUdiCarrierSerializer.propertyToSerializerMap) { + if (DeviceUdiCarrierSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceUdiCarrierSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceUdiCarrierSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/deviceVersion.js b/src/fhir/serializers/4_0_0/backbone_elements/deviceVersion.js new file mode 100644 index 000000000..b31c465cc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/deviceVersion.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class DeviceVersionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + component: (value) => IdentifierSerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceVersionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceVersionSerializer.propertyToSerializerMap) { + if (DeviceVersionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceVersionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceVersionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/diagnosticReportMedia.js b/src/fhir/serializers/4_0_0/backbone_elements/diagnosticReportMedia.js new file mode 100644 index 000000000..425c78679 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/diagnosticReportMedia.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class DiagnosticReportMediaSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + comment: null, + link: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DiagnosticReportMediaSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DiagnosticReportMediaSerializer.propertyToSerializerMap) { + if (DiagnosticReportMediaSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DiagnosticReportMediaSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DiagnosticReportMediaSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/documentManifestRelated.js b/src/fhir/serializers/4_0_0/backbone_elements/documentManifestRelated.js new file mode 100644 index 000000000..45e88396c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/documentManifestRelated.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class DocumentManifestRelatedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + ref: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentManifestRelatedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentManifestRelatedSerializer.propertyToSerializerMap) { + if (DocumentManifestRelatedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentManifestRelatedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentManifestRelatedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContent.js b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContent.js new file mode 100644 index 000000000..94ad71046 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContent.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class DocumentReferenceContentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + attachment: (value) => AttachmentSerializer.serialize(value), + format: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentReferenceContentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentReferenceContentSerializer.propertyToSerializerMap) { + if (DocumentReferenceContentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentReferenceContentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentReferenceContentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContext.js b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContext.js new file mode 100644 index 000000000..f5d9c623d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceContext.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class DocumentReferenceContextSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + event: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + facilityType: (value) => CodeableConceptSerializer.serialize(value), + practiceSetting: (value) => CodeableConceptSerializer.serialize(value), + sourcePatientInfo: (value) => ReferenceSerializer.serialize(value), + related: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentReferenceContextSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentReferenceContextSerializer.propertyToSerializerMap) { + if (DocumentReferenceContextSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentReferenceContextSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentReferenceContextSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceRelatesTo.js b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceRelatesTo.js new file mode 100644 index 000000000..f22be8300 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/documentReferenceRelatesTo.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class DocumentReferenceRelatesToSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + target: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentReferenceRelatesToSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentReferenceRelatesToSerializer.propertyToSerializerMap) { + if (DocumentReferenceRelatesToSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentReferenceRelatesToSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentReferenceRelatesToSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/dosage.js b/src/fhir/serializers/4_0_0/backbone_elements/dosage.js new file mode 100644 index 000000000..de04bf9cc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/dosage.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const DosageDoseAndRateSerializer = require('../backbone_elements/dosageDoseAndRate.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class DosageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + text: null, + additionalInstruction: (value) => CodeableConceptSerializer.serialize(value), + patientInstruction: null, + timing: (value) => TimingSerializer.serialize(value), + asNeededBoolean: null, + asNeededCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + site: (value) => CodeableConceptSerializer.serialize(value), + route: (value) => CodeableConceptSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + doseAndRate: (value) => DosageDoseAndRateSerializer.serialize(value), + maxDosePerPeriod: (value) => RatioSerializer.serialize(value), + maxDosePerAdministration: (value) => QuantitySerializer.serialize(value), + maxDosePerLifetime: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DosageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DosageSerializer.propertyToSerializerMap) { + if (DosageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DosageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DosageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/dosageDoseAndRate.js b/src/fhir/serializers/4_0_0/backbone_elements/dosageDoseAndRate.js new file mode 100644 index 000000000..a97e216a4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/dosageDoseAndRate.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RangeSerializer = require('../complex_types/range.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class DosageDoseAndRateSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + doseRange: (value) => RangeSerializer.serialize(value), + doseQuantity: (value) => QuantitySerializer.serialize(value), + rateRatio: (value) => RatioSerializer.serialize(value), + rateRange: (value) => RangeSerializer.serialize(value), + rateQuantity: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DosageDoseAndRateSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DosageDoseAndRateSerializer.propertyToSerializerMap) { + if (DosageDoseAndRateSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DosageDoseAndRateSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DosageDoseAndRateSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinition.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinition.js new file mode 100644 index 000000000..cfc80b6c5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinition.js @@ -0,0 +1,290 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ElementDefinitionSlicingSerializer = require('../backbone_elements/elementDefinitionSlicing.js'); +const ElementDefinitionBaseSerializer = require('../backbone_elements/elementDefinitionBase.js'); +const ElementDefinitionTypeSerializer = require('../backbone_elements/elementDefinitionType.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RatioRangeSerializer = require('../complex_types/ratioRange.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const ElementDefinitionExampleSerializer = require('../backbone_elements/elementDefinitionExample.js'); +const ElementDefinitionConstraintSerializer = require('../backbone_elements/elementDefinitionConstraint.js'); +const ElementDefinitionBindingSerializer = require('../backbone_elements/elementDefinitionBinding.js'); +const ElementDefinitionMappingSerializer = require('../backbone_elements/elementDefinitionMapping.js'); + +class ElementDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + path: null, + representation: null, + sliceName: null, + sliceIsConstraining: null, + label: null, + code: (value) => CodingSerializer.serialize(value), + slicing: (value) => ElementDefinitionSlicingSerializer.serialize(value), + short: null, + definition: null, + comment: null, + requirements: null, + alias: null, + min: null, + max: null, + base: (value) => ElementDefinitionBaseSerializer.serialize(value), + contentReference: null, + type: (value) => ElementDefinitionTypeSerializer.serialize(value), + defaultValueBase64Binary: null, + defaultValueBoolean: null, + defaultValueCanonical: null, + defaultValueCode: null, + defaultValueDate: null, + defaultValueDateTime: null, + defaultValueDecimal: null, + defaultValueId: null, + defaultValueInstant: null, + defaultValueInteger: null, + defaultValueMarkdown: null, + defaultValueOid: null, + defaultValuePositiveInt: null, + defaultValueString: null, + defaultValueTime: null, + defaultValueUnsignedInt: null, + defaultValueUri: null, + defaultValueUrl: null, + defaultValueUuid: null, + defaultValueAddress: (value) => AddressSerializer.serialize(value), + defaultValueAge: (value) => QuantitySerializer.serialize(value), + defaultValueAnnotation: (value) => AnnotationSerializer.serialize(value), + defaultValueAttachment: (value) => AttachmentSerializer.serialize(value), + defaultValueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + defaultValueCodeableReference: (value) => CodeableReferenceSerializer.serialize(value), + defaultValueCoding: (value) => CodingSerializer.serialize(value), + defaultValueContactPoint: (value) => ContactPointSerializer.serialize(value), + defaultValueCount: (value) => QuantitySerializer.serialize(value), + defaultValueDistance: (value) => QuantitySerializer.serialize(value), + defaultValueDuration: (value) => QuantitySerializer.serialize(value), + defaultValueHumanName: (value) => HumanNameSerializer.serialize(value), + defaultValueIdentifier: (value) => IdentifierSerializer.serialize(value), + defaultValueMoney: (value) => MoneySerializer.serialize(value), + defaultValuePeriod: (value) => PeriodSerializer.serialize(value), + defaultValueQuantity: (value) => QuantitySerializer.serialize(value), + defaultValueRange: (value) => RangeSerializer.serialize(value), + defaultValueRatio: (value) => RatioSerializer.serialize(value), + defaultValueRatioRange: (value) => RatioRangeSerializer.serialize(value), + defaultValueReference: (value) => ReferenceSerializer.serialize(value), + defaultValueSampledData: (value) => SampledDataSerializer.serialize(value), + defaultValueSignature: (value) => SignatureSerializer.serialize(value), + defaultValueTiming: (value) => TimingSerializer.serialize(value), + defaultValueContactDetail: (value) => ContactDetailSerializer.serialize(value), + defaultValueContributor: (value) => ContributorSerializer.serialize(value), + defaultValueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + defaultValueExpression: (value) => ExpressionSerializer.serialize(value), + defaultValueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + defaultValueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + defaultValueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + defaultValueUsageContext: (value) => UsageContextSerializer.serialize(value), + defaultValueDosage: (value) => DosageSerializer.serialize(value), + meaningWhenMissing: null, + orderMeaning: null, + fixedBase64Binary: null, + fixedBoolean: null, + fixedCanonical: null, + fixedCode: null, + fixedDate: null, + fixedDateTime: null, + fixedDecimal: null, + fixedId: null, + fixedInstant: null, + fixedInteger: null, + fixedMarkdown: null, + fixedOid: null, + fixedPositiveInt: null, + fixedString: null, + fixedTime: null, + fixedUnsignedInt: null, + fixedUri: null, + fixedUrl: null, + fixedUuid: null, + fixedAddress: (value) => AddressSerializer.serialize(value), + fixedAge: (value) => QuantitySerializer.serialize(value), + fixedAnnotation: (value) => AnnotationSerializer.serialize(value), + fixedAttachment: (value) => AttachmentSerializer.serialize(value), + fixedCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + fixedCodeableReference: (value) => CodeableReferenceSerializer.serialize(value), + fixedCoding: (value) => CodingSerializer.serialize(value), + fixedContactPoint: (value) => ContactPointSerializer.serialize(value), + fixedCount: (value) => QuantitySerializer.serialize(value), + fixedDistance: (value) => QuantitySerializer.serialize(value), + fixedDuration: (value) => QuantitySerializer.serialize(value), + fixedHumanName: (value) => HumanNameSerializer.serialize(value), + fixedIdentifier: (value) => IdentifierSerializer.serialize(value), + fixedMoney: (value) => MoneySerializer.serialize(value), + fixedPeriod: (value) => PeriodSerializer.serialize(value), + fixedQuantity: (value) => QuantitySerializer.serialize(value), + fixedRange: (value) => RangeSerializer.serialize(value), + fixedRatio: (value) => RatioSerializer.serialize(value), + fixedRatioRange: (value) => RatioRangeSerializer.serialize(value), + fixedReference: (value) => ReferenceSerializer.serialize(value), + fixedSampledData: (value) => SampledDataSerializer.serialize(value), + fixedSignature: (value) => SignatureSerializer.serialize(value), + fixedTiming: (value) => TimingSerializer.serialize(value), + fixedContactDetail: (value) => ContactDetailSerializer.serialize(value), + fixedContributor: (value) => ContributorSerializer.serialize(value), + fixedDataRequirement: (value) => DataRequirementSerializer.serialize(value), + fixedExpression: (value) => ExpressionSerializer.serialize(value), + fixedParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + fixedRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + fixedTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + fixedUsageContext: (value) => UsageContextSerializer.serialize(value), + fixedDosage: (value) => DosageSerializer.serialize(value), + patternBase64Binary: null, + patternBoolean: null, + patternCanonical: null, + patternCode: null, + patternDate: null, + patternDateTime: null, + patternDecimal: null, + patternId: null, + patternInstant: null, + patternInteger: null, + patternMarkdown: null, + patternOid: null, + patternPositiveInt: null, + patternString: null, + patternTime: null, + patternUnsignedInt: null, + patternUri: null, + patternUrl: null, + patternUuid: null, + patternAddress: (value) => AddressSerializer.serialize(value), + patternAge: (value) => QuantitySerializer.serialize(value), + patternAnnotation: (value) => AnnotationSerializer.serialize(value), + patternAttachment: (value) => AttachmentSerializer.serialize(value), + patternCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + patternCodeableReference: (value) => CodeableReferenceSerializer.serialize(value), + patternCoding: (value) => CodingSerializer.serialize(value), + patternContactPoint: (value) => ContactPointSerializer.serialize(value), + patternCount: (value) => QuantitySerializer.serialize(value), + patternDistance: (value) => QuantitySerializer.serialize(value), + patternDuration: (value) => QuantitySerializer.serialize(value), + patternHumanName: (value) => HumanNameSerializer.serialize(value), + patternIdentifier: (value) => IdentifierSerializer.serialize(value), + patternMoney: (value) => MoneySerializer.serialize(value), + patternPeriod: (value) => PeriodSerializer.serialize(value), + patternQuantity: (value) => QuantitySerializer.serialize(value), + patternRange: (value) => RangeSerializer.serialize(value), + patternRatio: (value) => RatioSerializer.serialize(value), + patternRatioRange: (value) => RatioRangeSerializer.serialize(value), + patternReference: (value) => ReferenceSerializer.serialize(value), + patternSampledData: (value) => SampledDataSerializer.serialize(value), + patternSignature: (value) => SignatureSerializer.serialize(value), + patternTiming: (value) => TimingSerializer.serialize(value), + patternContactDetail: (value) => ContactDetailSerializer.serialize(value), + patternContributor: (value) => ContributorSerializer.serialize(value), + patternDataRequirement: (value) => DataRequirementSerializer.serialize(value), + patternExpression: (value) => ExpressionSerializer.serialize(value), + patternParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + patternRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + patternTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + patternUsageContext: (value) => UsageContextSerializer.serialize(value), + patternDosage: (value) => DosageSerializer.serialize(value), + example: (value) => ElementDefinitionExampleSerializer.serialize(value), + minValueDate: null, + minValueDateTime: null, + minValueInstant: null, + minValueTime: null, + minValueDecimal: null, + minValueInteger: null, + minValuePositiveInt: null, + minValueUnsignedInt: null, + minValueQuantity: (value) => QuantitySerializer.serialize(value), + maxValueDate: null, + maxValueDateTime: null, + maxValueInstant: null, + maxValueTime: null, + maxValueDecimal: null, + maxValueInteger: null, + maxValuePositiveInt: null, + maxValueUnsignedInt: null, + maxValueQuantity: (value) => QuantitySerializer.serialize(value), + maxLength: null, + condition: null, + constraint: (value) => ElementDefinitionConstraintSerializer.serialize(value), + mustSupport: null, + isModifier: null, + isModifierReason: null, + isSummary: null, + binding: (value) => ElementDefinitionBindingSerializer.serialize(value), + mapping: (value) => ElementDefinitionMappingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionSerializer.propertyToSerializerMap) { + if (ElementDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBase.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBase.js new file mode 100644 index 000000000..f7704b9e3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBase.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionBaseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + path: null, + min: null, + max: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionBaseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionBaseSerializer.propertyToSerializerMap) { + if (ElementDefinitionBaseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionBaseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionBaseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBinding.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBinding.js new file mode 100644 index 000000000..614cc1b32 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionBinding.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionBindingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + strength: null, + description: null, + valueSet: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionBindingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionBindingSerializer.propertyToSerializerMap) { + if (ElementDefinitionBindingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionBindingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionBindingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionConstraint.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionConstraint.js new file mode 100644 index 000000000..91e155bfe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionConstraint.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionConstraintSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + key: null, + requirements: null, + severity: null, + human: null, + expression: null, + xpath: null, + source: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionConstraintSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionConstraintSerializer.propertyToSerializerMap) { + if (ElementDefinitionConstraintSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionConstraintSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionConstraintSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionDiscriminator.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionDiscriminator.js new file mode 100644 index 000000000..26af1171c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionDiscriminator.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionDiscriminatorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + path: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionDiscriminatorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionDiscriminatorSerializer.propertyToSerializerMap) { + if (ElementDefinitionDiscriminatorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionDiscriminatorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionDiscriminatorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionExample.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionExample.js new file mode 100644 index 000000000..6c6153aed --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionExample.js @@ -0,0 +1,135 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RatioRangeSerializer = require('../complex_types/ratioRange.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); + +class ElementDefinitionExampleSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + label: null, + valueBase64Binary: null, + valueBoolean: null, + valueCanonical: null, + valueCode: null, + valueDate: null, + valueDateTime: null, + valueDecimal: null, + valueId: null, + valueInstant: null, + valueInteger: null, + valueMarkdown: null, + valueOid: null, + valuePositiveInt: null, + valueString: null, + valueTime: null, + valueUnsignedInt: null, + valueUri: null, + valueUrl: null, + valueUuid: null, + valueAddress: (value) => AddressSerializer.serialize(value), + valueAge: (value) => QuantitySerializer.serialize(value), + valueAnnotation: (value) => AnnotationSerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableReference: (value) => CodeableReferenceSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueContactPoint: (value) => ContactPointSerializer.serialize(value), + valueCount: (value) => QuantitySerializer.serialize(value), + valueDistance: (value) => QuantitySerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value), + valueHumanName: (value) => HumanNameSerializer.serialize(value), + valueIdentifier: (value) => IdentifierSerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueRatioRange: (value) => RatioRangeSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueSignature: (value) => SignatureSerializer.serialize(value), + valueTiming: (value) => TimingSerializer.serialize(value), + valueContactDetail: (value) => ContactDetailSerializer.serialize(value), + valueContributor: (value) => ContributorSerializer.serialize(value), + valueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + valueExpression: (value) => ExpressionSerializer.serialize(value), + valueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + valueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + valueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + valueUsageContext: (value) => UsageContextSerializer.serialize(value), + valueDosage: (value) => DosageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionExampleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionExampleSerializer.propertyToSerializerMap) { + if (ElementDefinitionExampleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionExampleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionExampleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionMapping.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionMapping.js new file mode 100644 index 000000000..3cedaa3b4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionMapping.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionMappingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identity: null, + language: null, + map: null, + comment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionMappingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionMappingSerializer.propertyToSerializerMap) { + if (ElementDefinitionMappingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionMappingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionMappingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionSlicing.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionSlicing.js new file mode 100644 index 000000000..d24b349bf --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionSlicing.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ElementDefinitionDiscriminatorSerializer = require('../backbone_elements/elementDefinitionDiscriminator.js'); + +class ElementDefinitionSlicingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + discriminator: (value) => ElementDefinitionDiscriminatorSerializer.serialize(value), + description: null, + ordered: null, + rules: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionSlicingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionSlicingSerializer.propertyToSerializerMap) { + if (ElementDefinitionSlicingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionSlicingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionSlicingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionType.js b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionType.js new file mode 100644 index 000000000..d1fb82ffb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/elementDefinitionType.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementDefinitionTypeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + profile: null, + targetProfile: null, + aggregation: null, + versioning: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementDefinitionTypeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementDefinitionTypeSerializer.propertyToSerializerMap) { + if (ElementDefinitionTypeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementDefinitionTypeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementDefinitionTypeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterClassHistory.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterClassHistory.js new file mode 100644 index 000000000..d04a7e4ae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterClassHistory.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EncounterClassHistorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + class: (value) => CodingSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterClassHistorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterClassHistorySerializer.propertyToSerializerMap) { + if (EncounterClassHistorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterClassHistorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterClassHistorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterDiagnosis.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterDiagnosis.js new file mode 100644 index 000000000..9f72acd53 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterDiagnosis.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class EncounterDiagnosisSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + condition: (value) => ReferenceSerializer.serialize(value), + use: (value) => CodeableConceptSerializer.serialize(value), + rank: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterDiagnosisSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterDiagnosisSerializer.propertyToSerializerMap) { + if (EncounterDiagnosisSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterDiagnosisSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterDiagnosisSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterHospitalization.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterHospitalization.js new file mode 100644 index 000000000..9fc7376d3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterHospitalization.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class EncounterHospitalizationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + preAdmissionIdentifier: (value) => IdentifierSerializer.serialize(value), + origin: (value) => ReferenceSerializer.serialize(value), + admitSource: (value) => CodeableConceptSerializer.serialize(value), + reAdmission: (value) => CodeableConceptSerializer.serialize(value), + dietPreference: (value) => CodeableConceptSerializer.serialize(value), + specialCourtesy: (value) => CodeableConceptSerializer.serialize(value), + specialArrangement: (value) => CodeableConceptSerializer.serialize(value), + destination: (value) => ReferenceSerializer.serialize(value), + dischargeDisposition: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterHospitalizationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterHospitalizationSerializer.propertyToSerializerMap) { + if (EncounterHospitalizationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterHospitalizationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterHospitalizationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterLocation.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterLocation.js new file mode 100644 index 000000000..8a25ad3e6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterLocation.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EncounterLocationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + status: null, + physicalType: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterLocationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterLocationSerializer.propertyToSerializerMap) { + if (EncounterLocationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterLocationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterLocationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterParticipant.js new file mode 100644 index 000000000..6531f59f7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterParticipant.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class EncounterParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + individual: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterParticipantSerializer.propertyToSerializerMap) { + if (EncounterParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/encounterStatusHistory.js b/src/fhir/serializers/4_0_0/backbone_elements/encounterStatusHistory.js new file mode 100644 index 000000000..a621b482e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/encounterStatusHistory.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EncounterStatusHistorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterStatusHistorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterStatusHistorySerializer.propertyToSerializerMap) { + if (EncounterStatusHistorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterStatusHistorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterStatusHistorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareDiagnosis.js b/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareDiagnosis.js new file mode 100644 index 000000000..f9837a7ae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareDiagnosis.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class EpisodeOfCareDiagnosisSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + condition: (value) => ReferenceSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + rank: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EpisodeOfCareDiagnosisSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EpisodeOfCareDiagnosisSerializer.propertyToSerializerMap) { + if (EpisodeOfCareDiagnosisSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EpisodeOfCareDiagnosisSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EpisodeOfCareDiagnosisSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareStatusHistory.js b/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareStatusHistory.js new file mode 100644 index 000000000..ab00b9c9d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/episodeOfCareStatusHistory.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EpisodeOfCareStatusHistorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EpisodeOfCareStatusHistorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EpisodeOfCareStatusHistorySerializer.propertyToSerializerMap) { + if (EpisodeOfCareStatusHistorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EpisodeOfCareStatusHistorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EpisodeOfCareStatusHistorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceAttributeEstimate.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceAttributeEstimate.js new file mode 100644 index 000000000..3982594f9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceAttributeEstimate.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class EvidenceAttributeEstimateSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + note: (value) => AnnotationSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + level: null, + range: (value) => RangeSerializer.serialize(value), + attributeEstimate: (value) => EvidenceAttributeEstimateSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceAttributeEstimateSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceAttributeEstimateSerializer.propertyToSerializerMap) { + if (EvidenceAttributeEstimateSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceAttributeEstimateSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceAttributeEstimateSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceCertainty.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceCertainty.js new file mode 100644 index 000000000..ae538af4c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceCertainty.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class EvidenceCertaintySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + note: (value) => AnnotationSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + rating: (value) => CodeableConceptSerializer.serialize(value), + rater: null, + subcomponent: (value) => EvidenceCertaintySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceCertaintySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceCertaintySerializer.propertyToSerializerMap) { + if (EvidenceCertaintySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceCertaintySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceCertaintySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceModelCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceModelCharacteristic.js new file mode 100644 index 000000000..a3fa82a09 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceModelCharacteristic.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const EvidenceVariableSerializer = require('../backbone_elements/evidenceVariable.js'); +const EvidenceAttributeEstimateSerializer = require('../backbone_elements/evidenceAttributeEstimate.js'); + +class EvidenceModelCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + value: (value) => QuantitySerializer.serialize(value), + variable: (value) => EvidenceVariableSerializer.serialize(value), + attributeEstimate: (value) => EvidenceAttributeEstimateSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceModelCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceModelCharacteristicSerializer.propertyToSerializerMap) { + if (EvidenceModelCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceModelCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceModelCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportCharacteristic.js new file mode 100644 index 000000000..172a3f832 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportCharacteristic.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EvidenceReportCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueBoolean: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + exclude: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceReportCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceReportCharacteristicSerializer.propertyToSerializerMap) { + if (EvidenceReportCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceReportCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceReportCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportRelatesTo.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportRelatesTo.js new file mode 100644 index 000000000..3f537c603 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportRelatesTo.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class EvidenceReportRelatesToSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + targetIdentifier: (value) => IdentifierSerializer.serialize(value), + targetReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceReportRelatesToSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceReportRelatesToSerializer.propertyToSerializerMap) { + if (EvidenceReportRelatesToSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceReportRelatesToSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceReportRelatesToSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSection.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSection.js new file mode 100644 index 000000000..c5ac0f52c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSection.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class EvidenceReportSectionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + title: null, + focus: (value) => CodeableConceptSerializer.serialize(value), + focusReference: (value) => ReferenceSerializer.serialize(value), + author: (value) => ReferenceSerializer.serialize(value), + text: (value) => NarrativeSerializer.serialize(value), + mode: null, + orderedBy: (value) => CodeableConceptSerializer.serialize(value), + entryClassifier: (value) => CodeableConceptSerializer.serialize(value), + entryReference: (value) => ReferenceSerializer.serialize(value), + entryQuantity: (value) => QuantitySerializer.serialize(value), + emptyReason: (value) => CodeableConceptSerializer.serialize(value), + section: (value) => EvidenceReportSectionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceReportSectionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceReportSectionSerializer.propertyToSerializerMap) { + if (EvidenceReportSectionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceReportSectionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceReportSectionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSubject.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSubject.js new file mode 100644 index 000000000..fd8e8217d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceReportSubject.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const EvidenceReportCharacteristicSerializer = require('../backbone_elements/evidenceReportCharacteristic.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class EvidenceReportSubjectSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + characteristic: (value) => EvidenceReportCharacteristicSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceReportSubjectSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceReportSubjectSerializer.propertyToSerializerMap) { + if (EvidenceReportSubjectSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceReportSubjectSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceReportSubjectSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceSampleSize.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceSampleSize.js new file mode 100644 index 000000000..ef9062897 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceSampleSize.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class EvidenceSampleSizeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + note: (value) => AnnotationSerializer.serialize(value), + numberOfStudies: null, + numberOfParticipants: null, + knownDataCount: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceSampleSizeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceSampleSizeSerializer.propertyToSerializerMap) { + if (EvidenceSampleSizeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceSampleSizeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceSampleSizeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceStatistic.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceStatistic.js new file mode 100644 index 000000000..8379f5abc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceStatistic.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const EvidenceSampleSizeSerializer = require('../backbone_elements/evidenceSampleSize.js'); +const EvidenceAttributeEstimateSerializer = require('../backbone_elements/evidenceAttributeEstimate.js'); +const EvidenceModelCharacteristicSerializer = require('../backbone_elements/evidenceModelCharacteristic.js'); + +class EvidenceStatisticSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + note: (value) => AnnotationSerializer.serialize(value), + statisticType: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + numberOfEvents: null, + numberAffected: null, + sampleSize: (value) => EvidenceSampleSizeSerializer.serialize(value), + attributeEstimate: (value) => EvidenceAttributeEstimateSerializer.serialize(value), + modelCharacteristic: (value) => EvidenceModelCharacteristicSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceStatisticSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceStatisticSerializer.propertyToSerializerMap) { + if (EvidenceStatisticSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceStatisticSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceStatisticSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariable.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariable.js new file mode 100644 index 000000000..87b5f11c0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariable.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class EvidenceVariableSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + variableDefinition: (value) => ReferenceSerializer.serialize(value), + handling: null, + valueCategory: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableSerializer.propertyToSerializerMap) { + if (EvidenceVariableSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCategory.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCategory.js new file mode 100644 index 000000000..b75c79a7f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCategory.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class EvidenceVariableCategorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableCategorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableCategorySerializer.propertyToSerializerMap) { + if (EvidenceVariableCategorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableCategorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableCategorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCharacteristic.js new file mode 100644 index 000000000..7889131d2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableCharacteristic.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const EvidenceVariableTimeFromStartSerializer = require('../backbone_elements/evidenceVariableTimeFromStart.js'); + +class EvidenceVariableCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + definitionReference: (value) => ReferenceSerializer.serialize(value), + definitionCanonical: null, + definitionCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + definitionExpression: (value) => ExpressionSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + exclude: null, + timeFromStart: (value) => EvidenceVariableTimeFromStartSerializer.serialize(value), + groupMeasure: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableCharacteristicSerializer.propertyToSerializerMap) { + if (EvidenceVariableCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableDefinition.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableDefinition.js new file mode 100644 index 000000000..f8352caf6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableDefinition.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class EvidenceVariableDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + note: (value) => AnnotationSerializer.serialize(value), + variableRole: (value) => CodeableConceptSerializer.serialize(value), + observed: (value) => ReferenceSerializer.serialize(value), + intended: (value) => ReferenceSerializer.serialize(value), + directnessMatch: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableDefinitionSerializer.propertyToSerializerMap) { + if (EvidenceVariableDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableTimeFromStart.js b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableTimeFromStart.js new file mode 100644 index 000000000..2743a35a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/evidenceVariableTimeFromStart.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class EvidenceVariableTimeFromStartSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + quantity: (value) => QuantitySerializer.serialize(value), + range: (value) => RangeSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableTimeFromStartSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableTimeFromStartSerializer.propertyToSerializerMap) { + if (EvidenceVariableTimeFromStartSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableTimeFromStartSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableTimeFromStartSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioActor.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioActor.js new file mode 100644 index 000000000..9b3f7dee3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioActor.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ExampleScenarioActorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + actorId: null, + type: null, + name: null, + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioActorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioActorSerializer.propertyToSerializerMap) { + if (ExampleScenarioActorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioActorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioActorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioAlternative.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioAlternative.js new file mode 100644 index 000000000..b4e5cb245 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioAlternative.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExampleScenarioStepSerializer = require('../backbone_elements/exampleScenarioStep.js'); + +class ExampleScenarioAlternativeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + title: null, + description: null, + step: (value) => ExampleScenarioStepSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioAlternativeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioAlternativeSerializer.propertyToSerializerMap) { + if (ExampleScenarioAlternativeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioAlternativeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioAlternativeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioContainedInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioContainedInstance.js new file mode 100644 index 000000000..7c784860b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioContainedInstance.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ExampleScenarioContainedInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + resourceId: null, + versionId: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioContainedInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioContainedInstanceSerializer.propertyToSerializerMap) { + if (ExampleScenarioContainedInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioContainedInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioContainedInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioInstance.js new file mode 100644 index 000000000..df5e575b3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioInstance.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExampleScenarioVersionSerializer = require('../backbone_elements/exampleScenarioVersion.js'); +const ExampleScenarioContainedInstanceSerializer = require('../backbone_elements/exampleScenarioContainedInstance.js'); + +class ExampleScenarioInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + resourceId: null, + resourceType: null, + name: null, + description: null, + version: (value) => ExampleScenarioVersionSerializer.serialize(value), + containedInstance: (value) => ExampleScenarioContainedInstanceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioInstanceSerializer.propertyToSerializerMap) { + if (ExampleScenarioInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioOperation.js new file mode 100644 index 000000000..21007f602 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioOperation.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExampleScenarioContainedInstanceSerializer = require('../backbone_elements/exampleScenarioContainedInstance.js'); + +class ExampleScenarioOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + number: null, + type: null, + name: null, + initiator: null, + receiver: null, + description: null, + initiatorActive: null, + receiverActive: null, + request: (value) => ExampleScenarioContainedInstanceSerializer.serialize(value), + response: (value) => ExampleScenarioContainedInstanceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioOperationSerializer.propertyToSerializerMap) { + if (ExampleScenarioOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioProcess.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioProcess.js new file mode 100644 index 000000000..ca3a6d374 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioProcess.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExampleScenarioStepSerializer = require('../backbone_elements/exampleScenarioStep.js'); + +class ExampleScenarioProcessSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + title: null, + description: null, + preConditions: null, + postConditions: null, + step: (value) => ExampleScenarioStepSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioProcessSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioProcessSerializer.propertyToSerializerMap) { + if (ExampleScenarioProcessSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioProcessSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioProcessSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioStep.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioStep.js new file mode 100644 index 000000000..911ebbced --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioStep.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExampleScenarioProcessSerializer = require('../backbone_elements/exampleScenarioProcess.js'); +const ExampleScenarioOperationSerializer = require('../backbone_elements/exampleScenarioOperation.js'); +const ExampleScenarioAlternativeSerializer = require('../backbone_elements/exampleScenarioAlternative.js'); + +class ExampleScenarioStepSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + process: (value) => ExampleScenarioProcessSerializer.serialize(value), + pause: null, + operation: (value) => ExampleScenarioOperationSerializer.serialize(value), + alternative: (value) => ExampleScenarioAlternativeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioStepSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioStepSerializer.propertyToSerializerMap) { + if (ExampleScenarioStepSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioStepSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioStepSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioVersion.js b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioVersion.js new file mode 100644 index 000000000..c2ae78ac7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/exampleScenarioVersion.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ExampleScenarioVersionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + versionId: null, + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioVersionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioVersionSerializer.propertyToSerializerMap) { + if (ExampleScenarioVersionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioVersionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioVersionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAccident.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAccident.js new file mode 100644 index 000000000..b6d160762 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAccident.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ExplanationOfBenefitAccidentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + date: null, + type: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitAccidentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitAccidentSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitAccidentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitAccidentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitAccidentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAddItem.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAddItem.js new file mode 100644 index 000000000..5ad8e35fd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAddItem.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); +const ExplanationOfBenefitDetail1Serializer = require('../backbone_elements/explanationOfBenefitDetail1.js'); + +class ExplanationOfBenefitAddItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemSequence: null, + detailSequence: null, + subDetailSequence: null, + provider: (value) => ReferenceSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + locationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + subSite: (value) => CodeableConceptSerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value), + detail: (value) => ExplanationOfBenefitDetail1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitAddItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitAddItemSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitAddItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitAddItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitAddItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAdjudication.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAdjudication.js new file mode 100644 index 000000000..9a8be0a89 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitAdjudication.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ExplanationOfBenefitAdjudicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitAdjudicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitAdjudicationSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitAdjudicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitAdjudicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitAdjudicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitBenefitBalance.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitBenefitBalance.js new file mode 100644 index 000000000..a0fd388c3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitBenefitBalance.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExplanationOfBenefitFinancialSerializer = require('../backbone_elements/explanationOfBenefitFinancial.js'); + +class ExplanationOfBenefitBenefitBalanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + excluded: null, + name: null, + description: null, + network: (value) => CodeableConceptSerializer.serialize(value), + unit: (value) => CodeableConceptSerializer.serialize(value), + term: (value) => CodeableConceptSerializer.serialize(value), + financial: (value) => ExplanationOfBenefitFinancialSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitBenefitBalanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitBenefitBalanceSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitBenefitBalanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitBenefitBalanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitBenefitBalanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitCareTeam.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitCareTeam.js new file mode 100644 index 000000000..a07f34e19 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitCareTeam.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ExplanationOfBenefitCareTeamSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + provider: (value) => ReferenceSerializer.serialize(value), + responsible: null, + role: (value) => CodeableConceptSerializer.serialize(value), + qualification: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitCareTeamSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitCareTeamSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitCareTeamSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitCareTeamSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitCareTeamSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail.js new file mode 100644 index 000000000..15332dcd2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); +const ExplanationOfBenefitSubDetailSerializer = require('../backbone_elements/explanationOfBenefitSubDetail.js'); + +class ExplanationOfBenefitDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value), + subDetail: (value) => ExplanationOfBenefitSubDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitDetailSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail1.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail1.js new file mode 100644 index 000000000..da90c2c1e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDetail1.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); +const ExplanationOfBenefitSubDetail1Serializer = require('../backbone_elements/explanationOfBenefitSubDetail1.js'); + +class ExplanationOfBenefitDetail1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value), + subDetail: (value) => ExplanationOfBenefitSubDetail1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitDetail1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitDetail1Serializer.propertyToSerializerMap) { + if (ExplanationOfBenefitDetail1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitDetail1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitDetail1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDiagnosis.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDiagnosis.js new file mode 100644 index 000000000..372d1f55d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitDiagnosis.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ExplanationOfBenefitDiagnosisSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + diagnosisCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + diagnosisReference: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + onAdmission: (value) => CodeableConceptSerializer.serialize(value), + packageCode: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitDiagnosisSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitDiagnosisSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitDiagnosisSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitDiagnosisSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitDiagnosisSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitFinancial.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitFinancial.js new file mode 100644 index 000000000..ceb64bd66 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitFinancial.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ExplanationOfBenefitFinancialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + allowedUnsignedInt: null, + allowedString: null, + allowedMoney: (value) => MoneySerializer.serialize(value), + usedUnsignedInt: null, + usedMoney: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitFinancialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitFinancialSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitFinancialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitFinancialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitFinancialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitInsurance.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitInsurance.js new file mode 100644 index 000000000..d8b2f2a83 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitInsurance.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ExplanationOfBenefitInsuranceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + focal: null, + coverage: (value) => ReferenceSerializer.serialize(value), + preAuthRef: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitInsuranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitInsuranceSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitInsuranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitInsuranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitInsuranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitItem.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitItem.js new file mode 100644 index 000000000..ebdd3f43c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitItem.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); +const ExplanationOfBenefitDetailSerializer = require('../backbone_elements/explanationOfBenefitDetail.js'); + +class ExplanationOfBenefitItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + careTeamSequence: null, + diagnosisSequence: null, + procedureSequence: null, + informationSequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + locationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + locationAddress: (value) => AddressSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + subSite: (value) => CodeableConceptSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value), + detail: (value) => ExplanationOfBenefitDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitItemSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayee.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayee.js new file mode 100644 index 000000000..951a8181e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayee.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ExplanationOfBenefitPayeeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + party: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitPayeeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitPayeeSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitPayeeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitPayeeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitPayeeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayment.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayment.js new file mode 100644 index 000000000..667aaeff3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitPayment.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class ExplanationOfBenefitPaymentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + adjustment: (value) => MoneySerializer.serialize(value), + adjustmentReason: (value) => CodeableConceptSerializer.serialize(value), + date: null, + amount: (value) => MoneySerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitPaymentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitPaymentSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitPaymentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitPaymentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitPaymentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcedure.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcedure.js new file mode 100644 index 000000000..4778939c3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcedure.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ExplanationOfBenefitProcedureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + type: (value) => CodeableConceptSerializer.serialize(value), + date: null, + procedureCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + procedureReference: (value) => ReferenceSerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitProcedureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitProcedureSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitProcedureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitProcedureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitProcedureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcessNote.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcessNote.js new file mode 100644 index 000000000..e7bd8fce9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitProcessNote.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ExplanationOfBenefitProcessNoteSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + number: null, + type: null, + text: null, + language: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitProcessNoteSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitProcessNoteSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitProcessNoteSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitProcessNoteSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitProcessNoteSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitRelated.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitRelated.js new file mode 100644 index 000000000..e04b7efc6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitRelated.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class ExplanationOfBenefitRelatedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + claim: (value) => ReferenceSerializer.serialize(value), + relationship: (value) => CodeableConceptSerializer.serialize(value), + reference: (value) => IdentifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitRelatedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitRelatedSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitRelatedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitRelatedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitRelatedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail.js new file mode 100644 index 000000000..c7f5967a7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); + +class ExplanationOfBenefitSubDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + revenue: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + programCode: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + udi: (value) => ReferenceSerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitSubDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitSubDetailSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitSubDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitSubDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitSubDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail1.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail1.js new file mode 100644 index 000000000..e2c403edb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSubDetail1.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); + +class ExplanationOfBenefitSubDetail1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + productOrService: (value) => CodeableConceptSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + unitPrice: (value) => MoneySerializer.serialize(value), + factor: null, + net: (value) => MoneySerializer.serialize(value), + noteNumber: null, + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitSubDetail1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitSubDetail1Serializer.propertyToSerializerMap) { + if (ExplanationOfBenefitSubDetail1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitSubDetail1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitSubDetail1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSupportingInfo.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSupportingInfo.js new file mode 100644 index 000000000..76f9945e7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitSupportingInfo.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class ExplanationOfBenefitSupportingInfoSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + timingDate: null, + timingPeriod: (value) => PeriodSerializer.serialize(value), + valueBoolean: null, + valueString: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + reason: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitSupportingInfoSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitSupportingInfoSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitSupportingInfoSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitSupportingInfoSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitSupportingInfoSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitTotal.js b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitTotal.js new file mode 100644 index 000000000..9071562cf --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/explanationOfBenefitTotal.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ExplanationOfBenefitTotalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitTotalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitTotalSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitTotalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitTotalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitTotalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/familyMemberHistoryCondition.js b/src/fhir/serializers/4_0_0/backbone_elements/familyMemberHistoryCondition.js new file mode 100644 index 000000000..53edf7c9c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/familyMemberHistoryCondition.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class FamilyMemberHistoryConditionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + outcome: (value) => CodeableConceptSerializer.serialize(value), + contributedToDeath: null, + onsetAge: (value) => QuantitySerializer.serialize(value), + onsetRange: (value) => RangeSerializer.serialize(value), + onsetPeriod: (value) => PeriodSerializer.serialize(value), + onsetString: null, + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => FamilyMemberHistoryConditionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in FamilyMemberHistoryConditionSerializer.propertyToSerializerMap) { + if (FamilyMemberHistoryConditionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = FamilyMemberHistoryConditionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = FamilyMemberHistoryConditionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/goalTarget.js b/src/fhir/serializers/4_0_0/backbone_elements/goalTarget.js new file mode 100644 index 000000000..b8ccb2703 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/goalTarget.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class GoalTargetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + measure: (value) => CodeableConceptSerializer.serialize(value), + detailQuantity: (value) => QuantitySerializer.serialize(value), + detailRange: (value) => RangeSerializer.serialize(value), + detailCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + detailString: null, + detailBoolean: null, + detailInteger: null, + detailRatio: (value) => RatioSerializer.serialize(value), + dueDate: null, + dueDuration: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GoalTargetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GoalTargetSerializer.propertyToSerializerMap) { + if (GoalTargetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GoalTargetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GoalTargetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionCompartment.js b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionCompartment.js new file mode 100644 index 000000000..4d29fcc2d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionCompartment.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class GraphDefinitionCompartmentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + use: null, + code: null, + rule: null, + expression: null, + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GraphDefinitionCompartmentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GraphDefinitionCompartmentSerializer.propertyToSerializerMap) { + if (GraphDefinitionCompartmentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GraphDefinitionCompartmentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GraphDefinitionCompartmentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionLink.js b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionLink.js new file mode 100644 index 000000000..ac38a761a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionLink.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const GraphDefinitionTargetSerializer = require('../backbone_elements/graphDefinitionTarget.js'); + +class GraphDefinitionLinkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + path: null, + sliceName: null, + min: null, + max: null, + description: null, + target: (value) => GraphDefinitionTargetSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GraphDefinitionLinkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GraphDefinitionLinkSerializer.propertyToSerializerMap) { + if (GraphDefinitionLinkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GraphDefinitionLinkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GraphDefinitionLinkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionTarget.js b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionTarget.js new file mode 100644 index 000000000..db40f152f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/graphDefinitionTarget.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const GraphDefinitionCompartmentSerializer = require('../backbone_elements/graphDefinitionCompartment.js'); +const GraphDefinitionLinkSerializer = require('../backbone_elements/graphDefinitionLink.js'); + +class GraphDefinitionTargetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + params: null, + profile: null, + compartment: (value) => GraphDefinitionCompartmentSerializer.serialize(value), + link: (value) => GraphDefinitionLinkSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GraphDefinitionTargetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GraphDefinitionTargetSerializer.propertyToSerializerMap) { + if (GraphDefinitionTargetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GraphDefinitionTargetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GraphDefinitionTargetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/groupCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/groupCharacteristic.js new file mode 100644 index 000000000..9542da224 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/groupCharacteristic.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class GroupCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueBoolean: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + exclude: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GroupCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GroupCharacteristicSerializer.propertyToSerializerMap) { + if (GroupCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GroupCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GroupCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/groupMember.js b/src/fhir/serializers/4_0_0/backbone_elements/groupMember.js new file mode 100644 index 000000000..fa6795718 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/groupMember.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class GroupMemberSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + entity: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + inactive: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GroupMemberSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GroupMemberSerializer.propertyToSerializerMap) { + if (GroupMemberSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GroupMemberSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GroupMemberSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceAvailableTime.js b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceAvailableTime.js new file mode 100644 index 000000000..fc88a49ae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceAvailableTime.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class HealthcareServiceAvailableTimeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + daysOfWeek: null, + allDay: null, + availableStartTime: null, + availableEndTime: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => HealthcareServiceAvailableTimeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in HealthcareServiceAvailableTimeSerializer.propertyToSerializerMap) { + if (HealthcareServiceAvailableTimeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = HealthcareServiceAvailableTimeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = HealthcareServiceAvailableTimeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceEligibility.js b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceEligibility.js new file mode 100644 index 000000000..ca8599070 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceEligibility.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class HealthcareServiceEligibilitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + comment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => HealthcareServiceEligibilitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in HealthcareServiceEligibilitySerializer.propertyToSerializerMap) { + if (HealthcareServiceEligibilitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = HealthcareServiceEligibilitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = HealthcareServiceEligibilitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceNotAvailable.js b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceNotAvailable.js new file mode 100644 index 000000000..d13e70a0e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/healthcareServiceNotAvailable.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class HealthcareServiceNotAvailableSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + during: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => HealthcareServiceNotAvailableSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in HealthcareServiceNotAvailableSerializer.propertyToSerializerMap) { + if (HealthcareServiceNotAvailableSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = HealthcareServiceNotAvailableSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = HealthcareServiceNotAvailableSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyInstance.js new file mode 100644 index 000000000..37c76ec49 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyInstance.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class ImagingStudyInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + uid: null, + sopClass: (value) => CodingSerializer.serialize(value), + number: null, + title: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImagingStudyInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImagingStudyInstanceSerializer.propertyToSerializerMap) { + if (ImagingStudyInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImagingStudyInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImagingStudyInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyPerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyPerformer.js new file mode 100644 index 000000000..df8d5f7af --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudyPerformer.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImagingStudyPerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImagingStudyPerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImagingStudyPerformerSerializer.propertyToSerializerMap) { + if (ImagingStudyPerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImagingStudyPerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImagingStudyPerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/imagingStudySeries.js b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudySeries.js new file mode 100644 index 000000000..1ae1518ef --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/imagingStudySeries.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ImagingStudyPerformerSerializer = require('../backbone_elements/imagingStudyPerformer.js'); +const ImagingStudyInstanceSerializer = require('../backbone_elements/imagingStudyInstance.js'); + +class ImagingStudySeriesSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + uid: null, + number: null, + modality: (value) => CodingSerializer.serialize(value), + description: null, + numberOfInstances: null, + endpoint: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodingSerializer.serialize(value), + laterality: (value) => CodingSerializer.serialize(value), + specimen: (value) => ReferenceSerializer.serialize(value), + started: null, + performer: (value) => ImagingStudyPerformerSerializer.serialize(value), + instance: (value) => ImagingStudyInstanceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImagingStudySeriesSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImagingStudySeriesSerializer.propertyToSerializerMap) { + if (ImagingStudySeriesSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImagingStudySeriesSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImagingStudySeriesSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationEducation.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationEducation.js new file mode 100644 index 000000000..c323ab730 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationEducation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImmunizationEducationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + documentType: null, + reference: null, + publicationDate: null, + presentationDate: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationEducationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationEducationSerializer.propertyToSerializerMap) { + if (ImmunizationEducationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationEducationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationEducationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationPerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationPerformer.js new file mode 100644 index 000000000..4b30ee43a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationPerformer.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImmunizationPerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationPerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationPerformerSerializer.propertyToSerializerMap) { + if (ImmunizationPerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationPerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationPerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationProtocolApplied.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationProtocolApplied.js new file mode 100644 index 000000000..d62337ee5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationProtocolApplied.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ImmunizationProtocolAppliedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + series: null, + authority: (value) => ReferenceSerializer.serialize(value), + targetDisease: (value) => CodeableConceptSerializer.serialize(value), + doseNumberPositiveInt: null, + doseNumberString: null, + seriesDosesPositiveInt: null, + seriesDosesString: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationProtocolAppliedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationProtocolAppliedSerializer.propertyToSerializerMap) { + if (ImmunizationProtocolAppliedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationProtocolAppliedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationProtocolAppliedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationReaction.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationReaction.js new file mode 100644 index 000000000..8835edeaf --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationReaction.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImmunizationReactionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + date: null, + detail: (value) => ReferenceSerializer.serialize(value), + reported: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationReactionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationReactionSerializer.propertyToSerializerMap) { + if (ImmunizationReactionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationReactionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationReactionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationDateCriterion.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationDateCriterion.js new file mode 100644 index 000000000..9f08992c9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationDateCriterion.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ImmunizationRecommendationDateCriterionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationRecommendationDateCriterionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationRecommendationDateCriterionSerializer.propertyToSerializerMap) { + if (ImmunizationRecommendationDateCriterionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationRecommendationDateCriterionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationRecommendationDateCriterionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationRecommendation.js b/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationRecommendation.js new file mode 100644 index 000000000..59de928eb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/immunizationRecommendationRecommendation.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ImmunizationRecommendationDateCriterionSerializer = require('../backbone_elements/immunizationRecommendationDateCriterion.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImmunizationRecommendationRecommendationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + vaccineCode: (value) => CodeableConceptSerializer.serialize(value), + targetDisease: (value) => CodeableConceptSerializer.serialize(value), + contraindicatedVaccineCode: (value) => CodeableConceptSerializer.serialize(value), + forecastStatus: (value) => CodeableConceptSerializer.serialize(value), + forecastReason: (value) => CodeableConceptSerializer.serialize(value), + dateCriterion: (value) => ImmunizationRecommendationDateCriterionSerializer.serialize(value), + description: null, + series: null, + doseNumberPositiveInt: null, + doseNumberString: null, + seriesDosesPositiveInt: null, + seriesDosesString: null, + supportingImmunization: (value) => ReferenceSerializer.serialize(value), + supportingPatientInformation: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationRecommendationRecommendationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationRecommendationRecommendationSerializer.propertyToSerializerMap) { + if (ImmunizationRecommendationRecommendationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationRecommendationRecommendationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationRecommendationRecommendationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDefinition.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDefinition.js new file mode 100644 index 000000000..6170585b0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDefinition.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ImplementationGuideGroupingSerializer = require('../backbone_elements/implementationGuideGrouping.js'); +const ImplementationGuideResourceSerializer = require('../backbone_elements/implementationGuideResource.js'); +const ImplementationGuidePageSerializer = require('../backbone_elements/implementationGuidePage.js'); +const ImplementationGuideParameterSerializer = require('../backbone_elements/implementationGuideParameter.js'); +const ImplementationGuideTemplateSerializer = require('../backbone_elements/implementationGuideTemplate.js'); + +class ImplementationGuideDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + grouping: (value) => ImplementationGuideGroupingSerializer.serialize(value), + resource: (value) => ImplementationGuideResourceSerializer.serialize(value), + page: (value) => ImplementationGuidePageSerializer.serialize(value), + parameter: (value) => ImplementationGuideParameterSerializer.serialize(value), + template: (value) => ImplementationGuideTemplateSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideDefinitionSerializer.propertyToSerializerMap) { + if (ImplementationGuideDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDependsOn.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDependsOn.js new file mode 100644 index 000000000..d1ec1c009 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideDependsOn.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuideDependsOnSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + uri: null, + packageId: null, + version: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideDependsOnSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideDependsOnSerializer.propertyToSerializerMap) { + if (ImplementationGuideDependsOnSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideDependsOnSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideDependsOnSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGlobal.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGlobal.js new file mode 100644 index 000000000..a41ae93e5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGlobal.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuideGlobalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + profile: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideGlobalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideGlobalSerializer.propertyToSerializerMap) { + if (ImplementationGuideGlobalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideGlobalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideGlobalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGrouping.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGrouping.js new file mode 100644 index 000000000..4683d1e64 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideGrouping.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuideGroupingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideGroupingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideGroupingSerializer.propertyToSerializerMap) { + if (ImplementationGuideGroupingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideGroupingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideGroupingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideManifest.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideManifest.js new file mode 100644 index 000000000..33b1da750 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideManifest.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ImplementationGuideResource1Serializer = require('../backbone_elements/implementationGuideResource1.js'); +const ImplementationGuidePage1Serializer = require('../backbone_elements/implementationGuidePage1.js'); + +class ImplementationGuideManifestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + rendering: null, + resource: (value) => ImplementationGuideResource1Serializer.serialize(value), + page: (value) => ImplementationGuidePage1Serializer.serialize(value), + image: null, + other: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideManifestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideManifestSerializer.propertyToSerializerMap) { + if (ImplementationGuideManifestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideManifestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideManifestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage.js new file mode 100644 index 000000000..45dcf44bf --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImplementationGuidePageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + nameUrl: null, + nameReference: (value) => ReferenceSerializer.serialize(value), + title: null, + generation: null, + page: (value) => ImplementationGuidePageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuidePageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuidePageSerializer.propertyToSerializerMap) { + if (ImplementationGuidePageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuidePageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuidePageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage1.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage1.js new file mode 100644 index 000000000..f4b1f2883 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuidePage1.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuidePage1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + title: null, + anchor: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuidePage1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuidePage1Serializer.propertyToSerializerMap) { + if (ImplementationGuidePage1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuidePage1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuidePage1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideParameter.js new file mode 100644 index 000000000..5dd99db55 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideParameter.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuideParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideParameterSerializer.propertyToSerializerMap) { + if (ImplementationGuideParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource.js new file mode 100644 index 000000000..8b75ed8e7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImplementationGuideResourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + fhirVersion: null, + name: null, + description: null, + exampleBoolean: null, + exampleCanonical: null, + groupingId: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideResourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideResourceSerializer.propertyToSerializerMap) { + if (ImplementationGuideResourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideResourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideResourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource1.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource1.js new file mode 100644 index 000000000..3a3c440f6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideResource1.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ImplementationGuideResource1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value), + exampleBoolean: null, + exampleCanonical: null, + relativePath: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideResource1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideResource1Serializer.propertyToSerializerMap) { + if (ImplementationGuideResource1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideResource1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideResource1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideTemplate.js b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideTemplate.js new file mode 100644 index 000000000..42c2932ae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/implementationGuideTemplate.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ImplementationGuideTemplateSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + source: null, + scope: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideTemplateSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideTemplateSerializer.propertyToSerializerMap) { + if (ImplementationGuideTemplateSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideTemplateSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideTemplateSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/ingredientManufacturer.js b/src/fhir/serializers/4_0_0/backbone_elements/ingredientManufacturer.js new file mode 100644 index 000000000..ee42a754d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/ingredientManufacturer.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class IngredientManufacturerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: null, + manufacturer: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IngredientManufacturerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IngredientManufacturerSerializer.propertyToSerializerMap) { + if (IngredientManufacturerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IngredientManufacturerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IngredientManufacturerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/ingredientReferenceStrength.js b/src/fhir/serializers/4_0_0/backbone_elements/ingredientReferenceStrength.js new file mode 100644 index 000000000..6dd64c23b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/ingredientReferenceStrength.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RatioRangeSerializer = require('../complex_types/ratioRange.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class IngredientReferenceStrengthSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + substance: (value) => CodeableReferenceSerializer.serialize(value), + strengthRatio: (value) => RatioSerializer.serialize(value), + strengthRatioRange: (value) => RatioRangeSerializer.serialize(value), + measurementPoint: null, + country: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IngredientReferenceStrengthSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IngredientReferenceStrengthSerializer.propertyToSerializerMap) { + if (IngredientReferenceStrengthSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IngredientReferenceStrengthSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IngredientReferenceStrengthSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/ingredientStrength.js b/src/fhir/serializers/4_0_0/backbone_elements/ingredientStrength.js new file mode 100644 index 000000000..c1e87cdf5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/ingredientStrength.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RatioRangeSerializer = require('../complex_types/ratioRange.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IngredientReferenceStrengthSerializer = require('../backbone_elements/ingredientReferenceStrength.js'); + +class IngredientStrengthSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + presentationRatio: (value) => RatioSerializer.serialize(value), + presentationRatioRange: (value) => RatioRangeSerializer.serialize(value), + textPresentation: null, + concentrationRatio: (value) => RatioSerializer.serialize(value), + concentrationRatioRange: (value) => RatioRangeSerializer.serialize(value), + textConcentration: null, + measurementPoint: null, + country: (value) => CodeableConceptSerializer.serialize(value), + referenceStrength: (value) => IngredientReferenceStrengthSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IngredientStrengthSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IngredientStrengthSerializer.propertyToSerializerMap) { + if (IngredientStrengthSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IngredientStrengthSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IngredientStrengthSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/ingredientSubstance.js b/src/fhir/serializers/4_0_0/backbone_elements/ingredientSubstance.js new file mode 100644 index 000000000..a8c5088d0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/ingredientSubstance.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const IngredientStrengthSerializer = require('../backbone_elements/ingredientStrength.js'); + +class IngredientSubstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableReferenceSerializer.serialize(value), + strength: (value) => IngredientStrengthSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IngredientSubstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IngredientSubstanceSerializer.propertyToSerializerMap) { + if (IngredientSubstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IngredientSubstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IngredientSubstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit.js new file mode 100644 index 000000000..b362bcac0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const InsurancePlanLimitSerializer = require('../backbone_elements/insurancePlanLimit.js'); + +class InsurancePlanBenefitSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + requirement: null, + limit: (value) => InsurancePlanLimitSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanBenefitSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanBenefitSerializer.propertyToSerializerMap) { + if (InsurancePlanBenefitSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanBenefitSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanBenefitSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit1.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit1.js new file mode 100644 index 000000000..5bf188655 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanBenefit1.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const InsurancePlanCostSerializer = require('../backbone_elements/insurancePlanCost.js'); + +class InsurancePlanBenefit1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + cost: (value) => InsurancePlanCostSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanBenefit1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanBenefit1Serializer.propertyToSerializerMap) { + if (InsurancePlanBenefit1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanBenefit1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanBenefit1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanContact.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanContact.js new file mode 100644 index 000000000..07d697937 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanContact.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); + +class InsurancePlanContactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + purpose: (value) => CodeableConceptSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanContactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanContactSerializer.propertyToSerializerMap) { + if (InsurancePlanContactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanContactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanContactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCost.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCost.js new file mode 100644 index 000000000..ae463d568 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCost.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class InsurancePlanCostSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + applicability: (value) => CodeableConceptSerializer.serialize(value), + qualifiers: (value) => CodeableConceptSerializer.serialize(value), + value: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanCostSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanCostSerializer.propertyToSerializerMap) { + if (InsurancePlanCostSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanCostSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanCostSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCoverage.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCoverage.js new file mode 100644 index 000000000..916c17126 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanCoverage.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const InsurancePlanBenefitSerializer = require('../backbone_elements/insurancePlanBenefit.js'); + +class InsurancePlanCoverageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + network: (value) => ReferenceSerializer.serialize(value), + benefit: (value) => InsurancePlanBenefitSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanCoverageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanCoverageSerializer.propertyToSerializerMap) { + if (InsurancePlanCoverageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanCoverageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanCoverageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanGeneralCost.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanGeneralCost.js new file mode 100644 index 000000000..2a01aafbe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanGeneralCost.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class InsurancePlanGeneralCostSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + groupSize: null, + cost: (value) => MoneySerializer.serialize(value), + comment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanGeneralCostSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanGeneralCostSerializer.propertyToSerializerMap) { + if (InsurancePlanGeneralCostSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanGeneralCostSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanGeneralCostSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanLimit.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanLimit.js new file mode 100644 index 000000000..0b952c2be --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanLimit.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class InsurancePlanLimitSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + value: (value) => QuantitySerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanLimitSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanLimitSerializer.propertyToSerializerMap) { + if (InsurancePlanLimitSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanLimitSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanLimitSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanPlan.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanPlan.js new file mode 100644 index 000000000..a21910877 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanPlan.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const InsurancePlanGeneralCostSerializer = require('../backbone_elements/insurancePlanGeneralCost.js'); +const InsurancePlanSpecificCostSerializer = require('../backbone_elements/insurancePlanSpecificCost.js'); + +class InsurancePlanPlanSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + coverageArea: (value) => ReferenceSerializer.serialize(value), + network: (value) => ReferenceSerializer.serialize(value), + generalCost: (value) => InsurancePlanGeneralCostSerializer.serialize(value), + specificCost: (value) => InsurancePlanSpecificCostSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanPlanSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanPlanSerializer.propertyToSerializerMap) { + if (InsurancePlanPlanSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanPlanSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanPlanSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanSpecificCost.js b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanSpecificCost.js new file mode 100644 index 000000000..394274935 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/insurancePlanSpecificCost.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const InsurancePlanBenefit1Serializer = require('../backbone_elements/insurancePlanBenefit1.js'); + +class InsurancePlanSpecificCostSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + benefit: (value) => InsurancePlanBenefit1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanSpecificCostSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanSpecificCostSerializer.propertyToSerializerMap) { + if (InsurancePlanSpecificCostSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanSpecificCostSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanSpecificCostSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/invoiceLineItem.js b/src/fhir/serializers/4_0_0/backbone_elements/invoiceLineItem.js new file mode 100644 index 000000000..75c1f5b2d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/invoiceLineItem.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const InvoicePriceComponentSerializer = require('../backbone_elements/invoicePriceComponent.js'); + +class InvoiceLineItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + sequence: null, + chargeItemReference: (value) => ReferenceSerializer.serialize(value), + chargeItemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + priceComponent: (value) => InvoicePriceComponentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InvoiceLineItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InvoiceLineItemSerializer.propertyToSerializerMap) { + if (InvoiceLineItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InvoiceLineItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InvoiceLineItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/invoiceParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/invoiceParticipant.js new file mode 100644 index 000000000..8b97d71b9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/invoiceParticipant.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class InvoiceParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InvoiceParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InvoiceParticipantSerializer.propertyToSerializerMap) { + if (InvoiceParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InvoiceParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InvoiceParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/invoicePriceComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/invoicePriceComponent.js new file mode 100644 index 000000000..a60921b7f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/invoicePriceComponent.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class InvoicePriceComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + code: (value) => CodeableConceptSerializer.serialize(value), + factor: null, + amount: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InvoicePriceComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InvoicePriceComponentSerializer.propertyToSerializerMap) { + if (InvoicePriceComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InvoicePriceComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InvoicePriceComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/linkageItem.js b/src/fhir/serializers/4_0_0/backbone_elements/linkageItem.js new file mode 100644 index 000000000..c4afe9402 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/linkageItem.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class LinkageItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + resource: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LinkageItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LinkageItemSerializer.propertyToSerializerMap) { + if (LinkageItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LinkageItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LinkageItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/listEntry.js b/src/fhir/serializers/4_0_0/backbone_elements/listEntry.js new file mode 100644 index 000000000..5bfa1766e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/listEntry.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ListEntrySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + flag: (value) => CodeableConceptSerializer.serialize(value), + deleted: null, + date: null, + item: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ListEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ListEntrySerializer.propertyToSerializerMap) { + if (ListEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ListEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ListEntrySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/locationHoursOfOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/locationHoursOfOperation.js new file mode 100644 index 000000000..4cf91709a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/locationHoursOfOperation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class LocationHoursOfOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + daysOfWeek: null, + allDay: null, + openingTime: null, + closingTime: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LocationHoursOfOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LocationHoursOfOperationSerializer.propertyToSerializerMap) { + if (LocationHoursOfOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LocationHoursOfOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LocationHoursOfOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/locationPosition.js b/src/fhir/serializers/4_0_0/backbone_elements/locationPosition.js new file mode 100644 index 000000000..a9f933091 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/locationPosition.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class LocationPositionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + longitude: null, + latitude: null, + altitude: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LocationPositionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LocationPositionSerializer.propertyToSerializerMap) { + if (LocationPositionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LocationPositionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LocationPositionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/manufacturedItemDefinitionProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/manufacturedItemDefinitionProperty.js new file mode 100644 index 000000000..1afc6fb54 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/manufacturedItemDefinitionProperty.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class ManufacturedItemDefinitionPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueDate: null, + valueBoolean: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ManufacturedItemDefinitionPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ManufacturedItemDefinitionPropertySerializer.propertyToSerializerMap) { + if (ManufacturedItemDefinitionPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ManufacturedItemDefinitionPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ManufacturedItemDefinitionPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/marketingStatus.js b/src/fhir/serializers/4_0_0/backbone_elements/marketingStatus.js new file mode 100644 index 000000000..a838faa3e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/marketingStatus.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class MarketingStatusSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + country: (value) => CodeableConceptSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + dateRange: (value) => PeriodSerializer.serialize(value), + restoreDate: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MarketingStatusSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MarketingStatusSerializer.propertyToSerializerMap) { + if (MarketingStatusSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MarketingStatusSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MarketingStatusSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/measureComponent.js new file mode 100644 index 000000000..2d3d97055 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureComponent.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class MeasureComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + criteria: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureComponentSerializer.propertyToSerializerMap) { + if (MeasureComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureGroup.js b/src/fhir/serializers/4_0_0/backbone_elements/measureGroup.js new file mode 100644 index 000000000..b2d4a8785 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureGroup.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MeasurePopulationSerializer = require('../backbone_elements/measurePopulation.js'); +const MeasureStratifierSerializer = require('../backbone_elements/measureStratifier.js'); + +class MeasureGroupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + population: (value) => MeasurePopulationSerializer.serialize(value), + stratifier: (value) => MeasureStratifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureGroupSerializer.propertyToSerializerMap) { + if (MeasureGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measurePopulation.js b/src/fhir/serializers/4_0_0/backbone_elements/measurePopulation.js new file mode 100644 index 000000000..17e6d2dab --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measurePopulation.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class MeasurePopulationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + criteria: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasurePopulationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasurePopulationSerializer.propertyToSerializerMap) { + if (MeasurePopulationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasurePopulationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasurePopulationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportComponent.js new file mode 100644 index 000000000..5f28a3fce --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportComponent.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MeasureReportComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + value: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportComponentSerializer.propertyToSerializerMap) { + if (MeasureReportComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportGroup.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportGroup.js new file mode 100644 index 000000000..83f96d4f8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportGroup.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MeasureReportPopulationSerializer = require('../backbone_elements/measureReportPopulation.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MeasureReportStratifierSerializer = require('../backbone_elements/measureReportStratifier.js'); + +class MeasureReportGroupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + population: (value) => MeasureReportPopulationSerializer.serialize(value), + measureScore: (value) => QuantitySerializer.serialize(value), + stratifier: (value) => MeasureReportStratifierSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportGroupSerializer.propertyToSerializerMap) { + if (MeasureReportGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation.js new file mode 100644 index 000000000..2c520fc72 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MeasureReportPopulationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + count: null, + subjectResults: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportPopulationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportPopulationSerializer.propertyToSerializerMap) { + if (MeasureReportPopulationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportPopulationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportPopulationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation1.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation1.js new file mode 100644 index 000000000..30e0e41e2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportPopulation1.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MeasureReportPopulation1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + count: null, + subjectResults: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportPopulation1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportPopulation1Serializer.propertyToSerializerMap) { + if (MeasureReportPopulation1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportPopulation1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportPopulation1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratifier.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratifier.js new file mode 100644 index 000000000..2b049ad0e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratifier.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MeasureReportStratumSerializer = require('../backbone_elements/measureReportStratum.js'); + +class MeasureReportStratifierSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + stratum: (value) => MeasureReportStratumSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportStratifierSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportStratifierSerializer.propertyToSerializerMap) { + if (MeasureReportStratifierSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportStratifierSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportStratifierSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratum.js b/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratum.js new file mode 100644 index 000000000..10554facd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureReportStratum.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MeasureReportComponentSerializer = require('../backbone_elements/measureReportComponent.js'); +const MeasureReportPopulation1Serializer = require('../backbone_elements/measureReportPopulation1.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MeasureReportStratumSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + value: (value) => CodeableConceptSerializer.serialize(value), + component: (value) => MeasureReportComponentSerializer.serialize(value), + population: (value) => MeasureReportPopulation1Serializer.serialize(value), + measureScore: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportStratumSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportStratumSerializer.propertyToSerializerMap) { + if (MeasureReportStratumSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportStratumSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportStratumSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureStratifier.js b/src/fhir/serializers/4_0_0/backbone_elements/measureStratifier.js new file mode 100644 index 000000000..e717fa902 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureStratifier.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const MeasureComponentSerializer = require('../backbone_elements/measureComponent.js'); + +class MeasureStratifierSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + criteria: (value) => ExpressionSerializer.serialize(value), + component: (value) => MeasureComponentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureStratifierSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureStratifierSerializer.propertyToSerializerMap) { + if (MeasureStratifierSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureStratifierSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureStratifierSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/measureSupplementalData.js b/src/fhir/serializers/4_0_0/backbone_elements/measureSupplementalData.js new file mode 100644 index 000000000..d7aded137 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/measureSupplementalData.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class MeasureSupplementalDataSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + usage: (value) => CodeableConceptSerializer.serialize(value), + description: null, + criteria: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureSupplementalDataSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureSupplementalDataSerializer.propertyToSerializerMap) { + if (MeasureSupplementalDataSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureSupplementalDataSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureSupplementalDataSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationDosage.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationDosage.js new file mode 100644 index 000000000..7b8345b40 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationDosage.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class MedicationAdministrationDosageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + text: null, + site: (value) => CodeableConceptSerializer.serialize(value), + route: (value) => CodeableConceptSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + dose: (value) => QuantitySerializer.serialize(value), + rateRatio: (value) => RatioSerializer.serialize(value), + rateQuantity: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationAdministrationDosageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationAdministrationDosageSerializer.propertyToSerializerMap) { + if (MedicationAdministrationDosageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationAdministrationDosageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationAdministrationDosageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationPerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationPerformer.js new file mode 100644 index 000000000..f8a0b65fd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationAdministrationPerformer.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationAdministrationPerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationAdministrationPerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationAdministrationPerformerSerializer.propertyToSerializerMap) { + if (MedicationAdministrationPerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationAdministrationPerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationAdministrationPerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationBatch.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationBatch.js new file mode 100644 index 000000000..38a600a1a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationBatch.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MedicationBatchSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + lotNumber: null, + expirationDate: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationBatchSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationBatchSerializer.propertyToSerializerMap) { + if (MedicationBatchSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationBatchSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationBatchSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationDispensePerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationDispensePerformer.js new file mode 100644 index 000000000..1d2e154a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationDispensePerformer.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationDispensePerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationDispensePerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationDispensePerformerSerializer.propertyToSerializerMap) { + if (MedicationDispensePerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationDispensePerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationDispensePerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationDispenseSubstitution.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationDispenseSubstitution.js new file mode 100644 index 000000000..1d75873c7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationDispenseSubstitution.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationDispenseSubstitutionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + wasSubstituted: null, + type: (value) => CodeableConceptSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + responsibleParty: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationDispenseSubstitutionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationDispenseSubstitutionSerializer.propertyToSerializerMap) { + if (MedicationDispenseSubstitutionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationDispenseSubstitutionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationDispenseSubstitutionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationIngredient.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationIngredient.js new file mode 100644 index 000000000..de6103a3d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationIngredient.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class MedicationIngredientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value), + isActive: null, + strength: (value) => RatioSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationIngredientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationIngredientSerializer.propertyToSerializerMap) { + if (MedicationIngredientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationIngredientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationIngredientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeAdministrationGuidelines.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeAdministrationGuidelines.js new file mode 100644 index 000000000..369ef512e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeAdministrationGuidelines.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const MedicationKnowledgeDosageSerializer = require('../backbone_elements/medicationKnowledgeDosage.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MedicationKnowledgePatientCharacteristicsSerializer = require('../backbone_elements/medicationKnowledgePatientCharacteristics.js'); + +class MedicationKnowledgeAdministrationGuidelinesSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + dosage: (value) => MedicationKnowledgeDosageSerializer.serialize(value), + indicationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + indicationReference: (value) => ReferenceSerializer.serialize(value), + patientCharacteristics: (value) => MedicationKnowledgePatientCharacteristicsSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeAdministrationGuidelinesSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeAdministrationGuidelinesSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeAdministrationGuidelinesSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeAdministrationGuidelinesSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeAdministrationGuidelinesSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeCost.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeCost.js new file mode 100644 index 000000000..ddba2f952 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeCost.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class MedicationKnowledgeCostSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + source: null, + cost: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeCostSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeCostSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeCostSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeCostSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeCostSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDosage.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDosage.js new file mode 100644 index 000000000..d6c68359b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDosage.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); + +class MedicationKnowledgeDosageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + dosage: (value) => DosageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeDosageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeDosageSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeDosageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeDosageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeDosageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDrugCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDrugCharacteristic.js new file mode 100644 index 000000000..23c599a7e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeDrugCharacteristic.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationKnowledgeDrugCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueString: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueBase64Binary: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeDrugCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeDrugCharacteristicSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeDrugCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeDrugCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeDrugCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeIngredient.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeIngredient.js new file mode 100644 index 000000000..41e39ad86 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeIngredient.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class MedicationKnowledgeIngredientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value), + isActive: null, + strength: (value) => RatioSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeIngredientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeIngredientSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeIngredientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeIngredientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeIngredientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeKinetics.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeKinetics.js new file mode 100644 index 000000000..637a8aa42 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeKinetics.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationKnowledgeKineticsSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + areaUnderCurve: (value) => QuantitySerializer.serialize(value), + lethalDose50: (value) => QuantitySerializer.serialize(value), + halfLifePeriod: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeKineticsSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeKineticsSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeKineticsSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeKineticsSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeKineticsSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMaxDispense.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMaxDispense.js new file mode 100644 index 000000000..d829888a5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMaxDispense.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationKnowledgeMaxDispenseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + period: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeMaxDispenseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeMaxDispenseSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeMaxDispenseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeMaxDispenseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeMaxDispenseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMedicineClassification.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMedicineClassification.js new file mode 100644 index 000000000..c9e186c60 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMedicineClassification.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicationKnowledgeMedicineClassificationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + classification: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeMedicineClassificationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeMedicineClassificationSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeMedicineClassificationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeMedicineClassificationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeMedicineClassificationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonitoringProgram.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonitoringProgram.js new file mode 100644 index 000000000..758a91835 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonitoringProgram.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicationKnowledgeMonitoringProgramSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + name: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeMonitoringProgramSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeMonitoringProgramSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeMonitoringProgramSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeMonitoringProgramSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeMonitoringProgramSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonograph.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonograph.js new file mode 100644 index 000000000..b2ab58ba0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeMonograph.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationKnowledgeMonographSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeMonographSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeMonographSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeMonographSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeMonographSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeMonographSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePackaging.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePackaging.js new file mode 100644 index 000000000..2bfc29f64 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePackaging.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationKnowledgePackagingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgePackagingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgePackagingSerializer.propertyToSerializerMap) { + if (MedicationKnowledgePackagingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgePackagingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgePackagingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePatientCharacteristics.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePatientCharacteristics.js new file mode 100644 index 000000000..222e7f6db --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgePatientCharacteristics.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationKnowledgePatientCharacteristicsSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + characteristicCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + characteristicQuantity: (value) => QuantitySerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgePatientCharacteristicsSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgePatientCharacteristicsSerializer.propertyToSerializerMap) { + if (MedicationKnowledgePatientCharacteristicsSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgePatientCharacteristicsSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgePatientCharacteristicsSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRegulatory.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRegulatory.js new file mode 100644 index 000000000..a69e1279b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRegulatory.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MedicationKnowledgeSubstitutionSerializer = require('../backbone_elements/medicationKnowledgeSubstitution.js'); +const MedicationKnowledgeScheduleSerializer = require('../backbone_elements/medicationKnowledgeSchedule.js'); +const MedicationKnowledgeMaxDispenseSerializer = require('../backbone_elements/medicationKnowledgeMaxDispense.js'); + +class MedicationKnowledgeRegulatorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + regulatoryAuthority: (value) => ReferenceSerializer.serialize(value), + substitution: (value) => MedicationKnowledgeSubstitutionSerializer.serialize(value), + schedule: (value) => MedicationKnowledgeScheduleSerializer.serialize(value), + maxDispense: (value) => MedicationKnowledgeMaxDispenseSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeRegulatorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeRegulatorySerializer.propertyToSerializerMap) { + if (MedicationKnowledgeRegulatorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeRegulatorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeRegulatorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRelatedMedicationKnowledge.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRelatedMedicationKnowledge.js new file mode 100644 index 000000000..241352ca7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeRelatedMedicationKnowledge.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationKnowledgeRelatedMedicationKnowledgeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeRelatedMedicationKnowledgeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeRelatedMedicationKnowledgeSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeRelatedMedicationKnowledgeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeRelatedMedicationKnowledgeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeRelatedMedicationKnowledgeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSchedule.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSchedule.js new file mode 100644 index 000000000..3451bc0c0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSchedule.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicationKnowledgeScheduleSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + schedule: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeScheduleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeScheduleSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeScheduleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeScheduleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeScheduleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSubstitution.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSubstitution.js new file mode 100644 index 000000000..0de910482 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationKnowledgeSubstitution.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicationKnowledgeSubstitutionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + allowed: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeSubstitutionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeSubstitutionSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeSubstitutionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeSubstitutionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeSubstitutionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestDispenseRequest.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestDispenseRequest.js new file mode 100644 index 000000000..e45f05a46 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestDispenseRequest.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const MedicationRequestInitialFillSerializer = require('../backbone_elements/medicationRequestInitialFill.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicationRequestDispenseRequestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + initialFill: (value) => MedicationRequestInitialFillSerializer.serialize(value), + dispenseInterval: (value) => QuantitySerializer.serialize(value), + validityPeriod: (value) => PeriodSerializer.serialize(value), + numberOfRepeatsAllowed: null, + quantity: (value) => QuantitySerializer.serialize(value), + expectedSupplyDuration: (value) => QuantitySerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationRequestDispenseRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationRequestDispenseRequestSerializer.propertyToSerializerMap) { + if (MedicationRequestDispenseRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationRequestDispenseRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationRequestDispenseRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestInitialFill.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestInitialFill.js new file mode 100644 index 000000000..dd1305e52 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestInitialFill.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class MedicationRequestInitialFillSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + duration: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationRequestInitialFillSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationRequestInitialFillSerializer.propertyToSerializerMap) { + if (MedicationRequestInitialFillSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationRequestInitialFillSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationRequestInitialFillSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestSubstitution.js b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestSubstitution.js new file mode 100644 index 000000000..7e8d764c2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicationRequestSubstitution.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicationRequestSubstitutionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + allowedBoolean: null, + allowedCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationRequestSubstitutionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationRequestSubstitutionSerializer.propertyToSerializerMap) { + if (MedicationRequestSubstitutionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationRequestSubstitutionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationRequestSubstitutionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCharacteristic.js new file mode 100644 index 000000000..6f920bd9d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCharacteristic.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class MedicinalProductDefinitionCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueDate: null, + valueBoolean: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionCharacteristicSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionContact.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionContact.js new file mode 100644 index 000000000..58ed2bdd2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionContact.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MedicinalProductDefinitionContactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + contact: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionContactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionContactSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionContactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionContactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionContactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCountryLanguage.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCountryLanguage.js new file mode 100644 index 000000000..79b3acef2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCountryLanguage.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicinalProductDefinitionCountryLanguageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + country: (value) => CodeableConceptSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + language: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionCountryLanguageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionCountryLanguageSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionCountryLanguageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionCountryLanguageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionCountryLanguageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCrossReference.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCrossReference.js new file mode 100644 index 000000000..80d0c70b2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionCrossReference.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicinalProductDefinitionCrossReferenceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + product: (value) => CodeableReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionCrossReferenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionCrossReferenceSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionCrossReferenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionCrossReferenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionCrossReferenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionName.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionName.js new file mode 100644 index 000000000..1a98f6c0c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionName.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MedicinalProductDefinitionNamePartSerializer = require('../backbone_elements/medicinalProductDefinitionNamePart.js'); +const MedicinalProductDefinitionCountryLanguageSerializer = require('../backbone_elements/medicinalProductDefinitionCountryLanguage.js'); + +class MedicinalProductDefinitionNameSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + productName: null, + type: (value) => CodeableConceptSerializer.serialize(value), + namePart: (value) => MedicinalProductDefinitionNamePartSerializer.serialize(value), + countryLanguage: (value) => MedicinalProductDefinitionCountryLanguageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionNameSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionNameSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionNameSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionNameSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionNameSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionNamePart.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionNamePart.js new file mode 100644 index 000000000..dc135236d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionNamePart.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicinalProductDefinitionNamePartSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + part: null, + type: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionNamePartSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionNamePartSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionNamePartSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionNamePartSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionNamePartSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionOperation.js new file mode 100644 index 000000000..4a3abc791 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/medicinalProductDefinitionOperation.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class MedicinalProductDefinitionOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableReferenceSerializer.serialize(value), + effectiveDate: (value) => PeriodSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + confidentialityIndicator: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionOperationSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionAllowedResponse.js b/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionAllowedResponse.js new file mode 100644 index 000000000..066778669 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionAllowedResponse.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MessageDefinitionAllowedResponseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + message: null, + situation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageDefinitionAllowedResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageDefinitionAllowedResponseSerializer.propertyToSerializerMap) { + if (MessageDefinitionAllowedResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageDefinitionAllowedResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageDefinitionAllowedResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionFocus.js b/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionFocus.js new file mode 100644 index 000000000..4b7d01ad3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/messageDefinitionFocus.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MessageDefinitionFocusSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + profile: null, + min: null, + max: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageDefinitionFocusSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageDefinitionFocusSerializer.propertyToSerializerMap) { + if (MessageDefinitionFocusSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageDefinitionFocusSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageDefinitionFocusSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderDestination.js b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderDestination.js new file mode 100644 index 000000000..4d4f35829 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderDestination.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MessageHeaderDestinationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + target: (value) => ReferenceSerializer.serialize(value), + endpoint: null, + receiver: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageHeaderDestinationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageHeaderDestinationSerializer.propertyToSerializerMap) { + if (MessageHeaderDestinationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageHeaderDestinationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageHeaderDestinationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderResponse.js b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderResponse.js new file mode 100644 index 000000000..1d07c772b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderResponse.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MessageHeaderResponseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: null, + code: null, + details: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageHeaderResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageHeaderResponseSerializer.propertyToSerializerMap) { + if (MessageHeaderResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageHeaderResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageHeaderResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderSource.js b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderSource.js new file mode 100644 index 000000000..4c576edf2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/messageHeaderSource.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); + +class MessageHeaderSourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + software: null, + version: null, + contact: (value) => ContactPointSerializer.serialize(value), + endpoint: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageHeaderSourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageHeaderSourceSerializer.propertyToSerializerMap) { + if (MessageHeaderSourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageHeaderSourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageHeaderSourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceInner.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceInner.js new file mode 100644 index 000000000..c13a27620 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceInner.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MolecularSequenceInnerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + start: null, + end: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceInnerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceInnerSerializer.propertyToSerializerMap) { + if (MolecularSequenceInnerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceInnerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceInnerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceOuter.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceOuter.js new file mode 100644 index 000000000..a07177c7e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceOuter.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MolecularSequenceOuterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + start: null, + end: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceOuterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceOuterSerializer.propertyToSerializerMap) { + if (MolecularSequenceOuterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceOuterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceOuterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceQuality.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceQuality.js new file mode 100644 index 000000000..bbe1a6963 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceQuality.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MolecularSequenceRocSerializer = require('../backbone_elements/molecularSequenceRoc.js'); + +class MolecularSequenceQualitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + standardSequence: (value) => CodeableConceptSerializer.serialize(value), + start: null, + end: null, + score: (value) => QuantitySerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + truthTP: null, + queryTP: null, + truthFN: null, + queryFP: null, + gtFP: null, + precision: null, + recall: null, + fScore: null, + roc: (value) => MolecularSequenceRocSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceQualitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceQualitySerializer.propertyToSerializerMap) { + if (MolecularSequenceQualitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceQualitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceQualitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceReferenceSeq.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceReferenceSeq.js new file mode 100644 index 000000000..cce3c52bd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceReferenceSeq.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MolecularSequenceReferenceSeqSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + chromosome: (value) => CodeableConceptSerializer.serialize(value), + genomeBuild: null, + orientation: null, + referenceSeqId: (value) => CodeableConceptSerializer.serialize(value), + referenceSeqPointer: (value) => ReferenceSerializer.serialize(value), + referenceSeqString: null, + strand: null, + windowStart: null, + windowEnd: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceReferenceSeqSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceReferenceSeqSerializer.propertyToSerializerMap) { + if (MolecularSequenceReferenceSeqSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceReferenceSeqSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceReferenceSeqSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRepository.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRepository.js new file mode 100644 index 000000000..b0b6e7c80 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRepository.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MolecularSequenceRepositorySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + url: null, + name: null, + datasetId: null, + variantsetId: null, + readsetId: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceRepositorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceRepositorySerializer.propertyToSerializerMap) { + if (MolecularSequenceRepositorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceRepositorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceRepositorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRoc.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRoc.js new file mode 100644 index 000000000..c7a11b5a4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceRoc.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MolecularSequenceRocSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + score: null, + numTP: null, + numFP: null, + numFN: null, + precision: null, + sensitivity: null, + fMeasure: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceRocSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceRocSerializer.propertyToSerializerMap) { + if (MolecularSequenceRocSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceRocSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceRocSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceStructureVariant.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceStructureVariant.js new file mode 100644 index 000000000..3466be6f3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceStructureVariant.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MolecularSequenceOuterSerializer = require('../backbone_elements/molecularSequenceOuter.js'); +const MolecularSequenceInnerSerializer = require('../backbone_elements/molecularSequenceInner.js'); + +class MolecularSequenceStructureVariantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + variantType: (value) => CodeableConceptSerializer.serialize(value), + exact: null, + length: null, + outer: (value) => MolecularSequenceOuterSerializer.serialize(value), + inner: (value) => MolecularSequenceInnerSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceStructureVariantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceStructureVariantSerializer.propertyToSerializerMap) { + if (MolecularSequenceStructureVariantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceStructureVariantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceStructureVariantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceVariant.js b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceVariant.js new file mode 100644 index 000000000..b317941da --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/molecularSequenceVariant.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class MolecularSequenceVariantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + start: null, + end: null, + observedAllele: null, + referenceAllele: null, + cigar: null, + variantPointer: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceVariantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceVariantSerializer.propertyToSerializerMap) { + if (MolecularSequenceVariantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceVariantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceVariantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/namingSystemUniqueId.js b/src/fhir/serializers/4_0_0/backbone_elements/namingSystemUniqueId.js new file mode 100644 index 000000000..21f2d1b9e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/namingSystemUniqueId.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class NamingSystemUniqueIdSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + value: null, + preferred: null, + comment: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NamingSystemUniqueIdSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NamingSystemUniqueIdSerializer.propertyToSerializerMap) { + if (NamingSystemUniqueIdSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NamingSystemUniqueIdSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NamingSystemUniqueIdSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderAdministration.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderAdministration.js new file mode 100644 index 000000000..f62e45327 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderAdministration.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class NutritionOrderAdministrationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + schedule: (value) => TimingSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + rateQuantity: (value) => QuantitySerializer.serialize(value), + rateRatio: (value) => RatioSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderAdministrationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderAdministrationSerializer.propertyToSerializerMap) { + if (NutritionOrderAdministrationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderAdministrationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderAdministrationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderEnteralFormula.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderEnteralFormula.js new file mode 100644 index 000000000..ef777edcd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderEnteralFormula.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const NutritionOrderAdministrationSerializer = require('../backbone_elements/nutritionOrderAdministration.js'); + +class NutritionOrderEnteralFormulaSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + baseFormulaType: (value) => CodeableConceptSerializer.serialize(value), + baseFormulaProductName: null, + additiveType: (value) => CodeableConceptSerializer.serialize(value), + additiveProductName: null, + caloricDensity: (value) => QuantitySerializer.serialize(value), + routeofAdministration: (value) => CodeableConceptSerializer.serialize(value), + administration: (value) => NutritionOrderAdministrationSerializer.serialize(value), + maxVolumeToDeliver: (value) => QuantitySerializer.serialize(value), + administrationInstruction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderEnteralFormulaSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderEnteralFormulaSerializer.propertyToSerializerMap) { + if (NutritionOrderEnteralFormulaSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderEnteralFormulaSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderEnteralFormulaSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderNutrient.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderNutrient.js new file mode 100644 index 000000000..2d2306a76 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderNutrient.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class NutritionOrderNutrientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderNutrientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderNutrientSerializer.propertyToSerializerMap) { + if (NutritionOrderNutrientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderNutrientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderNutrientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderOralDiet.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderOralDiet.js new file mode 100644 index 000000000..dbf87dbb9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderOralDiet.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const NutritionOrderNutrientSerializer = require('../backbone_elements/nutritionOrderNutrient.js'); +const NutritionOrderTextureSerializer = require('../backbone_elements/nutritionOrderTexture.js'); + +class NutritionOrderOralDietSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + schedule: (value) => TimingSerializer.serialize(value), + nutrient: (value) => NutritionOrderNutrientSerializer.serialize(value), + texture: (value) => NutritionOrderTextureSerializer.serialize(value), + fluidConsistencyType: (value) => CodeableConceptSerializer.serialize(value), + instruction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderOralDietSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderOralDietSerializer.propertyToSerializerMap) { + if (NutritionOrderOralDietSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderOralDietSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderOralDietSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderSupplement.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderSupplement.js new file mode 100644 index 000000000..80f9fc219 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderSupplement.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class NutritionOrderSupplementSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + productName: null, + schedule: (value) => TimingSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + instruction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderSupplementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderSupplementSerializer.propertyToSerializerMap) { + if (NutritionOrderSupplementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderSupplementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderSupplementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderTexture.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderTexture.js new file mode 100644 index 000000000..2c78dc8f2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionOrderTexture.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class NutritionOrderTextureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + modifier: (value) => CodeableConceptSerializer.serialize(value), + foodType: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderTextureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderTextureSerializer.propertyToSerializerMap) { + if (NutritionOrderTextureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderTextureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderTextureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductIngredient.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductIngredient.js new file mode 100644 index 000000000..7f360abc6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductIngredient.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class NutritionProductIngredientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + item: (value) => CodeableReferenceSerializer.serialize(value), + amount: (value) => RatioSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionProductIngredientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionProductIngredientSerializer.propertyToSerializerMap) { + if (NutritionProductIngredientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionProductIngredientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionProductIngredientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductInstance.js new file mode 100644 index 000000000..d0cb344f8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductInstance.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class NutritionProductInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + lotNumber: null, + expiry: null, + useBy: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionProductInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionProductInstanceSerializer.propertyToSerializerMap) { + if (NutritionProductInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionProductInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionProductInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductNutrient.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductNutrient.js new file mode 100644 index 000000000..376f83d94 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductNutrient.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class NutritionProductNutrientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + item: (value) => CodeableReferenceSerializer.serialize(value), + amount: (value) => RatioSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionProductNutrientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionProductNutrientSerializer.propertyToSerializerMap) { + if (NutritionProductNutrientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionProductNutrientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionProductNutrientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductProductCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductProductCharacteristic.js new file mode 100644 index 000000000..80464551b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/nutritionProductProductCharacteristic.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class NutritionProductProductCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueString: null, + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueBase64Binary: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueBoolean: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionProductProductCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionProductProductCharacteristicSerializer.propertyToSerializerMap) { + if (NutritionProductProductCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionProductProductCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionProductProductCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/observationComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/observationComponent.js new file mode 100644 index 000000000..df3518bb6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/observationComponent.js @@ -0,0 +1,77 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ObservationReferenceRangeSerializer = require('../backbone_elements/observationReferenceRange.js'); + +class ObservationComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueString: null, + valueBoolean: null, + valueInteger: null, + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueTime: null, + valueDateTime: null, + valuePeriod: (value) => PeriodSerializer.serialize(value), + dataAbsentReason: (value) => CodeableConceptSerializer.serialize(value), + interpretation: (value) => CodeableConceptSerializer.serialize(value), + referenceRange: (value) => ObservationReferenceRangeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationComponentSerializer.propertyToSerializerMap) { + if (ObservationComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQualifiedInterval.js b/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQualifiedInterval.js new file mode 100644 index 000000000..dbd65d597 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQualifiedInterval.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const RangeSerializer = require('../complex_types/range.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ObservationDefinitionQualifiedIntervalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: null, + range: (value) => RangeSerializer.serialize(value), + context: (value) => CodeableConceptSerializer.serialize(value), + appliesTo: (value) => CodeableConceptSerializer.serialize(value), + gender: null, + age: (value) => RangeSerializer.serialize(value), + gestationalAge: (value) => RangeSerializer.serialize(value), + condition: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationDefinitionQualifiedIntervalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationDefinitionQualifiedIntervalSerializer.propertyToSerializerMap) { + if (ObservationDefinitionQualifiedIntervalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationDefinitionQualifiedIntervalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationDefinitionQualifiedIntervalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQuantitativeDetails.js b/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQuantitativeDetails.js new file mode 100644 index 000000000..71390f5d5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/observationDefinitionQuantitativeDetails.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ObservationDefinitionQuantitativeDetailsSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + customaryUnit: (value) => CodeableConceptSerializer.serialize(value), + unit: (value) => CodeableConceptSerializer.serialize(value), + conversionFactor: null, + decimalPrecision: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationDefinitionQuantitativeDetailsSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationDefinitionQuantitativeDetailsSerializer.propertyToSerializerMap) { + if (ObservationDefinitionQuantitativeDetailsSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationDefinitionQuantitativeDetailsSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationDefinitionQuantitativeDetailsSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/observationReferenceRange.js b/src/fhir/serializers/4_0_0/backbone_elements/observationReferenceRange.js new file mode 100644 index 000000000..b8e934642 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/observationReferenceRange.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class ObservationReferenceRangeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + low: (value) => QuantitySerializer.serialize(value), + high: (value) => QuantitySerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + appliesTo: (value) => CodeableConceptSerializer.serialize(value), + age: (value) => RangeSerializer.serialize(value), + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationReferenceRangeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationReferenceRangeSerializer.propertyToSerializerMap) { + if (ObservationReferenceRangeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationReferenceRangeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationReferenceRangeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionBinding.js b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionBinding.js new file mode 100644 index 000000000..742839b0a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionBinding.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class OperationDefinitionBindingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + strength: null, + valueSet: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationDefinitionBindingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationDefinitionBindingSerializer.propertyToSerializerMap) { + if (OperationDefinitionBindingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationDefinitionBindingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationDefinitionBindingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionOverload.js b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionOverload.js new file mode 100644 index 000000000..f3b8b67ac --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionOverload.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class OperationDefinitionOverloadSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + parameterName: null, + comment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationDefinitionOverloadSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationDefinitionOverloadSerializer.propertyToSerializerMap) { + if (OperationDefinitionOverloadSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationDefinitionOverloadSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationDefinitionOverloadSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionParameter.js new file mode 100644 index 000000000..e0aa28ed2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionParameter.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const OperationDefinitionBindingSerializer = require('../backbone_elements/operationDefinitionBinding.js'); +const OperationDefinitionReferencedFromSerializer = require('../backbone_elements/operationDefinitionReferencedFrom.js'); + +class OperationDefinitionParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + use: null, + min: null, + max: null, + documentation: null, + type: null, + targetProfile: null, + searchType: null, + binding: (value) => OperationDefinitionBindingSerializer.serialize(value), + referencedFrom: (value) => OperationDefinitionReferencedFromSerializer.serialize(value), + part: (value) => OperationDefinitionParameterSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationDefinitionParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationDefinitionParameterSerializer.propertyToSerializerMap) { + if (OperationDefinitionParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationDefinitionParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationDefinitionParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionReferencedFrom.js b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionReferencedFrom.js new file mode 100644 index 000000000..1f8835dea --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/operationDefinitionReferencedFrom.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class OperationDefinitionReferencedFromSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + source: null, + sourceId: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationDefinitionReferencedFromSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationDefinitionReferencedFromSerializer.propertyToSerializerMap) { + if (OperationDefinitionReferencedFromSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationDefinitionReferencedFromSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationDefinitionReferencedFromSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/operationOutcomeIssue.js b/src/fhir/serializers/4_0_0/backbone_elements/operationOutcomeIssue.js new file mode 100644 index 000000000..914bc2f8f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/operationOutcomeIssue.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class OperationOutcomeIssueSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + severity: null, + code: null, + details: (value) => CodeableConceptSerializer.serialize(value), + diagnostics: null, + location: null, + expression: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationOutcomeIssueSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationOutcomeIssueSerializer.propertyToSerializerMap) { + if (OperationOutcomeIssueSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationOutcomeIssueSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationOutcomeIssueSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/organizationContact.js b/src/fhir/serializers/4_0_0/backbone_elements/organizationContact.js new file mode 100644 index 000000000..c638dd860 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/organizationContact.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); + +class OrganizationContactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + purpose: (value) => CodeableConceptSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OrganizationContactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OrganizationContactSerializer.propertyToSerializerMap) { + if (OrganizationContactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OrganizationContactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OrganizationContactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionContainedItem.js b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionContainedItem.js new file mode 100644 index 000000000..e76f93008 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionContainedItem.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class PackagedProductDefinitionContainedItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + item: (value) => CodeableReferenceSerializer.serialize(value), + amount: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionContainedItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionContainedItemSerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionContainedItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionContainedItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionContainedItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionLegalStatusOfSupply.js b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionLegalStatusOfSupply.js new file mode 100644 index 000000000..b2568a0c4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionLegalStatusOfSupply.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PackagedProductDefinitionLegalStatusOfSupplySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionLegalStatusOfSupplySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionLegalStatusOfSupplySerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionLegalStatusOfSupplySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionLegalStatusOfSupplySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionLegalStatusOfSupplySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionPackage.js b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionPackage.js new file mode 100644 index 000000000..1359a3adb --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionPackage.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PackagedProductDefinitionShelfLifeStorageSerializer = require('../backbone_elements/packagedProductDefinitionShelfLifeStorage.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PackagedProductDefinitionPropertySerializer = require('../backbone_elements/packagedProductDefinitionProperty.js'); +const PackagedProductDefinitionContainedItemSerializer = require('../backbone_elements/packagedProductDefinitionContainedItem.js'); + +class PackagedProductDefinitionPackageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + quantity: null, + material: (value) => CodeableConceptSerializer.serialize(value), + alternateMaterial: (value) => CodeableConceptSerializer.serialize(value), + shelfLifeStorage: (value) => PackagedProductDefinitionShelfLifeStorageSerializer.serialize(value), + manufacturer: (value) => ReferenceSerializer.serialize(value), + property: (value) => PackagedProductDefinitionPropertySerializer.serialize(value), + containedItem: (value) => PackagedProductDefinitionContainedItemSerializer.serialize(value), + package: (value) => PackagedProductDefinitionPackageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionPackageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionPackageSerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionPackageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionPackageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionPackageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionProperty.js new file mode 100644 index 000000000..6b4779eae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionProperty.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class PackagedProductDefinitionPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueDate: null, + valueBoolean: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionPropertySerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionShelfLifeStorage.js b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionShelfLifeStorage.js new file mode 100644 index 000000000..1db87b607 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/packagedProductDefinitionShelfLifeStorage.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class PackagedProductDefinitionShelfLifeStorageSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + periodDuration: (value) => QuantitySerializer.serialize(value), + periodString: null, + specialPrecautionsForStorage: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionShelfLifeStorageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionShelfLifeStorageSerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionShelfLifeStorageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionShelfLifeStorageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionShelfLifeStorageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/parametersParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/parametersParameter.js new file mode 100644 index 000000000..de150459b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/parametersParameter.js @@ -0,0 +1,136 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MetaSerializer = require('../complex_types/meta.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); + +class ParametersParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + valueBase64Binary: null, + valueBoolean: null, + valueCanonical: null, + valueCode: null, + valueDate: null, + valueDateTime: null, + valueDecimal: null, + valueId: null, + valueInstant: null, + valueInteger: null, + valueMarkdown: null, + valueOid: null, + valuePositiveInt: null, + valueString: null, + valueTime: null, + valueUnsignedInt: null, + valueUri: null, + valueUrl: null, + valueUuid: null, + valueAddress: (value) => AddressSerializer.serialize(value), + valueAge: (value) => QuantitySerializer.serialize(value), + valueAnnotation: (value) => AnnotationSerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueContactPoint: (value) => ContactPointSerializer.serialize(value), + valueCount: (value) => QuantitySerializer.serialize(value), + valueDistance: (value) => QuantitySerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value), + valueHumanName: (value) => HumanNameSerializer.serialize(value), + valueIdentifier: (value) => IdentifierSerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueSignature: (value) => SignatureSerializer.serialize(value), + valueTiming: (value) => TimingSerializer.serialize(value), + valueContactDetail: (value) => ContactDetailSerializer.serialize(value), + valueContributor: (value) => ContributorSerializer.serialize(value), + valueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + valueExpression: (value) => ExpressionSerializer.serialize(value), + valueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + valueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + valueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + valueUsageContext: (value) => UsageContextSerializer.serialize(value), + valueDosage: (value) => DosageSerializer.serialize(value), + valueMeta: (value) => MetaSerializer.serialize(value), + resource: (value) => ResourceContainerSerializer.serialize(value), + part: (value) => ParametersParameterSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ParametersParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ParametersParameterSerializer.propertyToSerializerMap) { + if (ParametersParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ParametersParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ParametersParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/patientCommunication.js b/src/fhir/serializers/4_0_0/backbone_elements/patientCommunication.js new file mode 100644 index 000000000..d09bfcb59 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/patientCommunication.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PatientCommunicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + language: (value) => CodeableConceptSerializer.serialize(value), + preferred: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PatientCommunicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PatientCommunicationSerializer.propertyToSerializerMap) { + if (PatientCommunicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PatientCommunicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PatientCommunicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/patientContact.js b/src/fhir/serializers/4_0_0/backbone_elements/patientContact.js new file mode 100644 index 000000000..64b4192fe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/patientContact.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class PatientContactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + relationship: (value) => CodeableConceptSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value), + gender: null, + organization: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PatientContactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PatientContactSerializer.propertyToSerializerMap) { + if (PatientContactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PatientContactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PatientContactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/patientLink.js b/src/fhir/serializers/4_0_0/backbone_elements/patientLink.js new file mode 100644 index 000000000..88a71d567 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/patientLink.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class PatientLinkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + other: (value) => ReferenceSerializer.serialize(value), + type: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PatientLinkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PatientLinkSerializer.propertyToSerializerMap) { + if (PatientLinkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PatientLinkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PatientLinkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationDetail.js b/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationDetail.js new file mode 100644 index 000000000..23435499a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationDetail.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class PaymentReconciliationDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + predecessor: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + submitter: (value) => ReferenceSerializer.serialize(value), + response: (value) => ReferenceSerializer.serialize(value), + date: null, + responsible: (value) => ReferenceSerializer.serialize(value), + payee: (value) => ReferenceSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PaymentReconciliationDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PaymentReconciliationDetailSerializer.propertyToSerializerMap) { + if (PaymentReconciliationDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PaymentReconciliationDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PaymentReconciliationDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationProcessNote.js b/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationProcessNote.js new file mode 100644 index 000000000..8beedff66 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/paymentReconciliationProcessNote.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class PaymentReconciliationProcessNoteSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PaymentReconciliationProcessNoteSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PaymentReconciliationProcessNoteSerializer.propertyToSerializerMap) { + if (PaymentReconciliationProcessNoteSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PaymentReconciliationProcessNoteSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PaymentReconciliationProcessNoteSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/personLink.js b/src/fhir/serializers/4_0_0/backbone_elements/personLink.js new file mode 100644 index 000000000..e6929d679 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/personLink.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class PersonLinkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + target: (value) => ReferenceSerializer.serialize(value), + assurance: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PersonLinkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PersonLinkSerializer.propertyToSerializerMap) { + if (PersonLinkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PersonLinkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PersonLinkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionAction.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionAction.js new file mode 100644 index 000000000..1f5e4642c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionAction.js @@ -0,0 +1,103 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const PlanDefinitionConditionSerializer = require('../backbone_elements/planDefinitionCondition.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const PlanDefinitionRelatedActionSerializer = require('../backbone_elements/planDefinitionRelatedAction.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const PlanDefinitionParticipantSerializer = require('../backbone_elements/planDefinitionParticipant.js'); +const PlanDefinitionDynamicValueSerializer = require('../backbone_elements/planDefinitionDynamicValue.js'); + +class PlanDefinitionActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + prefix: null, + title: null, + description: null, + textEquivalent: null, + priority: null, + code: (value) => CodeableConceptSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + documentation: (value) => RelatedArtifactSerializer.serialize(value), + goalId: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + subjectCanonical: null, + trigger: (value) => TriggerDefinitionSerializer.serialize(value), + condition: (value) => PlanDefinitionConditionSerializer.serialize(value), + input: (value) => DataRequirementSerializer.serialize(value), + output: (value) => DataRequirementSerializer.serialize(value), + relatedAction: (value) => PlanDefinitionRelatedActionSerializer.serialize(value), + timingDateTime: null, + timingAge: (value) => QuantitySerializer.serialize(value), + timingPeriod: (value) => PeriodSerializer.serialize(value), + timingDuration: (value) => QuantitySerializer.serialize(value), + timingRange: (value) => RangeSerializer.serialize(value), + timingTiming: (value) => TimingSerializer.serialize(value), + participant: (value) => PlanDefinitionParticipantSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + groupingBehavior: null, + selectionBehavior: null, + requiredBehavior: null, + precheckBehavior: null, + cardinalityBehavior: null, + definitionCanonical: null, + definitionUri: null, + transform: null, + dynamicValue: (value) => PlanDefinitionDynamicValueSerializer.serialize(value), + action: (value) => PlanDefinitionActionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionActionSerializer.propertyToSerializerMap) { + if (PlanDefinitionActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionCondition.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionCondition.js new file mode 100644 index 000000000..b250ea0a9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionCondition.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class PlanDefinitionConditionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + kind: null, + expression: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionConditionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionConditionSerializer.propertyToSerializerMap) { + if (PlanDefinitionConditionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionConditionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionConditionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionDynamicValue.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionDynamicValue.js new file mode 100644 index 000000000..60984418d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionDynamicValue.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class PlanDefinitionDynamicValueSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + path: null, + expression: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionDynamicValueSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionDynamicValueSerializer.propertyToSerializerMap) { + if (PlanDefinitionDynamicValueSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionDynamicValueSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionDynamicValueSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionGoal.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionGoal.js new file mode 100644 index 000000000..9cb19390f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionGoal.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const PlanDefinitionTargetSerializer = require('../backbone_elements/planDefinitionTarget.js'); + +class PlanDefinitionGoalSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + description: (value) => CodeableConceptSerializer.serialize(value), + priority: (value) => CodeableConceptSerializer.serialize(value), + start: (value) => CodeableConceptSerializer.serialize(value), + addresses: (value) => CodeableConceptSerializer.serialize(value), + documentation: (value) => RelatedArtifactSerializer.serialize(value), + target: (value) => PlanDefinitionTargetSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionGoalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionGoalSerializer.propertyToSerializerMap) { + if (PlanDefinitionGoalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionGoalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionGoalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionParticipant.js new file mode 100644 index 000000000..f04d03786 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionParticipant.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PlanDefinitionParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + role: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionParticipantSerializer.propertyToSerializerMap) { + if (PlanDefinitionParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionRelatedAction.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionRelatedAction.js new file mode 100644 index 000000000..f153a0621 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionRelatedAction.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class PlanDefinitionRelatedActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + actionId: null, + relationship: null, + offsetDuration: (value) => QuantitySerializer.serialize(value), + offsetRange: (value) => RangeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionRelatedActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionRelatedActionSerializer.propertyToSerializerMap) { + if (PlanDefinitionRelatedActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionRelatedActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionRelatedActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionTarget.js b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionTarget.js new file mode 100644 index 000000000..2e075bee8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/planDefinitionTarget.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class PlanDefinitionTargetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + measure: (value) => CodeableConceptSerializer.serialize(value), + detailQuantity: (value) => QuantitySerializer.serialize(value), + detailRange: (value) => RangeSerializer.serialize(value), + detailCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + due: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionTargetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionTargetSerializer.propertyToSerializerMap) { + if (PlanDefinitionTargetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionTargetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionTargetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/population.js b/src/fhir/serializers/4_0_0/backbone_elements/population.js new file mode 100644 index 000000000..2227e97ce --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/population.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const RangeSerializer = require('../complex_types/range.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PopulationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + ageRange: (value) => RangeSerializer.serialize(value), + ageCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + gender: (value) => CodeableConceptSerializer.serialize(value), + race: (value) => CodeableConceptSerializer.serialize(value), + physiologicalCondition: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PopulationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PopulationSerializer.propertyToSerializerMap) { + if (PopulationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PopulationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PopulationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/practitionerQualification.js b/src/fhir/serializers/4_0_0/backbone_elements/practitionerQualification.js new file mode 100644 index 000000000..b2b640599 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/practitionerQualification.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class PractitionerQualificationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + issuer: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PractitionerQualificationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PractitionerQualificationSerializer.propertyToSerializerMap) { + if (PractitionerQualificationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PractitionerQualificationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PractitionerQualificationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleAvailableTime.js b/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleAvailableTime.js new file mode 100644 index 000000000..6b062cfb4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleAvailableTime.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class PractitionerRoleAvailableTimeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + daysOfWeek: null, + allDay: null, + availableStartTime: null, + availableEndTime: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PractitionerRoleAvailableTimeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PractitionerRoleAvailableTimeSerializer.propertyToSerializerMap) { + if (PractitionerRoleAvailableTimeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PractitionerRoleAvailableTimeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PractitionerRoleAvailableTimeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleNotAvailable.js b/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleNotAvailable.js new file mode 100644 index 000000000..c2d20b668 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/practitionerRoleNotAvailable.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class PractitionerRoleNotAvailableSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + during: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PractitionerRoleNotAvailableSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PractitionerRoleNotAvailableSerializer.propertyToSerializerMap) { + if (PractitionerRoleNotAvailableSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PractitionerRoleNotAvailableSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PractitionerRoleNotAvailableSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/procedureFocalDevice.js b/src/fhir/serializers/4_0_0/backbone_elements/procedureFocalDevice.js new file mode 100644 index 000000000..9ae79ccd8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/procedureFocalDevice.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ProcedureFocalDeviceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => CodeableConceptSerializer.serialize(value), + manipulated: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProcedureFocalDeviceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProcedureFocalDeviceSerializer.propertyToSerializerMap) { + if (ProcedureFocalDeviceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProcedureFocalDeviceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProcedureFocalDeviceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/procedurePerformer.js b/src/fhir/serializers/4_0_0/backbone_elements/procedurePerformer.js new file mode 100644 index 000000000..28bd53d0c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/procedurePerformer.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ProcedurePerformerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value), + onBehalfOf: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProcedurePerformerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProcedurePerformerSerializer.propertyToSerializerMap) { + if (ProcedurePerformerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProcedurePerformerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProcedurePerformerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/prodCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/prodCharacteristic.js new file mode 100644 index 000000000..bc13f1f2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/prodCharacteristic.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ProdCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + height: (value) => QuantitySerializer.serialize(value), + width: (value) => QuantitySerializer.serialize(value), + depth: (value) => QuantitySerializer.serialize(value), + weight: (value) => QuantitySerializer.serialize(value), + nominalVolume: (value) => QuantitySerializer.serialize(value), + externalDiameter: (value) => QuantitySerializer.serialize(value), + shape: null, + color: null, + imprint: null, + image: (value) => AttachmentSerializer.serialize(value), + scoring: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProdCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProdCharacteristicSerializer.propertyToSerializerMap) { + if (ProdCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProdCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProdCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/productShelfLife.js b/src/fhir/serializers/4_0_0/backbone_elements/productShelfLife.js new file mode 100644 index 000000000..3c30e1892 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/productShelfLife.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class ProductShelfLifeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => QuantitySerializer.serialize(value), + specialPrecautionsForStorage: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProductShelfLifeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProductShelfLifeSerializer.propertyToSerializerMap) { + if (ProductShelfLifeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProductShelfLifeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProductShelfLifeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/provenanceAgent.js b/src/fhir/serializers/4_0_0/backbone_elements/provenanceAgent.js new file mode 100644 index 000000000..f7b039a2a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/provenanceAgent.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ProvenanceAgentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + who: (value) => ReferenceSerializer.serialize(value), + onBehalfOf: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProvenanceAgentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProvenanceAgentSerializer.propertyToSerializerMap) { + if (ProvenanceAgentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProvenanceAgentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProvenanceAgentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/provenanceEntity.js b/src/fhir/serializers/4_0_0/backbone_elements/provenanceEntity.js new file mode 100644 index 000000000..0973cc143 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/provenanceEntity.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ProvenanceAgentSerializer = require('../backbone_elements/provenanceAgent.js'); + +class ProvenanceEntitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: null, + what: (value) => ReferenceSerializer.serialize(value), + agent: (value) => ProvenanceAgentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProvenanceEntitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProvenanceEntitySerializer.propertyToSerializerMap) { + if (ProvenanceEntitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProvenanceEntitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProvenanceEntitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireAnswerOption.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireAnswerOption.js new file mode 100644 index 000000000..fe952cbe8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireAnswerOption.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class QuestionnaireAnswerOptionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + valueInteger: null, + valueDate: null, + valueTime: null, + valueString: null, + valueCoding: (value) => CodingSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + initialSelected: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireAnswerOptionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireAnswerOptionSerializer.propertyToSerializerMap) { + if (QuestionnaireAnswerOptionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireAnswerOptionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireAnswerOptionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireEnableWhen.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireEnableWhen.js new file mode 100644 index 000000000..ff867e33e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireEnableWhen.js @@ -0,0 +1,70 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class QuestionnaireEnableWhenSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + question: null, + operator: null, + answerBoolean: null, + answerDecimal: null, + answerInteger: null, + answerDate: null, + answerDateTime: null, + answerTime: null, + answerString: null, + answerCoding: (value) => CodingSerializer.serialize(value), + answerQuantity: (value) => QuantitySerializer.serialize(value), + answerReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireEnableWhenSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireEnableWhenSerializer.propertyToSerializerMap) { + if (QuestionnaireEnableWhenSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireEnableWhenSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireEnableWhenSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireInitial.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireInitial.js new file mode 100644 index 000000000..5abca6651 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireInitial.js @@ -0,0 +1,71 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class QuestionnaireInitialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + valueBoolean: null, + valueDecimal: null, + valueInteger: null, + valueDate: null, + valueDateTime: null, + valueTime: null, + valueString: null, + valueUri: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireInitialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireInitialSerializer.propertyToSerializerMap) { + if (QuestionnaireInitialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireInitialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireInitialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireItem.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireItem.js new file mode 100644 index 000000000..1db214e80 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireItem.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuestionnaireEnableWhenSerializer = require('../backbone_elements/questionnaireEnableWhen.js'); +const QuestionnaireAnswerOptionSerializer = require('../backbone_elements/questionnaireAnswerOption.js'); +const QuestionnaireInitialSerializer = require('../backbone_elements/questionnaireInitial.js'); + +class QuestionnaireItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + linkId: null, + definition: null, + code: (value) => CodingSerializer.serialize(value), + prefix: null, + text: null, + type: null, + enableWhen: (value) => QuestionnaireEnableWhenSerializer.serialize(value), + enableBehavior: null, + required: null, + repeats: null, + readOnly: null, + maxLength: null, + answerValueSet: null, + answerOption: (value) => QuestionnaireAnswerOptionSerializer.serialize(value), + initial: (value) => QuestionnaireInitialSerializer.serialize(value), + item: (value) => QuestionnaireItemSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireItemSerializer.propertyToSerializerMap) { + if (QuestionnaireItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseAnswer.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseAnswer.js new file mode 100644 index 000000000..0aa300f1b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseAnswer.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuestionnaireResponseItemSerializer = require('../backbone_elements/questionnaireResponseItem.js'); + +class QuestionnaireResponseAnswerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + valueBoolean: null, + valueDecimal: null, + valueInteger: null, + valueDate: null, + valueDateTime: null, + valueTime: null, + valueString: null, + valueUri: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + item: (value) => QuestionnaireResponseItemSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireResponseAnswerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireResponseAnswerSerializer.propertyToSerializerMap) { + if (QuestionnaireResponseAnswerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireResponseAnswerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireResponseAnswerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseItem.js b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseItem.js new file mode 100644 index 000000000..29627fe55 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/questionnaireResponseItem.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuestionnaireResponseAnswerSerializer = require('../backbone_elements/questionnaireResponseAnswer.js'); + +class QuestionnaireResponseItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + linkId: null, + definition: null, + text: null, + answer: (value) => QuestionnaireResponseAnswerSerializer.serialize(value), + item: (value) => QuestionnaireResponseItemSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireResponseItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireResponseItemSerializer.propertyToSerializerMap) { + if (QuestionnaireResponseItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireResponseItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireResponseItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/regulatedAuthorizationCase.js b/src/fhir/serializers/4_0_0/backbone_elements/regulatedAuthorizationCase.js new file mode 100644 index 000000000..6149706a8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/regulatedAuthorizationCase.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class RegulatedAuthorizationCaseSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + datePeriod: (value) => PeriodSerializer.serialize(value), + dateDateTime: null, + application: (value) => RegulatedAuthorizationCaseSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RegulatedAuthorizationCaseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RegulatedAuthorizationCaseSerializer.propertyToSerializerMap) { + if (RegulatedAuthorizationCaseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RegulatedAuthorizationCaseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RegulatedAuthorizationCaseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/relatedPersonCommunication.js b/src/fhir/serializers/4_0_0/backbone_elements/relatedPersonCommunication.js new file mode 100644 index 000000000..31abbaf3a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/relatedPersonCommunication.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class RelatedPersonCommunicationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + language: (value) => CodeableConceptSerializer.serialize(value), + preferred: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RelatedPersonCommunicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RelatedPersonCommunicationSerializer.propertyToSerializerMap) { + if (RelatedPersonCommunicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RelatedPersonCommunicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RelatedPersonCommunicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/requestGroupAction.js b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupAction.js new file mode 100644 index 000000000..4f1a5819f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupAction.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const RequestGroupConditionSerializer = require('../backbone_elements/requestGroupCondition.js'); +const RequestGroupRelatedActionSerializer = require('../backbone_elements/requestGroupRelatedAction.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class RequestGroupActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + prefix: null, + title: null, + description: null, + textEquivalent: null, + priority: null, + code: (value) => CodeableConceptSerializer.serialize(value), + documentation: (value) => RelatedArtifactSerializer.serialize(value), + condition: (value) => RequestGroupConditionSerializer.serialize(value), + relatedAction: (value) => RequestGroupRelatedActionSerializer.serialize(value), + timingDateTime: null, + timingAge: (value) => QuantitySerializer.serialize(value), + timingPeriod: (value) => PeriodSerializer.serialize(value), + timingDuration: (value) => QuantitySerializer.serialize(value), + timingRange: (value) => RangeSerializer.serialize(value), + timingTiming: (value) => TimingSerializer.serialize(value), + participant: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + groupingBehavior: null, + selectionBehavior: null, + requiredBehavior: null, + precheckBehavior: null, + cardinalityBehavior: null, + resource: (value) => ReferenceSerializer.serialize(value), + action: (value) => RequestGroupActionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RequestGroupActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RequestGroupActionSerializer.propertyToSerializerMap) { + if (RequestGroupActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RequestGroupActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RequestGroupActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/requestGroupCondition.js b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupCondition.js new file mode 100644 index 000000000..1d6ae05db --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupCondition.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class RequestGroupConditionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + kind: null, + expression: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RequestGroupConditionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RequestGroupConditionSerializer.propertyToSerializerMap) { + if (RequestGroupConditionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RequestGroupConditionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RequestGroupConditionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/requestGroupRelatedAction.js b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupRelatedAction.js new file mode 100644 index 000000000..af269fff7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/requestGroupRelatedAction.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class RequestGroupRelatedActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + actionId: null, + relationship: null, + offsetDuration: (value) => QuantitySerializer.serialize(value), + offsetRange: (value) => RangeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RequestGroupRelatedActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RequestGroupRelatedActionSerializer.propertyToSerializerMap) { + if (RequestGroupRelatedActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RequestGroupRelatedActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RequestGroupRelatedActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/researchElementDefinitionCharacteristic.js b/src/fhir/serializers/4_0_0/backbone_elements/researchElementDefinitionCharacteristic.js new file mode 100644 index 000000000..289aa316a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/researchElementDefinitionCharacteristic.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); + +class ResearchElementDefinitionCharacteristicSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + definitionCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + definitionCanonical: null, + definitionExpression: (value) => ExpressionSerializer.serialize(value), + definitionDataRequirement: (value) => DataRequirementSerializer.serialize(value), + usageContext: (value) => UsageContextSerializer.serialize(value), + exclude: null, + unitOfMeasure: (value) => CodeableConceptSerializer.serialize(value), + studyEffectiveDescription: null, + studyEffectiveDateTime: null, + studyEffectivePeriod: (value) => PeriodSerializer.serialize(value), + studyEffectiveDuration: (value) => QuantitySerializer.serialize(value), + studyEffectiveTiming: (value) => TimingSerializer.serialize(value), + studyEffectiveTimeFromStart: (value) => QuantitySerializer.serialize(value), + studyEffectiveGroupMeasure: null, + participantEffectiveDescription: null, + participantEffectiveDateTime: null, + participantEffectivePeriod: (value) => PeriodSerializer.serialize(value), + participantEffectiveDuration: (value) => QuantitySerializer.serialize(value), + participantEffectiveTiming: (value) => TimingSerializer.serialize(value), + participantEffectiveTimeFromStart: (value) => QuantitySerializer.serialize(value), + participantEffectiveGroupMeasure: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchElementDefinitionCharacteristicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchElementDefinitionCharacteristicSerializer.propertyToSerializerMap) { + if (ResearchElementDefinitionCharacteristicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchElementDefinitionCharacteristicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchElementDefinitionCharacteristicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/researchStudyArm.js b/src/fhir/serializers/4_0_0/backbone_elements/researchStudyArm.js new file mode 100644 index 000000000..da9d3c97b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/researchStudyArm.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ResearchStudyArmSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: (value) => CodeableConceptSerializer.serialize(value), + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchStudyArmSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchStudyArmSerializer.propertyToSerializerMap) { + if (ResearchStudyArmSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchStudyArmSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchStudyArmSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/researchStudyObjective.js b/src/fhir/serializers/4_0_0/backbone_elements/researchStudyObjective.js new file mode 100644 index 000000000..53ad407b0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/researchStudyObjective.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ResearchStudyObjectiveSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchStudyObjectiveSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchStudyObjectiveSerializer.propertyToSerializerMap) { + if (ResearchStudyObjectiveSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchStudyObjectiveSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchStudyObjectiveSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/riskAssessmentPrediction.js b/src/fhir/serializers/4_0_0/backbone_elements/riskAssessmentPrediction.js new file mode 100644 index 000000000..01c5c0e26 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/riskAssessmentPrediction.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RangeSerializer = require('../complex_types/range.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class RiskAssessmentPredictionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + outcome: (value) => CodeableConceptSerializer.serialize(value), + probabilityDecimal: null, + probabilityRange: (value) => RangeSerializer.serialize(value), + qualitativeRisk: (value) => CodeableConceptSerializer.serialize(value), + relativeRisk: null, + whenPeriod: (value) => PeriodSerializer.serialize(value), + whenRange: (value) => RangeSerializer.serialize(value), + rationale: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RiskAssessmentPredictionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RiskAssessmentPredictionSerializer.propertyToSerializerMap) { + if (RiskAssessmentPredictionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RiskAssessmentPredictionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RiskAssessmentPredictionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/searchParameterComponent.js b/src/fhir/serializers/4_0_0/backbone_elements/searchParameterComponent.js new file mode 100644 index 000000000..4c5d555b6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/searchParameterComponent.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class SearchParameterComponentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + definition: null, + expression: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SearchParameterComponentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SearchParameterComponentSerializer.propertyToSerializerMap) { + if (SearchParameterComponentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SearchParameterComponentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SearchParameterComponentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenCollection.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenCollection.js new file mode 100644 index 000000000..9d195ebd9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenCollection.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class SpecimenCollectionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + collector: (value) => ReferenceSerializer.serialize(value), + collectedDateTime: null, + collectedPeriod: (value) => PeriodSerializer.serialize(value), + duration: (value) => QuantitySerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + fastingStatusCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + fastingStatusDuration: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenCollectionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenCollectionSerializer.propertyToSerializerMap) { + if (SpecimenCollectionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenCollectionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenCollectionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenContainer.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenContainer.js new file mode 100644 index 000000000..c0f00d584 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenContainer.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SpecimenContainerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + description: null, + type: (value) => CodeableConceptSerializer.serialize(value), + capacity: (value) => QuantitySerializer.serialize(value), + specimenQuantity: (value) => QuantitySerializer.serialize(value), + additiveCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + additiveReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenContainerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenContainerSerializer.propertyToSerializerMap) { + if (SpecimenContainerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenContainerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenContainerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionAdditive.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionAdditive.js new file mode 100644 index 000000000..398becaa5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionAdditive.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SpecimenDefinitionAdditiveSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + additiveCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + additiveReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenDefinitionAdditiveSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenDefinitionAdditiveSerializer.propertyToSerializerMap) { + if (SpecimenDefinitionAdditiveSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenDefinitionAdditiveSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenDefinitionAdditiveSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionContainer.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionContainer.js new file mode 100644 index 000000000..0f60d2d90 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionContainer.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const SpecimenDefinitionAdditiveSerializer = require('../backbone_elements/specimenDefinitionAdditive.js'); + +class SpecimenDefinitionContainerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + material: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + cap: (value) => CodeableConceptSerializer.serialize(value), + description: null, + capacity: (value) => QuantitySerializer.serialize(value), + minimumVolumeQuantity: (value) => QuantitySerializer.serialize(value), + minimumVolumeString: null, + additive: (value) => SpecimenDefinitionAdditiveSerializer.serialize(value), + preparation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenDefinitionContainerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenDefinitionContainerSerializer.propertyToSerializerMap) { + if (SpecimenDefinitionContainerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenDefinitionContainerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenDefinitionContainerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionHandling.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionHandling.js new file mode 100644 index 000000000..a8398bac0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionHandling.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const RangeSerializer = require('../complex_types/range.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class SpecimenDefinitionHandlingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + temperatureQualifier: (value) => CodeableConceptSerializer.serialize(value), + temperatureRange: (value) => RangeSerializer.serialize(value), + maxDuration: (value) => QuantitySerializer.serialize(value), + instruction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenDefinitionHandlingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenDefinitionHandlingSerializer.propertyToSerializerMap) { + if (SpecimenDefinitionHandlingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenDefinitionHandlingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenDefinitionHandlingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionTypeTested.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionTypeTested.js new file mode 100644 index 000000000..59f4f9c07 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenDefinitionTypeTested.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SpecimenDefinitionContainerSerializer = require('../backbone_elements/specimenDefinitionContainer.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const SpecimenDefinitionHandlingSerializer = require('../backbone_elements/specimenDefinitionHandling.js'); + +class SpecimenDefinitionTypeTestedSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + isDerived: null, + type: (value) => CodeableConceptSerializer.serialize(value), + preference: null, + container: (value) => SpecimenDefinitionContainerSerializer.serialize(value), + requirement: null, + retentionTime: (value) => QuantitySerializer.serialize(value), + rejectionCriterion: (value) => CodeableConceptSerializer.serialize(value), + handling: (value) => SpecimenDefinitionHandlingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenDefinitionTypeTestedSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenDefinitionTypeTestedSerializer.propertyToSerializerMap) { + if (SpecimenDefinitionTypeTestedSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenDefinitionTypeTestedSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenDefinitionTypeTestedSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/specimenProcessing.js b/src/fhir/serializers/4_0_0/backbone_elements/specimenProcessing.js new file mode 100644 index 000000000..992a5f834 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/specimenProcessing.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class SpecimenProcessingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + procedure: (value) => CodeableConceptSerializer.serialize(value), + additive: (value) => ReferenceSerializer.serialize(value), + timeDateTime: null, + timePeriod: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenProcessingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenProcessingSerializer.propertyToSerializerMap) { + if (SpecimenProcessingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenProcessingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenProcessingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionContext.js b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionContext.js new file mode 100644 index 000000000..53fd8e033 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionContext.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureDefinitionContextSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + expression: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureDefinitionContextSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureDefinitionContextSerializer.propertyToSerializerMap) { + if (StructureDefinitionContextSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureDefinitionContextSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureDefinitionContextSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionDifferential.js b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionDifferential.js new file mode 100644 index 000000000..9fc118abe --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionDifferential.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ElementDefinitionSerializer = require('../backbone_elements/elementDefinition.js'); + +class StructureDefinitionDifferentialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + element: (value) => ElementDefinitionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureDefinitionDifferentialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureDefinitionDifferentialSerializer.propertyToSerializerMap) { + if (StructureDefinitionDifferentialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureDefinitionDifferentialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureDefinitionDifferentialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionMapping.js b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionMapping.js new file mode 100644 index 000000000..5e3a7b1fa --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionMapping.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureDefinitionMappingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identity: null, + uri: null, + name: null, + comment: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureDefinitionMappingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureDefinitionMappingSerializer.propertyToSerializerMap) { + if (StructureDefinitionMappingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureDefinitionMappingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureDefinitionMappingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionSnapshot.js b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionSnapshot.js new file mode 100644 index 000000000..79e847cd9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureDefinitionSnapshot.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ElementDefinitionSerializer = require('../backbone_elements/elementDefinition.js'); + +class StructureDefinitionSnapshotSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + element: (value) => ElementDefinitionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureDefinitionSnapshotSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureDefinitionSnapshotSerializer.propertyToSerializerMap) { + if (StructureDefinitionSnapshotSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureDefinitionSnapshotSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureDefinitionSnapshotSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapDependent.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapDependent.js new file mode 100644 index 000000000..87af56281 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapDependent.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureMapDependentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + variable: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapDependentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapDependentSerializer.propertyToSerializerMap) { + if (StructureMapDependentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapDependentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapDependentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapGroup.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapGroup.js new file mode 100644 index 000000000..01b5688da --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapGroup.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const StructureMapInputSerializer = require('../backbone_elements/structureMapInput.js'); +const StructureMapRuleSerializer = require('../backbone_elements/structureMapRule.js'); + +class StructureMapGroupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + extends: null, + typeMode: null, + documentation: null, + input: (value) => StructureMapInputSerializer.serialize(value), + rule: (value) => StructureMapRuleSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapGroupSerializer.propertyToSerializerMap) { + if (StructureMapGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapInput.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapInput.js new file mode 100644 index 000000000..e0b3ab184 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapInput.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureMapInputSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: null, + mode: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapInputSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapInputSerializer.propertyToSerializerMap) { + if (StructureMapInputSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapInputSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapInputSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapParameter.js new file mode 100644 index 000000000..88bd045e3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapParameter.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureMapParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + valueId: null, + valueString: null, + valueBoolean: null, + valueInteger: null, + valueDecimal: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapParameterSerializer.propertyToSerializerMap) { + if (StructureMapParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapRule.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapRule.js new file mode 100644 index 000000000..4379f145e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapRule.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const StructureMapSourceSerializer = require('../backbone_elements/structureMapSource.js'); +const StructureMapTargetSerializer = require('../backbone_elements/structureMapTarget.js'); +const StructureMapDependentSerializer = require('../backbone_elements/structureMapDependent.js'); + +class StructureMapRuleSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + source: (value) => StructureMapSourceSerializer.serialize(value), + target: (value) => StructureMapTargetSerializer.serialize(value), + rule: (value) => StructureMapRuleSerializer.serialize(value), + dependent: (value) => StructureMapDependentSerializer.serialize(value), + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapRuleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapRuleSerializer.propertyToSerializerMap) { + if (StructureMapRuleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapRuleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapRuleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapSource.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapSource.js new file mode 100644 index 000000000..a742d8f63 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapSource.js @@ -0,0 +1,142 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MetaSerializer = require('../complex_types/meta.js'); + +class StructureMapSourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + context: null, + min: null, + max: null, + type: null, + defaultValueBase64Binary: null, + defaultValueBoolean: null, + defaultValueCanonical: null, + defaultValueCode: null, + defaultValueDate: null, + defaultValueDateTime: null, + defaultValueDecimal: null, + defaultValueId: null, + defaultValueInstant: null, + defaultValueInteger: null, + defaultValueMarkdown: null, + defaultValueOid: null, + defaultValuePositiveInt: null, + defaultValueString: null, + defaultValueTime: null, + defaultValueUnsignedInt: null, + defaultValueUri: null, + defaultValueUrl: null, + defaultValueUuid: null, + defaultValueAddress: (value) => AddressSerializer.serialize(value), + defaultValueAge: (value) => QuantitySerializer.serialize(value), + defaultValueAnnotation: (value) => AnnotationSerializer.serialize(value), + defaultValueAttachment: (value) => AttachmentSerializer.serialize(value), + defaultValueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + defaultValueCoding: (value) => CodingSerializer.serialize(value), + defaultValueContactPoint: (value) => ContactPointSerializer.serialize(value), + defaultValueCount: (value) => QuantitySerializer.serialize(value), + defaultValueDistance: (value) => QuantitySerializer.serialize(value), + defaultValueDuration: (value) => QuantitySerializer.serialize(value), + defaultValueHumanName: (value) => HumanNameSerializer.serialize(value), + defaultValueIdentifier: (value) => IdentifierSerializer.serialize(value), + defaultValueMoney: (value) => MoneySerializer.serialize(value), + defaultValuePeriod: (value) => PeriodSerializer.serialize(value), + defaultValueQuantity: (value) => QuantitySerializer.serialize(value), + defaultValueRange: (value) => RangeSerializer.serialize(value), + defaultValueRatio: (value) => RatioSerializer.serialize(value), + defaultValueReference: (value) => ReferenceSerializer.serialize(value), + defaultValueSampledData: (value) => SampledDataSerializer.serialize(value), + defaultValueSignature: (value) => SignatureSerializer.serialize(value), + defaultValueTiming: (value) => TimingSerializer.serialize(value), + defaultValueContactDetail: (value) => ContactDetailSerializer.serialize(value), + defaultValueContributor: (value) => ContributorSerializer.serialize(value), + defaultValueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + defaultValueExpression: (value) => ExpressionSerializer.serialize(value), + defaultValueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + defaultValueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + defaultValueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + defaultValueUsageContext: (value) => UsageContextSerializer.serialize(value), + defaultValueDosage: (value) => DosageSerializer.serialize(value), + defaultValueMeta: (value) => MetaSerializer.serialize(value), + element: null, + listMode: null, + variable: null, + condition: null, + check: null, + logMessage: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapSourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapSourceSerializer.propertyToSerializerMap) { + if (StructureMapSourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapSourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapSourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapStructure.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapStructure.js new file mode 100644 index 000000000..c17368443 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapStructure.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class StructureMapStructureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + mode: null, + alias: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapStructureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapStructureSerializer.propertyToSerializerMap) { + if (StructureMapStructureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapStructureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapStructureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/structureMapTarget.js b/src/fhir/serializers/4_0_0/backbone_elements/structureMapTarget.js new file mode 100644 index 000000000..28088768e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/structureMapTarget.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const StructureMapParameterSerializer = require('../backbone_elements/structureMapParameter.js'); + +class StructureMapTargetSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + context: null, + contextType: null, + element: null, + variable: null, + listMode: null, + listRuleId: null, + transform: null, + parameter: (value) => StructureMapParameterSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapTargetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapTargetSerializer.propertyToSerializerMap) { + if (StructureMapTargetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapTargetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapTargetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionChannel.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionChannel.js new file mode 100644 index 000000000..335d12006 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionChannel.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class SubscriptionChannelSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + endpoint: null, + payload: null, + header: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionChannelSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionChannelSerializer.propertyToSerializerMap) { + if (SubscriptionChannelSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionChannelSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionChannelSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionStatusNotificationEvent.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionStatusNotificationEvent.js new file mode 100644 index 000000000..eb14e105d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionStatusNotificationEvent.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SubscriptionStatusNotificationEventSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + eventNumber: null, + timestamp: null, + focus: (value) => ReferenceSerializer.serialize(value), + additionalContext: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionStatusNotificationEventSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionStatusNotificationEventSerializer.propertyToSerializerMap) { + if (SubscriptionStatusNotificationEventSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionStatusNotificationEventSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionStatusNotificationEventSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicCanFilterBy.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicCanFilterBy.js new file mode 100644 index 000000000..94356141d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicCanFilterBy.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class SubscriptionTopicCanFilterBySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + resource: null, + filterParameter: null, + filterDefinition: null, + modifier: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicCanFilterBySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicCanFilterBySerializer.propertyToSerializerMap) { + if (SubscriptionTopicCanFilterBySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicCanFilterBySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicCanFilterBySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicEventTrigger.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicEventTrigger.js new file mode 100644 index 000000000..70ff41cae --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicEventTrigger.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class SubscriptionTopicEventTriggerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + event: (value) => CodeableConceptSerializer.serialize(value), + resource: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicEventTriggerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicEventTriggerSerializer.propertyToSerializerMap) { + if (SubscriptionTopicEventTriggerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicEventTriggerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicEventTriggerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicNotificationShape.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicNotificationShape.js new file mode 100644 index 000000000..c7e1f4857 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicNotificationShape.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class SubscriptionTopicNotificationShapeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + resource: null, + include: null, + revInclude: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicNotificationShapeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicNotificationShapeSerializer.propertyToSerializerMap) { + if (SubscriptionTopicNotificationShapeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicNotificationShapeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicNotificationShapeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicQueryCriteria.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicQueryCriteria.js new file mode 100644 index 000000000..d8f074a99 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicQueryCriteria.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class SubscriptionTopicQueryCriteriaSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + previous: null, + resultForCreate: null, + current: null, + resultForDelete: null, + requireBoth: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicQueryCriteriaSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicQueryCriteriaSerializer.propertyToSerializerMap) { + if (SubscriptionTopicQueryCriteriaSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicQueryCriteriaSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicQueryCriteriaSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicResourceTrigger.js b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicResourceTrigger.js new file mode 100644 index 000000000..49f25a629 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/subscriptionTopicResourceTrigger.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const SubscriptionTopicQueryCriteriaSerializer = require('../backbone_elements/subscriptionTopicQueryCriteria.js'); + +class SubscriptionTopicResourceTriggerSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + resource: null, + supportedInteraction: null, + queryCriteria: (value) => SubscriptionTopicQueryCriteriaSerializer.serialize(value), + fhirPathCriteria: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicResourceTriggerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicResourceTriggerSerializer.propertyToSerializerMap) { + if (SubscriptionTopicResourceTriggerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicResourceTriggerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicResourceTriggerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionCode.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionCode.js new file mode 100644 index 000000000..98824f312 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionCode.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SubstanceDefinitionCodeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + statusDate: null, + note: (value) => AnnotationSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionCodeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionCodeSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionCodeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionCodeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionCodeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMoiety.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMoiety.js new file mode 100644 index 000000000..1e4ac7f4d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMoiety.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class SubstanceDefinitionMoietySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + name: null, + stereochemistry: (value) => CodeableConceptSerializer.serialize(value), + opticalActivity: (value) => CodeableConceptSerializer.serialize(value), + molecularFormula: null, + amountQuantity: (value) => QuantitySerializer.serialize(value), + amountString: null, + measurementType: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionMoietySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionMoietySerializer.propertyToSerializerMap) { + if (SubstanceDefinitionMoietySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionMoietySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionMoietySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMolecularWeight.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMolecularWeight.js new file mode 100644 index 000000000..2961701f6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionMolecularWeight.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class SubstanceDefinitionMolecularWeightSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionMolecularWeightSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionMolecularWeightSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionMolecularWeightSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionMolecularWeightSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionMolecularWeightSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionName.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionName.js new file mode 100644 index 000000000..0fbdc5a96 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionName.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SubstanceDefinitionOfficialSerializer = require('../backbone_elements/substanceDefinitionOfficial.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SubstanceDefinitionNameSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + type: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + preferred: null, + language: (value) => CodeableConceptSerializer.serialize(value), + domain: (value) => CodeableConceptSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + synonym: (value) => SubstanceDefinitionNameSerializer.serialize(value), + translation: (value) => SubstanceDefinitionNameSerializer.serialize(value), + official: (value) => SubstanceDefinitionOfficialSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionNameSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionNameSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionNameSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionNameSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionNameSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionOfficial.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionOfficial.js new file mode 100644 index 000000000..c04e9e50d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionOfficial.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class SubstanceDefinitionOfficialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + authority: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + date: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionOfficialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionOfficialSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionOfficialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionOfficialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionOfficialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionProperty.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionProperty.js new file mode 100644 index 000000000..5d8475970 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionProperty.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class SubstanceDefinitionPropertySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueDate: null, + valueBoolean: null, + valueAttachment: (value) => AttachmentSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionPropertySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionPropertySerializer.propertyToSerializerMap) { + if (SubstanceDefinitionPropertySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionPropertySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionPropertySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRelationship.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRelationship.js new file mode 100644 index 000000000..ed9a29542 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRelationship.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); + +class SubstanceDefinitionRelationshipSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + substanceDefinitionReference: (value) => ReferenceSerializer.serialize(value), + substanceDefinitionCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + isDefining: null, + amountQuantity: (value) => QuantitySerializer.serialize(value), + amountRatio: (value) => RatioSerializer.serialize(value), + amountString: null, + ratioHighLimitAmount: (value) => RatioSerializer.serialize(value), + comparator: (value) => CodeableConceptSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionRelationshipSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionRelationshipSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionRelationshipSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionRelationshipSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionRelationshipSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRepresentation.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRepresentation.js new file mode 100644 index 000000000..4a85636af --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionRepresentation.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SubstanceDefinitionRepresentationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + representation: null, + format: (value) => CodeableConceptSerializer.serialize(value), + document: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionRepresentationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionRepresentationSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionRepresentationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionRepresentationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionRepresentationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionSourceMaterial.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionSourceMaterial.js new file mode 100644 index 000000000..6a07d9647 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionSourceMaterial.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class SubstanceDefinitionSourceMaterialSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + genus: (value) => CodeableConceptSerializer.serialize(value), + species: (value) => CodeableConceptSerializer.serialize(value), + part: (value) => CodeableConceptSerializer.serialize(value), + countryOfOrigin: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionSourceMaterialSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionSourceMaterialSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionSourceMaterialSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionSourceMaterialSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionSourceMaterialSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionStructure.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionStructure.js new file mode 100644 index 000000000..056fae7ee --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceDefinitionStructure.js @@ -0,0 +1,67 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SubstanceDefinitionMolecularWeightSerializer = require('../backbone_elements/substanceDefinitionMolecularWeight.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SubstanceDefinitionRepresentationSerializer = require('../backbone_elements/substanceDefinitionRepresentation.js'); + +class SubstanceDefinitionStructureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + stereochemistry: (value) => CodeableConceptSerializer.serialize(value), + opticalActivity: (value) => CodeableConceptSerializer.serialize(value), + molecularFormula: null, + molecularFormulaByMoiety: null, + molecularWeight: (value) => SubstanceDefinitionMolecularWeightSerializer.serialize(value), + technique: (value) => CodeableConceptSerializer.serialize(value), + sourceDocument: (value) => ReferenceSerializer.serialize(value), + representation: (value) => SubstanceDefinitionRepresentationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionStructureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionStructureSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionStructureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionStructureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionStructureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceIngredient.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceIngredient.js new file mode 100644 index 000000000..456510924 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceIngredient.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SubstanceIngredientSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + quantity: (value) => RatioSerializer.serialize(value), + substanceCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + substanceReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceIngredientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceIngredientSerializer.propertyToSerializerMap) { + if (SubstanceIngredientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceIngredientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceIngredientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/substanceInstance.js b/src/fhir/serializers/4_0_0/backbone_elements/substanceInstance.js new file mode 100644 index 000000000..7d655cee5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/substanceInstance.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class SubstanceInstanceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + expiry: null, + quantity: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceInstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceInstanceSerializer.propertyToSerializerMap) { + if (SubstanceInstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceInstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceInstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/supplyDeliverySuppliedItem.js b/src/fhir/serializers/4_0_0/backbone_elements/supplyDeliverySuppliedItem.js new file mode 100644 index 000000000..73f3313ea --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/supplyDeliverySuppliedItem.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SupplyDeliverySuppliedItemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SupplyDeliverySuppliedItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SupplyDeliverySuppliedItemSerializer.propertyToSerializerMap) { + if (SupplyDeliverySuppliedItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SupplyDeliverySuppliedItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SupplyDeliverySuppliedItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/supplyRequestParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/supplyRequestParameter.js new file mode 100644 index 000000000..de877deb7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/supplyRequestParameter.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); + +class SupplyRequestParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueBoolean: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SupplyRequestParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SupplyRequestParameterSerializer.propertyToSerializerMap) { + if (SupplyRequestParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SupplyRequestParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SupplyRequestParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/taskInput.js b/src/fhir/serializers/4_0_0/backbone_elements/taskInput.js new file mode 100644 index 000000000..44b5a8191 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/taskInput.js @@ -0,0 +1,133 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MetaSerializer = require('../complex_types/meta.js'); + +class TaskInputSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueBase64Binary: null, + valueBoolean: null, + valueCanonical: null, + valueCode: null, + valueDate: null, + valueDateTime: null, + valueDecimal: null, + valueId: null, + valueInstant: null, + valueInteger: null, + valueMarkdown: null, + valueOid: null, + valuePositiveInt: null, + valueString: null, + valueTime: null, + valueUnsignedInt: null, + valueUri: null, + valueUrl: null, + valueUuid: null, + valueAddress: (value) => AddressSerializer.serialize(value), + valueAge: (value) => QuantitySerializer.serialize(value), + valueAnnotation: (value) => AnnotationSerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueContactPoint: (value) => ContactPointSerializer.serialize(value), + valueCount: (value) => QuantitySerializer.serialize(value), + valueDistance: (value) => QuantitySerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value), + valueHumanName: (value) => HumanNameSerializer.serialize(value), + valueIdentifier: (value) => IdentifierSerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueSignature: (value) => SignatureSerializer.serialize(value), + valueTiming: (value) => TimingSerializer.serialize(value), + valueContactDetail: (value) => ContactDetailSerializer.serialize(value), + valueContributor: (value) => ContributorSerializer.serialize(value), + valueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + valueExpression: (value) => ExpressionSerializer.serialize(value), + valueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + valueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + valueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + valueUsageContext: (value) => UsageContextSerializer.serialize(value), + valueDosage: (value) => DosageSerializer.serialize(value), + valueMeta: (value) => MetaSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TaskInputSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TaskInputSerializer.propertyToSerializerMap) { + if (TaskInputSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TaskInputSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TaskInputSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/taskOutput.js b/src/fhir/serializers/4_0_0/backbone_elements/taskOutput.js new file mode 100644 index 000000000..db55bc18c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/taskOutput.js @@ -0,0 +1,133 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MetaSerializer = require('../complex_types/meta.js'); + +class TaskOutputSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + valueBase64Binary: null, + valueBoolean: null, + valueCanonical: null, + valueCode: null, + valueDate: null, + valueDateTime: null, + valueDecimal: null, + valueId: null, + valueInstant: null, + valueInteger: null, + valueMarkdown: null, + valueOid: null, + valuePositiveInt: null, + valueString: null, + valueTime: null, + valueUnsignedInt: null, + valueUri: null, + valueUrl: null, + valueUuid: null, + valueAddress: (value) => AddressSerializer.serialize(value), + valueAge: (value) => QuantitySerializer.serialize(value), + valueAnnotation: (value) => AnnotationSerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueContactPoint: (value) => ContactPointSerializer.serialize(value), + valueCount: (value) => QuantitySerializer.serialize(value), + valueDistance: (value) => QuantitySerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value), + valueHumanName: (value) => HumanNameSerializer.serialize(value), + valueIdentifier: (value) => IdentifierSerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueSignature: (value) => SignatureSerializer.serialize(value), + valueTiming: (value) => TimingSerializer.serialize(value), + valueContactDetail: (value) => ContactDetailSerializer.serialize(value), + valueContributor: (value) => ContributorSerializer.serialize(value), + valueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + valueExpression: (value) => ExpressionSerializer.serialize(value), + valueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + valueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + valueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + valueUsageContext: (value) => UsageContextSerializer.serialize(value), + valueDosage: (value) => DosageSerializer.serialize(value), + valueMeta: (value) => MetaSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TaskOutputSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TaskOutputSerializer.propertyToSerializerMap) { + if (TaskOutputSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TaskOutputSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TaskOutputSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/taskRestriction.js b/src/fhir/serializers/4_0_0/backbone_elements/taskRestriction.js new file mode 100644 index 000000000..a59b21e9d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/taskRestriction.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class TaskRestrictionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + repetitions: null, + period: (value) => PeriodSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TaskRestrictionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TaskRestrictionSerializer.propertyToSerializerMap) { + if (TaskRestrictionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TaskRestrictionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TaskRestrictionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesClosure.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesClosure.js new file mode 100644 index 000000000..39de3724a --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesClosure.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesClosureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + translation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesClosureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesClosureSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesClosureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesClosureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesClosureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesCodeSystem.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesCodeSystem.js new file mode 100644 index 000000000..c2a470d84 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesCodeSystem.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TerminologyCapabilitiesVersionSerializer = require('../backbone_elements/terminologyCapabilitiesVersion.js'); + +class TerminologyCapabilitiesCodeSystemSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + uri: null, + version: (value) => TerminologyCapabilitiesVersionSerializer.serialize(value), + subsumption: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesCodeSystemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesCodeSystemSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesCodeSystemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesCodeSystemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesCodeSystemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesExpansion.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesExpansion.js new file mode 100644 index 000000000..5f4737065 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesExpansion.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TerminologyCapabilitiesParameterSerializer = require('../backbone_elements/terminologyCapabilitiesParameter.js'); + +class TerminologyCapabilitiesExpansionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + hierarchical: null, + paging: null, + incomplete: null, + parameter: (value) => TerminologyCapabilitiesParameterSerializer.serialize(value), + textFilter: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesExpansionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesExpansionSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesExpansionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesExpansionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesExpansionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesFilter.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesFilter.js new file mode 100644 index 000000000..844a29507 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesFilter.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesFilterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + op: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesFilterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesFilterSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesFilterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesFilterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesFilterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesImplementation.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesImplementation.js new file mode 100644 index 000000000..ae95560c0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesImplementation.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesImplementationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + description: null, + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesImplementationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesImplementationSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesImplementationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesImplementationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesImplementationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesParameter.js new file mode 100644 index 000000000..e85ac8b92 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesParameter.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + documentation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesParameterSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesSoftware.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesSoftware.js new file mode 100644 index 000000000..f08ecc7f3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesSoftware.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesSoftwareSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + version: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesSoftwareSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesSoftwareSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesSoftwareSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesSoftwareSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesSoftwareSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesTranslation.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesTranslation.js new file mode 100644 index 000000000..5ea13536b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesTranslation.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesTranslationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + needsMap: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesTranslationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesTranslationSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesTranslationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesTranslationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesTranslationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesValidateCode.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesValidateCode.js new file mode 100644 index 000000000..1fb830555 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesValidateCode.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TerminologyCapabilitiesValidateCodeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + translations: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesValidateCodeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesValidateCodeSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesValidateCodeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesValidateCodeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesValidateCodeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesVersion.js b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesVersion.js new file mode 100644 index 000000000..cf4ff318b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/terminologyCapabilitiesVersion.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TerminologyCapabilitiesFilterSerializer = require('../backbone_elements/terminologyCapabilitiesFilter.js'); + +class TerminologyCapabilitiesVersionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + isDefault: null, + compositional: null, + language: null, + filter: (value) => TerminologyCapabilitiesFilterSerializer.serialize(value), + property: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesVersionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesVersionSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesVersionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesVersionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesVersionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportAction.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction.js new file mode 100644 index 000000000..f639e5444 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportOperationSerializer = require('../backbone_elements/testReportOperation.js'); +const TestReportAssertSerializer = require('../backbone_elements/testReportAssert.js'); + +class TestReportActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestReportOperationSerializer.serialize(value), + assert: (value) => TestReportAssertSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportActionSerializer.propertyToSerializerMap) { + if (TestReportActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportAction1.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction1.js new file mode 100644 index 000000000..35e5cbf8e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction1.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportOperationSerializer = require('../backbone_elements/testReportOperation.js'); +const TestReportAssertSerializer = require('../backbone_elements/testReportAssert.js'); + +class TestReportAction1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestReportOperationSerializer.serialize(value), + assert: (value) => TestReportAssertSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportAction1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportAction1Serializer.propertyToSerializerMap) { + if (TestReportAction1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportAction1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportAction1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportAction2.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction2.js new file mode 100644 index 000000000..f15bf780d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportAction2.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportOperationSerializer = require('../backbone_elements/testReportOperation.js'); + +class TestReportAction2Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestReportOperationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportAction2Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportAction2Serializer.propertyToSerializerMap) { + if (TestReportAction2Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportAction2Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportAction2Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportAssert.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportAssert.js new file mode 100644 index 000000000..6549c27dd --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportAssert.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestReportAssertSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + result: null, + message: null, + detail: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportAssertSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportAssertSerializer.propertyToSerializerMap) { + if (TestReportAssertSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportAssertSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportAssertSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportOperation.js new file mode 100644 index 000000000..1cf6ab176 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportOperation.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestReportOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + result: null, + message: null, + detail: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportOperationSerializer.propertyToSerializerMap) { + if (TestReportOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportParticipant.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportParticipant.js new file mode 100644 index 000000000..ad566805d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportParticipant.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestReportParticipantSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: null, + uri: null, + display: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportParticipantSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportParticipantSerializer.propertyToSerializerMap) { + if (TestReportParticipantSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportParticipantSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportParticipantSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportSetup.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportSetup.js new file mode 100644 index 000000000..18392db27 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportSetup.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportActionSerializer = require('../backbone_elements/testReportAction.js'); + +class TestReportSetupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => TestReportActionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportSetupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportSetupSerializer.propertyToSerializerMap) { + if (TestReportSetupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportSetupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportSetupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportTeardown.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportTeardown.js new file mode 100644 index 000000000..b8bed9946 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportTeardown.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportAction2Serializer = require('../backbone_elements/testReportAction2.js'); + +class TestReportTeardownSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => TestReportAction2Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportTeardownSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportTeardownSerializer.propertyToSerializerMap) { + if (TestReportTeardownSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportTeardownSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportTeardownSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testReportTest.js b/src/fhir/serializers/4_0_0/backbone_elements/testReportTest.js new file mode 100644 index 000000000..46eb7866d --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testReportTest.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestReportAction1Serializer = require('../backbone_elements/testReportAction1.js'); + +class TestReportTestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + description: null, + action: (value) => TestReportAction1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportTestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportTestSerializer.propertyToSerializerMap) { + if (TestReportTestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportTestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportTestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction.js new file mode 100644 index 000000000..9630afd7b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptOperationSerializer = require('../backbone_elements/testScriptOperation.js'); +const TestScriptAssertSerializer = require('../backbone_elements/testScriptAssert.js'); + +class TestScriptActionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestScriptOperationSerializer.serialize(value), + assert: (value) => TestScriptAssertSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptActionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptActionSerializer.propertyToSerializerMap) { + if (TestScriptActionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptActionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptActionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction1.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction1.js new file mode 100644 index 000000000..215bfbbaf --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction1.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptOperationSerializer = require('../backbone_elements/testScriptOperation.js'); +const TestScriptAssertSerializer = require('../backbone_elements/testScriptAssert.js'); + +class TestScriptAction1Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestScriptOperationSerializer.serialize(value), + assert: (value) => TestScriptAssertSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptAction1Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptAction1Serializer.propertyToSerializerMap) { + if (TestScriptAction1Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptAction1Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptAction1Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction2.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction2.js new file mode 100644 index 000000000..e6d8cd780 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAction2.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptOperationSerializer = require('../backbone_elements/testScriptOperation.js'); + +class TestScriptAction2Serializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + operation: (value) => TestScriptOperationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptAction2Serializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptAction2Serializer.propertyToSerializerMap) { + if (TestScriptAction2Serializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptAction2Serializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptAction2Serializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptAssert.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAssert.js new file mode 100644 index 000000000..60f9e1f4e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptAssert.js @@ -0,0 +1,77 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestScriptAssertSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + label: null, + description: null, + direction: null, + compareToSourceId: null, + compareToSourceExpression: null, + compareToSourcePath: null, + contentType: null, + expression: null, + headerField: null, + minimumId: null, + navigationLinks: null, + operator: null, + path: null, + requestMethod: null, + requestURL: null, + resource: null, + response: null, + responseCode: null, + sourceId: null, + validateProfileId: null, + value: null, + warningOnly: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptAssertSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptAssertSerializer.propertyToSerializerMap) { + if (TestScriptAssertSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptAssertSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptAssertSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptCapability.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptCapability.js new file mode 100644 index 000000000..32a27791b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptCapability.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestScriptCapabilitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + required: null, + validated: null, + description: null, + origin: null, + destination: null, + link: null, + capabilities: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptCapabilitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptCapabilitySerializer.propertyToSerializerMap) { + if (TestScriptCapabilitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptCapabilitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptCapabilitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptDestination.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptDestination.js new file mode 100644 index 000000000..928cb853f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptDestination.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class TestScriptDestinationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + index: null, + profile: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptDestinationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptDestinationSerializer.propertyToSerializerMap) { + if (TestScriptDestinationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptDestinationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptDestinationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptFixture.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptFixture.js new file mode 100644 index 000000000..f60139114 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptFixture.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class TestScriptFixtureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + autocreate: null, + autodelete: null, + resource: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptFixtureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptFixtureSerializer.propertyToSerializerMap) { + if (TestScriptFixtureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptFixtureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptFixtureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptLink.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptLink.js new file mode 100644 index 000000000..bcd767025 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptLink.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestScriptLinkSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + description: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptLinkSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptLinkSerializer.propertyToSerializerMap) { + if (TestScriptLinkSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptLinkSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptLinkSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptMetadata.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptMetadata.js new file mode 100644 index 000000000..c79885851 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptMetadata.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptLinkSerializer = require('../backbone_elements/testScriptLink.js'); +const TestScriptCapabilitySerializer = require('../backbone_elements/testScriptCapability.js'); + +class TestScriptMetadataSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + link: (value) => TestScriptLinkSerializer.serialize(value), + capability: (value) => TestScriptCapabilitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptMetadataSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptMetadataSerializer.propertyToSerializerMap) { + if (TestScriptMetadataSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptMetadataSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptMetadataSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptOperation.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptOperation.js new file mode 100644 index 000000000..80164ca14 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptOperation.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const TestScriptRequestHeaderSerializer = require('../backbone_elements/testScriptRequestHeader.js'); + +class TestScriptOperationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value), + resource: null, + label: null, + description: null, + accept: null, + contentType: null, + destination: null, + encodeRequestUrl: null, + method: null, + origin: null, + params: null, + requestHeader: (value) => TestScriptRequestHeaderSerializer.serialize(value), + requestId: null, + responseId: null, + sourceId: null, + targetId: null, + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptOperationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptOperationSerializer.propertyToSerializerMap) { + if (TestScriptOperationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptOperationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptOperationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptOrigin.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptOrigin.js new file mode 100644 index 000000000..0dc07956e --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptOrigin.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class TestScriptOriginSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + index: null, + profile: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptOriginSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptOriginSerializer.propertyToSerializerMap) { + if (TestScriptOriginSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptOriginSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptOriginSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptRequestHeader.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptRequestHeader.js new file mode 100644 index 000000000..21d44bea2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptRequestHeader.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestScriptRequestHeaderSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + field: null, + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptRequestHeaderSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptRequestHeaderSerializer.propertyToSerializerMap) { + if (TestScriptRequestHeaderSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptRequestHeaderSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptRequestHeaderSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptSetup.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptSetup.js new file mode 100644 index 000000000..af9f8f884 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptSetup.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptActionSerializer = require('../backbone_elements/testScriptAction.js'); + +class TestScriptSetupSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => TestScriptActionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptSetupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptSetupSerializer.propertyToSerializerMap) { + if (TestScriptSetupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptSetupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptSetupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptTeardown.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptTeardown.js new file mode 100644 index 000000000..0babbbd8c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptTeardown.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptAction2Serializer = require('../backbone_elements/testScriptAction2.js'); + +class TestScriptTeardownSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + action: (value) => TestScriptAction2Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptTeardownSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptTeardownSerializer.propertyToSerializerMap) { + if (TestScriptTeardownSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptTeardownSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptTeardownSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptTest.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptTest.js new file mode 100644 index 000000000..6b5ec4b45 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptTest.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TestScriptAction1Serializer = require('../backbone_elements/testScriptAction1.js'); + +class TestScriptTestSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + description: null, + action: (value) => TestScriptAction1Serializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptTestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptTestSerializer.propertyToSerializerMap) { + if (TestScriptTestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptTestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptTestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/testScriptVariable.js b/src/fhir/serializers/4_0_0/backbone_elements/testScriptVariable.js new file mode 100644 index 000000000..c64df0546 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/testScriptVariable.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class TestScriptVariableSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + defaultValue: null, + description: null, + expression: null, + headerField: null, + hint: null, + path: null, + sourceId: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptVariableSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptVariableSerializer.propertyToSerializerMap) { + if (TestScriptVariableSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptVariableSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptVariableSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/timing.js b/src/fhir/serializers/4_0_0/backbone_elements/timing.js new file mode 100644 index 000000000..23bd89ef9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/timing.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TimingRepeatSerializer = require('../backbone_elements/timingRepeat.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class TimingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + event: null, + repeat: (value) => TimingRepeatSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TimingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TimingSerializer.propertyToSerializerMap) { + if (TimingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TimingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TimingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/timingRepeat.js b/src/fhir/serializers/4_0_0/backbone_elements/timingRepeat.js new file mode 100644 index 000000000..f39c43328 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/timingRepeat.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class TimingRepeatSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + boundsDuration: (value) => QuantitySerializer.serialize(value), + boundsRange: (value) => RangeSerializer.serialize(value), + boundsPeriod: (value) => PeriodSerializer.serialize(value), + count: null, + countMax: null, + duration: null, + durationMax: null, + durationUnit: null, + frequency: null, + frequencyMax: null, + period: null, + periodMax: null, + periodUnit: null, + dayOfWeek: null, + timeOfDay: null, + when: null, + offset: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TimingRepeatSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TimingRepeatSerializer.propertyToSerializerMap) { + if (TimingRepeatSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TimingRepeatSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TimingRepeatSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetCompose.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetCompose.js new file mode 100644 index 000000000..ae2b17c6c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetCompose.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ValueSetIncludeSerializer = require('../backbone_elements/valueSetInclude.js'); + +class ValueSetComposeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + lockedDate: null, + inactive: null, + include: (value) => ValueSetIncludeSerializer.serialize(value), + exclude: (value) => ValueSetIncludeSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetComposeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetComposeSerializer.propertyToSerializerMap) { + if (ValueSetComposeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetComposeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetComposeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetConcept.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetConcept.js new file mode 100644 index 000000000..60dd70eb2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetConcept.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ValueSetDesignationSerializer = require('../backbone_elements/valueSetDesignation.js'); + +class ValueSetConceptSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: null, + display: null, + designation: (value) => ValueSetDesignationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetConceptSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetConceptSerializer.propertyToSerializerMap) { + if (ValueSetConceptSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetConceptSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetConceptSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetContains.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetContains.js new file mode 100644 index 000000000..db302f64f --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetContains.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ValueSetDesignationSerializer = require('../backbone_elements/valueSetDesignation.js'); + +class ValueSetContainsSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + system: null, + abstract: null, + inactive: null, + version: null, + code: null, + display: null, + designation: (value) => ValueSetDesignationSerializer.serialize(value), + contains: (value) => ValueSetContainsSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetContainsSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetContainsSerializer.propertyToSerializerMap) { + if (ValueSetContainsSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetContainsSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetContainsSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetDesignation.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetDesignation.js new file mode 100644 index 000000000..dff9cae4b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetDesignation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class ValueSetDesignationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + language: null, + use: (value) => CodingSerializer.serialize(value), + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetDesignationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetDesignationSerializer.propertyToSerializerMap) { + if (ValueSetDesignationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetDesignationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetDesignationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetExpansion.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetExpansion.js new file mode 100644 index 000000000..68aabcb71 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetExpansion.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ValueSetParameterSerializer = require('../backbone_elements/valueSetParameter.js'); +const ValueSetContainsSerializer = require('../backbone_elements/valueSetContains.js'); + +class ValueSetExpansionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: null, + timestamp: null, + total: null, + offset: null, + parameter: (value) => ValueSetParameterSerializer.serialize(value), + contains: (value) => ValueSetContainsSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetExpansionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetExpansionSerializer.propertyToSerializerMap) { + if (ValueSetExpansionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetExpansionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetExpansionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetFilter.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetFilter.js new file mode 100644 index 000000000..ff107f72b --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetFilter.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ValueSetFilterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + property: null, + op: null, + value: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetFilterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetFilterSerializer.propertyToSerializerMap) { + if (ValueSetFilterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetFilterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetFilterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetInclude.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetInclude.js new file mode 100644 index 000000000..b25169570 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetInclude.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ValueSetConceptSerializer = require('../backbone_elements/valueSetConcept.js'); +const ValueSetFilterSerializer = require('../backbone_elements/valueSetFilter.js'); + +class ValueSetIncludeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + system: null, + version: null, + concept: (value) => ValueSetConceptSerializer.serialize(value), + filter: (value) => ValueSetFilterSerializer.serialize(value), + valueSet: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetIncludeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetIncludeSerializer.propertyToSerializerMap) { + if (ValueSetIncludeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetIncludeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetIncludeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/valueSetParameter.js b/src/fhir/serializers/4_0_0/backbone_elements/valueSetParameter.js new file mode 100644 index 000000000..100e4a541 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/valueSetParameter.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ValueSetParameterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + valueString: null, + valueBoolean: null, + valueInteger: null, + valueDecimal: null, + valueUri: null, + valueCode: null, + valueDateTime: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetParameterSerializer.propertyToSerializerMap) { + if (ValueSetParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/verificationResultAttestation.js b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultAttestation.js new file mode 100644 index 000000000..654b245e4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultAttestation.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SignatureSerializer = require('../complex_types/signature.js'); + +class VerificationResultAttestationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + who: (value) => ReferenceSerializer.serialize(value), + onBehalfOf: (value) => ReferenceSerializer.serialize(value), + communicationMethod: (value) => CodeableConceptSerializer.serialize(value), + date: null, + sourceIdentityCertificate: null, + proxyIdentityCertificate: null, + proxySignature: (value) => SignatureSerializer.serialize(value), + sourceSignature: (value) => SignatureSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VerificationResultAttestationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VerificationResultAttestationSerializer.propertyToSerializerMap) { + if (VerificationResultAttestationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VerificationResultAttestationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VerificationResultAttestationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/verificationResultPrimarySource.js b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultPrimarySource.js new file mode 100644 index 000000000..73fa0b86c --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultPrimarySource.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class VerificationResultPrimarySourceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + who: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + communicationMethod: (value) => CodeableConceptSerializer.serialize(value), + validationStatus: (value) => CodeableConceptSerializer.serialize(value), + validationDate: null, + canPushUpdates: (value) => CodeableConceptSerializer.serialize(value), + pushTypeAvailable: (value) => CodeableConceptSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VerificationResultPrimarySourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VerificationResultPrimarySourceSerializer.propertyToSerializerMap) { + if (VerificationResultPrimarySourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VerificationResultPrimarySourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VerificationResultPrimarySourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/verificationResultValidator.js b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultValidator.js new file mode 100644 index 000000000..3c4adb5c4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/verificationResultValidator.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SignatureSerializer = require('../complex_types/signature.js'); + +class VerificationResultValidatorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + identityCertificate: null, + attestationSignature: (value) => SignatureSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VerificationResultValidatorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VerificationResultValidatorSerializer.propertyToSerializerMap) { + if (VerificationResultValidatorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VerificationResultValidatorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VerificationResultValidatorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionLensSpecification.js b/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionLensSpecification.js new file mode 100644 index 000000000..63d9778bc --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionLensSpecification.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const VisionPrescriptionPrismSerializer = require('../backbone_elements/visionPrescriptionPrism.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class VisionPrescriptionLensSpecificationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + product: (value) => CodeableConceptSerializer.serialize(value), + eye: null, + sphere: null, + cylinder: null, + axis: null, + prism: (value) => VisionPrescriptionPrismSerializer.serialize(value), + add: null, + power: null, + backCurve: null, + diameter: null, + duration: (value) => QuantitySerializer.serialize(value), + color: null, + brand: null, + note: (value) => AnnotationSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VisionPrescriptionLensSpecificationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VisionPrescriptionLensSpecificationSerializer.propertyToSerializerMap) { + if (VisionPrescriptionLensSpecificationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VisionPrescriptionLensSpecificationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VisionPrescriptionLensSpecificationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionPrism.js b/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionPrism.js new file mode 100644 index 000000000..74fc88677 --- /dev/null +++ b/src/fhir/serializers/4_0_0/backbone_elements/visionPrescriptionPrism.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class VisionPrescriptionPrismSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + amount: null, + base: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VisionPrescriptionPrismSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VisionPrescriptionPrismSerializer.propertyToSerializerMap) { + if (VisionPrescriptionPrismSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VisionPrescriptionPrismSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VisionPrescriptionPrismSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/address.js b/src/fhir/serializers/4_0_0/complex_types/address.js new file mode 100644 index 000000000..5039fce05 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/address.js @@ -0,0 +1,65 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class AddressSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + use: null, + type: null, + text: null, + line: null, + city: null, + district: null, + state: null, + postalCode: null, + country: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AddressSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AddressSerializer.propertyToSerializerMap) { + if (AddressSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AddressSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AddressSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/age.js b/src/fhir/serializers/4_0_0/complex_types/age.js new file mode 100644 index 000000000..ea30c5463 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/age.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + + +class AgeSerializer { + static propertyToSerializerMap = { + value: null, + comparator: null, + unit: null, + system: null, + code: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AgeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AgeSerializer.propertyToSerializerMap) { + if (AgeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AgeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AgeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/annotation.js b/src/fhir/serializers/4_0_0/complex_types/annotation.js new file mode 100644 index 000000000..c314bf035 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/annotation.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class AnnotationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + authorReference: (value) => ReferenceSerializer.serialize(value), + authorString: null, + time: null, + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AnnotationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AnnotationSerializer.propertyToSerializerMap) { + if (AnnotationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AnnotationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AnnotationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/attachment.js b/src/fhir/serializers/4_0_0/complex_types/attachment.js new file mode 100644 index 000000000..f930c3062 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/attachment.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class AttachmentSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + contentType: null, + language: null, + data: null, + url: null, + size: null, + hash: null, + title: null, + creation: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AttachmentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AttachmentSerializer.propertyToSerializerMap) { + if (AttachmentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AttachmentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AttachmentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/backboneElement.js b/src/fhir/serializers/4_0_0/complex_types/backboneElement.js new file mode 100644 index 000000000..56d11e5e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/backboneElement.js @@ -0,0 +1,55 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class BackboneElementSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BackboneElementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BackboneElementSerializer.propertyToSerializerMap) { + if (BackboneElementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BackboneElementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BackboneElementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/codeableConcept.js b/src/fhir/serializers/4_0_0/complex_types/codeableConcept.js new file mode 100644 index 000000000..61a847965 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/codeableConcept.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class CodeableConceptSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + coding: (value) => CodingSerializer.serialize(value), + text: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeableConceptSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeableConceptSerializer.propertyToSerializerMap) { + if (CodeableConceptSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeableConceptSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeableConceptSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/codeableReference.js b/src/fhir/serializers/4_0_0/complex_types/codeableReference.js new file mode 100644 index 000000000..9f8128bac --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/codeableReference.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class CodeableReferenceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + concept: (value) => CodeableConceptSerializer.serialize(value), + reference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeableReferenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeableReferenceSerializer.propertyToSerializerMap) { + if (CodeableReferenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeableReferenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeableReferenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/coding.js b/src/fhir/serializers/4_0_0/complex_types/coding.js new file mode 100644 index 000000000..c99b5c1ba --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/coding.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class CodingSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + system: null, + version: null, + code: null, + display: null, + userSelected: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodingSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodingSerializer.propertyToSerializerMap) { + if (CodingSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodingSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodingSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/contactDetail.js b/src/fhir/serializers/4_0_0/complex_types/contactDetail.js new file mode 100644 index 000000000..258eb5412 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/contactDetail.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); + +class ContactDetailSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + name: null, + telecom: (value) => ContactPointSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContactDetailSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContactDetailSerializer.propertyToSerializerMap) { + if (ContactDetailSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContactDetailSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContactDetailSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/contactPoint.js b/src/fhir/serializers/4_0_0/complex_types/contactPoint.js new file mode 100644 index 000000000..ab9820093 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/contactPoint.js @@ -0,0 +1,60 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class ContactPointSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + system: null, + value: null, + use: null, + rank: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContactPointSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContactPointSerializer.propertyToSerializerMap) { + if (ContactPointSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContactPointSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContactPointSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/contributor.js b/src/fhir/serializers/4_0_0/complex_types/contributor.js new file mode 100644 index 000000000..4d63b8aed --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/contributor.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); + +class ContributorSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + type: null, + name: null, + contact: (value) => ContactDetailSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContributorSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContributorSerializer.propertyToSerializerMap) { + if (ContributorSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContributorSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContributorSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/count.js b/src/fhir/serializers/4_0_0/complex_types/count.js new file mode 100644 index 000000000..6fc5ff6e2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/count.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + + +class CountSerializer { + static propertyToSerializerMap = { + value: null, + comparator: null, + unit: null, + system: null, + code: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CountSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CountSerializer.propertyToSerializerMap) { + if (CountSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CountSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CountSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/dataRequirement.js b/src/fhir/serializers/4_0_0/complex_types/dataRequirement.js new file mode 100644 index 000000000..69982df4c --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/dataRequirement.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DataRequirementCodeFilterSerializer = require('../complex_types/dataRequirementCodeFilter.js'); +const DataRequirementDateFilterSerializer = require('../complex_types/dataRequirementDateFilter.js'); +const DataRequirementSortSerializer = require('../complex_types/dataRequirementSort.js'); + +class DataRequirementSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + type: null, + profile: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + mustSupport: null, + codeFilter: (value) => DataRequirementCodeFilterSerializer.serialize(value), + dateFilter: (value) => DataRequirementDateFilterSerializer.serialize(value), + limit: null, + sort: (value) => DataRequirementSortSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DataRequirementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DataRequirementSerializer.propertyToSerializerMap) { + if (DataRequirementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DataRequirementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DataRequirementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/dataRequirementCodeFilter.js b/src/fhir/serializers/4_0_0/complex_types/dataRequirementCodeFilter.js new file mode 100644 index 000000000..02d32feb7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/dataRequirementCodeFilter.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class DataRequirementCodeFilterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + path: null, + searchParam: null, + valueSet: null, + code: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DataRequirementCodeFilterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DataRequirementCodeFilterSerializer.propertyToSerializerMap) { + if (DataRequirementCodeFilterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DataRequirementCodeFilterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DataRequirementCodeFilterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/dataRequirementDateFilter.js b/src/fhir/serializers/4_0_0/complex_types/dataRequirementDateFilter.js new file mode 100644 index 000000000..e1b39e1cb --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/dataRequirementDateFilter.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class DataRequirementDateFilterSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + path: null, + searchParam: null, + valueDateTime: null, + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DataRequirementDateFilterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DataRequirementDateFilterSerializer.propertyToSerializerMap) { + if (DataRequirementDateFilterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DataRequirementDateFilterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DataRequirementDateFilterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/dataRequirementSort.js b/src/fhir/serializers/4_0_0/complex_types/dataRequirementSort.js new file mode 100644 index 000000000..cf762cdd2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/dataRequirementSort.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DataRequirementSortSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + path: null, + direction: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DataRequirementSortSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DataRequirementSortSerializer.propertyToSerializerMap) { + if (DataRequirementSortSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DataRequirementSortSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DataRequirementSortSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/distance.js b/src/fhir/serializers/4_0_0/complex_types/distance.js new file mode 100644 index 000000000..4d85ffd88 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/distance.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + + +class DistanceSerializer { + static propertyToSerializerMap = { + value: null, + comparator: null, + unit: null, + system: null, + code: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DistanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DistanceSerializer.propertyToSerializerMap) { + if (DistanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DistanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DistanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/duration.js b/src/fhir/serializers/4_0_0/complex_types/duration.js new file mode 100644 index 000000000..5c49f75bf --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/duration.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DurationSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + value: null, + comparator: null, + unit: null, + system: null, + code: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DurationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DurationSerializer.propertyToSerializerMap) { + if (DurationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DurationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DurationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/element.js b/src/fhir/serializers/4_0_0/complex_types/element.js new file mode 100644 index 000000000..a7bc4de38 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/element.js @@ -0,0 +1,54 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ElementSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ElementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ElementSerializer.propertyToSerializerMap) { + if (ElementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ElementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ElementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/expression.js b/src/fhir/serializers/4_0_0/complex_types/expression.js new file mode 100644 index 000000000..f8efb9183 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/expression.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ExpressionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + description: null, + name: null, + language: null, + expression: null, + reference: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExpressionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExpressionSerializer.propertyToSerializerMap) { + if (ExpressionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExpressionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExpressionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/extension.js b/src/fhir/serializers/4_0_0/complex_types/extension.js new file mode 100644 index 000000000..ada578a2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/extension.js @@ -0,0 +1,133 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const AddressSerializer = require('../complex_types/address.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RatioRangeSerializer = require('../complex_types/ratioRange.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const SignatureSerializer = require('../complex_types/signature.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const ContributorSerializer = require('../complex_types/contributor.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); + +class ExtensionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + url: null, + valueBase64Binary: null, + valueBoolean: null, + valueCanonical: null, + valueCode: null, + valueDate: null, + valueDateTime: null, + valueDecimal: null, + valueId: null, + valueInstant: null, + valueInteger: null, + valueMarkdown: null, + valueOid: null, + valuePositiveInt: null, + valueString: null, + valueTime: null, + valueUnsignedInt: null, + valueUri: null, + valueUrl: null, + valueUuid: null, + valueAddress: (value) => AddressSerializer.serialize(value), + valueAge: (value) => QuantitySerializer.serialize(value), + valueAnnotation: (value) => AnnotationSerializer.serialize(value), + valueAttachment: (value) => AttachmentSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueCodeableReference: (value) => CodeableReferenceSerializer.serialize(value), + valueCoding: (value) => CodingSerializer.serialize(value), + valueContactPoint: (value) => ContactPointSerializer.serialize(value), + valueCount: (value) => QuantitySerializer.serialize(value), + valueDistance: (value) => QuantitySerializer.serialize(value), + valueDuration: (value) => QuantitySerializer.serialize(value), + valueHumanName: (value) => HumanNameSerializer.serialize(value), + valueIdentifier: (value) => IdentifierSerializer.serialize(value), + valueMoney: (value) => MoneySerializer.serialize(value), + valuePeriod: (value) => PeriodSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueRatioRange: (value) => RatioRangeSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueSignature: (value) => SignatureSerializer.serialize(value), + valueTiming: (value) => TimingSerializer.serialize(value), + valueContactDetail: (value) => ContactDetailSerializer.serialize(value), + valueContributor: (value) => ContributorSerializer.serialize(value), + valueDataRequirement: (value) => DataRequirementSerializer.serialize(value), + valueExpression: (value) => ExpressionSerializer.serialize(value), + valueParameterDefinition: (value) => ParameterDefinitionSerializer.serialize(value), + valueRelatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + valueTriggerDefinition: (value) => TriggerDefinitionSerializer.serialize(value), + valueUsageContext: (value) => UsageContextSerializer.serialize(value), + valueDosage: (value) => DosageSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExtensionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExtensionSerializer.propertyToSerializerMap) { + if (ExtensionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExtensionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExtensionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/humanName.js b/src/fhir/serializers/4_0_0/complex_types/humanName.js new file mode 100644 index 000000000..8476a1959 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/humanName.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class HumanNameSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + use: null, + text: null, + family: null, + given: null, + prefix: null, + suffix: null, + period: (value) => PeriodSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => HumanNameSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in HumanNameSerializer.propertyToSerializerMap) { + if (HumanNameSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = HumanNameSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = HumanNameSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/identifier.js b/src/fhir/serializers/4_0_0/complex_types/identifier.js new file mode 100644 index 000000000..c666ce2fc --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/identifier.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class IdentifierSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + use: null, + type: (value) => CodeableConceptSerializer.serialize(value), + system: null, + value: null, + period: (value) => PeriodSerializer.serialize(value), + assigner: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IdentifierSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IdentifierSerializer.propertyToSerializerMap) { + if (IdentifierSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IdentifierSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IdentifierSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/index.js b/src/fhir/serializers/4_0_0/complex_types/index.js new file mode 100644 index 000000000..4a627d810 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/index.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const extensionSerializer = require('./extension'); +const backboneelementSerializer = require('./backboneElement'); +const narrativeSerializer = require('./narrative'); +const elementSerializer = require('./element'); +const metaSerializer = require('./meta'); +const addressSerializer = require('./address'); +const contributorSerializer = require('./contributor'); +const attachmentSerializer = require('./attachment'); +const datarequirementSerializer = require('./dataRequirement'); +const datarequirementcodefilterSerializer = require('./dataRequirementCodeFilter'); +const datarequirementdatefilterSerializer = require('./dataRequirementDateFilter'); +const datarequirementsortSerializer = require('./dataRequirementSort'); +const moneySerializer = require('./money'); +const humannameSerializer = require('./humanName'); +const contactpointSerializer = require('./contactPoint'); +const identifierSerializer = require('./identifier'); +const ratiorangeSerializer = require('./ratioRange'); +const codingSerializer = require('./coding'); +const sampleddataSerializer = require('./sampledData'); +const ratioSerializer = require('./ratio'); +const referenceSerializer = require('./reference'); +const triggerdefinitionSerializer = require('./triggerDefinition'); +const quantitySerializer = require('./quantity'); +const periodSerializer = require('./period'); +const rangeSerializer = require('./range'); +const relatedartifactSerializer = require('./relatedArtifact'); +const annotationSerializer = require('./annotation'); +const contactdetailSerializer = require('./contactDetail'); +const usagecontextSerializer = require('./usageContext'); +const expressionSerializer = require('./expression'); +const codeablereferenceSerializer = require('./codeableReference'); +const signatureSerializer = require('./signature'); +const codeableconceptSerializer = require('./codeableConcept'); +const parameterdefinitionSerializer = require('./parameterDefinition'); + +module.exports = { + extensionSerializer, + backboneelementSerializer, + narrativeSerializer, + elementSerializer, + metaSerializer, + addressSerializer, + contributorSerializer, + attachmentSerializer, + datarequirementSerializer, + datarequirementcodefilterSerializer, + datarequirementdatefilterSerializer, + datarequirementsortSerializer, + moneySerializer, + humannameSerializer, + contactpointSerializer, + identifierSerializer, + ratiorangeSerializer, + codingSerializer, + sampleddataSerializer, + ratioSerializer, + referenceSerializer, + triggerdefinitionSerializer, + quantitySerializer, + periodSerializer, + rangeSerializer, + relatedartifactSerializer, + annotationSerializer, + contactdetailSerializer, + usagecontextSerializer, + expressionSerializer, + codeablereferenceSerializer, + signatureSerializer, + codeableconceptSerializer, + parameterdefinitionSerializer +}; + diff --git a/src/fhir/serializers/4_0_0/complex_types/meta.js b/src/fhir/serializers/4_0_0/complex_types/meta.js new file mode 100644 index 000000000..933b659a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/meta.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); + +class MetaSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + versionId: null, + lastUpdated: null, + source: null, + profile: null, + security: (value) => CodingSerializer.serialize(value), + tag: (value) => CodingSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MetaSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MetaSerializer.propertyToSerializerMap) { + if (MetaSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MetaSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MetaSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/money.js b/src/fhir/serializers/4_0_0/complex_types/money.js new file mode 100644 index 000000000..71726b21c --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/money.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class MoneySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + value: null, + currency: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MoneySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MoneySerializer.propertyToSerializerMap) { + if (MoneySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MoneySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MoneySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/narrative.js b/src/fhir/serializers/4_0_0/complex_types/narrative.js new file mode 100644 index 000000000..ac9c9c8e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/narrative.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class NarrativeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + status: null, + div: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NarrativeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NarrativeSerializer.propertyToSerializerMap) { + if (NarrativeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NarrativeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NarrativeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/parameterDefinition.js b/src/fhir/serializers/4_0_0/complex_types/parameterDefinition.js new file mode 100644 index 000000000..6fcedbe6d --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/parameterDefinition.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class ParameterDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + name: null, + use: null, + min: null, + max: null, + documentation: null, + type: null, + profile: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ParameterDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ParameterDefinitionSerializer.propertyToSerializerMap) { + if (ParameterDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ParameterDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ParameterDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/period.js b/src/fhir/serializers/4_0_0/complex_types/period.js new file mode 100644 index 000000000..c77cb89a7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/period.js @@ -0,0 +1,56 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class PeriodSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + start: null, + end: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PeriodSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PeriodSerializer.propertyToSerializerMap) { + if (PeriodSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PeriodSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PeriodSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/quantity.js b/src/fhir/serializers/4_0_0/complex_types/quantity.js new file mode 100644 index 000000000..84d02d07c --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/quantity.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); + +class QuantitySerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + value: null, + comparator: null, + unit: null, + system: null, + code: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuantitySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuantitySerializer.propertyToSerializerMap) { + if (QuantitySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuantitySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuantitySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/range.js b/src/fhir/serializers/4_0_0/complex_types/range.js new file mode 100644 index 000000000..298a1d3b2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/range.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class RangeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + low: (value) => QuantitySerializer.serialize(value), + high: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RangeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RangeSerializer.propertyToSerializerMap) { + if (RangeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RangeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RangeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/ratio.js b/src/fhir/serializers/4_0_0/complex_types/ratio.js new file mode 100644 index 000000000..05672a4d8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/ratio.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class RatioSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + numerator: (value) => QuantitySerializer.serialize(value), + denominator: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RatioSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RatioSerializer.propertyToSerializerMap) { + if (RatioSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RatioSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RatioSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/ratioRange.js b/src/fhir/serializers/4_0_0/complex_types/ratioRange.js new file mode 100644 index 000000000..7b1de5fc1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/ratioRange.js @@ -0,0 +1,58 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class RatioRangeSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + lowNumerator: (value) => QuantitySerializer.serialize(value), + highNumerator: (value) => QuantitySerializer.serialize(value), + denominator: (value) => QuantitySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RatioRangeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RatioRangeSerializer.propertyToSerializerMap) { + if (RatioRangeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RatioRangeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RatioRangeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/reference.js b/src/fhir/serializers/4_0_0/complex_types/reference.js new file mode 100644 index 000000000..5bead3293 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/reference.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); + +class ReferenceSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + reference: null, + type: null, + identifier: (value) => IdentifierSerializer.serialize(value), + display: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ReferenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ReferenceSerializer.propertyToSerializerMap) { + if (ReferenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ReferenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ReferenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/relatedArtifact.js b/src/fhir/serializers/4_0_0/complex_types/relatedArtifact.js new file mode 100644 index 000000000..b2825a62b --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/relatedArtifact.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class RelatedArtifactSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + type: null, + label: null, + display: null, + citation: null, + url: null, + document: (value) => AttachmentSerializer.serialize(value), + resource: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RelatedArtifactSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RelatedArtifactSerializer.propertyToSerializerMap) { + if (RelatedArtifactSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RelatedArtifactSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RelatedArtifactSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/sampledData.js b/src/fhir/serializers/4_0_0/complex_types/sampledData.js new file mode 100644 index 000000000..41339eaf8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/sampledData.js @@ -0,0 +1,62 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); + +class SampledDataSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + origin: (value) => QuantitySerializer.serialize(value), + period: null, + factor: null, + lowerLimit: null, + upperLimit: null, + dimensions: null, + data: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SampledDataSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SampledDataSerializer.propertyToSerializerMap) { + if (SampledDataSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SampledDataSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SampledDataSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/signature.js b/src/fhir/serializers/4_0_0/complex_types/signature.js new file mode 100644 index 000000000..9540484a6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/signature.js @@ -0,0 +1,63 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SignatureSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value), + when: null, + who: (value) => ReferenceSerializer.serialize(value), + onBehalfOf: (value) => ReferenceSerializer.serialize(value), + targetFormat: null, + sigFormat: null, + data: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SignatureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SignatureSerializer.propertyToSerializerMap) { + if (SignatureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SignatureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SignatureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/triggerDefinition.js b/src/fhir/serializers/4_0_0/complex_types/triggerDefinition.js new file mode 100644 index 000000000..ee5685be5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/triggerDefinition.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const ExpressionSerializer = require('../complex_types/expression.js'); + +class TriggerDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + type: null, + name: null, + timingTiming: (value) => TimingSerializer.serialize(value), + timingReference: (value) => ReferenceSerializer.serialize(value), + timingDate: null, + timingDateTime: null, + data: (value) => DataRequirementSerializer.serialize(value), + condition: (value) => ExpressionSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TriggerDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TriggerDefinitionSerializer.propertyToSerializerMap) { + if (TriggerDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TriggerDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TriggerDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/complex_types/usageContext.js b/src/fhir/serializers/4_0_0/complex_types/usageContext.js new file mode 100644 index 000000000..317b2a975 --- /dev/null +++ b/src/fhir/serializers/4_0_0/complex_types/usageContext.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class UsageContextSerializer { + static propertyToSerializerMap = { + id: null, + extension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodingSerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueRange: (value) => RangeSerializer.serialize(value), + valueReference: (value) => ReferenceSerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => UsageContextSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in UsageContextSerializer.propertyToSerializerMap) { + if (UsageContextSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = UsageContextSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = UsageContextSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/custom_resources/exportStatus.js b/src/fhir/serializers/4_0_0/custom_resources/exportStatus.js new file mode 100644 index 000000000..3d776ae99 --- /dev/null +++ b/src/fhir/serializers/4_0_0/custom_resources/exportStatus.js @@ -0,0 +1,66 @@ +const MetaSerializer = require('../complex_types/meta.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ExportStatusEntrySerializer = require('./exportStatusEntry.js'); + +class ExportStatusSerialzer { + static propertyToSerializerMap = { + id: null, + resourceType: null, + meta: (value) => MetaSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + status: null, + requestUrl: null, + requiresAccessToken: null, + scope: null, + user: null, + transactionTime: null, + output: (value) => ExportStatusEntrySerializer.serialize(value), + errors: (value) => ExportStatusEntrySerializer.serialize(value) + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExportStatusSerialzer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExportStatusSerialzer.propertyToSerializerMap) { + if (ExportStatusSerialzer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExportStatusSerialzer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExportStatusSerialzer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/custom_resources/exportStatusEntry.js b/src/fhir/serializers/4_0_0/custom_resources/exportStatusEntry.js new file mode 100644 index 000000000..e80344f89 --- /dev/null +++ b/src/fhir/serializers/4_0_0/custom_resources/exportStatusEntry.js @@ -0,0 +1,51 @@ +class ExportStatusEntrySerializer { + static propertyToSerializerMap = { + id: null, + type: null, + url: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExportStatusEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExportStatusEntrySerializer.propertyToSerializerMap) { + if (ExportStatusEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExportStatusEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExportStatusEntrySerializer; diff --git a/src/fhir/serializers/4_0_0/custom_resources/index.js b/src/fhir/serializers/4_0_0/custom_resources/index.js new file mode 100644 index 000000000..04b34c6bb --- /dev/null +++ b/src/fhir/serializers/4_0_0/custom_resources/index.js @@ -0,0 +1,7 @@ +const exportstatusentrySerializer = require('./exportStatusEntry'); +const exportstatusSerializer = require('./exportStatus'); + +module.exports = { + exportstatusentrySerializer, + exportstatusSerializer +}; diff --git a/src/fhir/serializers/4_0_0/resources/account.js b/src/fhir/serializers/4_0_0/resources/account.js new file mode 100644 index 000000000..255a6f892 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/account.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AccountCoverageSerializer = require('../backbone_elements/accountCoverage.js'); +const AccountGuarantorSerializer = require('../backbone_elements/accountGuarantor.js'); + +class AccountSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + name: null, + subject: (value) => ReferenceSerializer.serialize(value), + servicePeriod: (value) => PeriodSerializer.serialize(value), + coverage: (value) => AccountCoverageSerializer.serialize(value), + owner: (value) => ReferenceSerializer.serialize(value), + description: null, + guarantor: (value) => AccountGuarantorSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AccountSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AccountSerializer.propertyToSerializerMap) { + if (AccountSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AccountSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AccountSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/activityDefinition.js b/src/fhir/serializers/4_0_0/resources/activityDefinition.js new file mode 100644 index 000000000..097c33c96 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/activityDefinition.js @@ -0,0 +1,131 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ActivityDefinitionParticipantSerializer = require('../backbone_elements/activityDefinitionParticipant.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const ActivityDefinitionDynamicValueSerializer = require('../backbone_elements/activityDefinitionDynamicValue.js'); + +class ActivityDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + subtitle: null, + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + subjectCanonical: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + library: null, + kind: null, + profile: null, + code: (value) => CodeableConceptSerializer.serialize(value), + intent: null, + priority: null, + doNotPerform: null, + timingTiming: (value) => TimingSerializer.serialize(value), + timingDateTime: null, + timingAge: (value) => QuantitySerializer.serialize(value), + timingPeriod: (value) => PeriodSerializer.serialize(value), + timingRange: (value) => RangeSerializer.serialize(value), + timingDuration: (value) => QuantitySerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + participant: (value) => ActivityDefinitionParticipantSerializer.serialize(value), + productReference: (value) => ReferenceSerializer.serialize(value), + productCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + dosage: (value) => DosageSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + specimenRequirement: (value) => ReferenceSerializer.serialize(value), + observationRequirement: (value) => ReferenceSerializer.serialize(value), + observationResultRequirement: (value) => ReferenceSerializer.serialize(value), + transform: null, + dynamicValue: (value) => ActivityDefinitionDynamicValueSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ActivityDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ActivityDefinitionSerializer.propertyToSerializerMap) { + if (ActivityDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ActivityDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ActivityDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/administrableProductDefinition.js b/src/fhir/serializers/4_0_0/resources/administrableProductDefinition.js new file mode 100644 index 000000000..fe86015a5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/administrableProductDefinition.js @@ -0,0 +1,79 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AdministrableProductDefinitionPropertySerializer = require('../backbone_elements/administrableProductDefinitionProperty.js'); +const AdministrableProductDefinitionRouteOfAdministrationSerializer = require('../backbone_elements/administrableProductDefinitionRouteOfAdministration.js'); + +class AdministrableProductDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + formOf: (value) => ReferenceSerializer.serialize(value), + administrableDoseForm: (value) => CodeableConceptSerializer.serialize(value), + unitOfPresentation: (value) => CodeableConceptSerializer.serialize(value), + producedFrom: (value) => ReferenceSerializer.serialize(value), + ingredient: (value) => CodeableConceptSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + property: (value) => AdministrableProductDefinitionPropertySerializer.serialize(value), + routeOfAdministration: (value) => AdministrableProductDefinitionRouteOfAdministrationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdministrableProductDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdministrableProductDefinitionSerializer.propertyToSerializerMap) { + if (AdministrableProductDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdministrableProductDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdministrableProductDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/adverseEvent.js b/src/fhir/serializers/4_0_0/resources/adverseEvent.js new file mode 100644 index 000000000..39b2c71fd --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/adverseEvent.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AdverseEventSuspectEntitySerializer = require('../backbone_elements/adverseEventSuspectEntity.js'); + +class AdverseEventSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + actuality: null, + category: (value) => CodeableConceptSerializer.serialize(value), + event: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + date: null, + detected: null, + recordedDate: null, + resultingCondition: (value) => ReferenceSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + seriousness: (value) => CodeableConceptSerializer.serialize(value), + severity: (value) => CodeableConceptSerializer.serialize(value), + outcome: (value) => CodeableConceptSerializer.serialize(value), + recorder: (value) => ReferenceSerializer.serialize(value), + contributor: (value) => ReferenceSerializer.serialize(value), + suspectEntity: (value) => AdverseEventSuspectEntitySerializer.serialize(value), + subjectMedicalHistory: (value) => ReferenceSerializer.serialize(value), + referenceDocument: (value) => ReferenceSerializer.serialize(value), + study: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AdverseEventSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AdverseEventSerializer.propertyToSerializerMap) { + if (AdverseEventSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AdverseEventSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AdverseEventSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/allergyIntolerance.js b/src/fhir/serializers/4_0_0/resources/allergyIntolerance.js new file mode 100644 index 000000000..69863b752 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/allergyIntolerance.js @@ -0,0 +1,92 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const AllergyIntoleranceReactionSerializer = require('../backbone_elements/allergyIntoleranceReaction.js'); + +class AllergyIntoleranceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + clinicalStatus: (value) => CodeableConceptSerializer.serialize(value), + verificationStatus: (value) => CodeableConceptSerializer.serialize(value), + type: null, + category: null, + criticality: null, + code: (value) => CodeableConceptSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + onsetDateTime: null, + onsetAge: (value) => QuantitySerializer.serialize(value), + onsetPeriod: (value) => PeriodSerializer.serialize(value), + onsetRange: (value) => RangeSerializer.serialize(value), + onsetString: null, + recordedDate: null, + recorder: (value) => ReferenceSerializer.serialize(value), + asserter: (value) => ReferenceSerializer.serialize(value), + lastOccurrence: null, + note: (value) => AnnotationSerializer.serialize(value), + reaction: (value) => AllergyIntoleranceReactionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AllergyIntoleranceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AllergyIntoleranceSerializer.propertyToSerializerMap) { + if (AllergyIntoleranceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AllergyIntoleranceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AllergyIntoleranceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/appointment.js b/src/fhir/serializers/4_0_0/resources/appointment.js new file mode 100644 index 000000000..40c078841 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/appointment.js @@ -0,0 +1,91 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AppointmentParticipantSerializer = require('../backbone_elements/appointmentParticipant.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class AppointmentSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + cancelationReason: (value) => CodeableConceptSerializer.serialize(value), + serviceCategory: (value) => CodeableConceptSerializer.serialize(value), + serviceType: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + appointmentType: (value) => CodeableConceptSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + priority: null, + description: null, + supportingInformation: (value) => ReferenceSerializer.serialize(value), + start: null, + end: null, + minutesDuration: null, + slot: (value) => ReferenceSerializer.serialize(value), + created: null, + comment: null, + patientInstruction: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + participant: (value) => AppointmentParticipantSerializer.serialize(value), + requestedPeriod: (value) => PeriodSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AppointmentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AppointmentSerializer.propertyToSerializerMap) { + if (AppointmentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AppointmentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AppointmentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/appointmentResponse.js b/src/fhir/serializers/4_0_0/resources/appointmentResponse.js new file mode 100644 index 000000000..13de60dc2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/appointmentResponse.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class AppointmentResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + appointment: (value) => ReferenceSerializer.serialize(value), + start: null, + end: null, + participantType: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value), + participantStatus: null, + comment: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AppointmentResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AppointmentResponseSerializer.propertyToSerializerMap) { + if (AppointmentResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AppointmentResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AppointmentResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/auditEvent.js b/src/fhir/serializers/4_0_0/resources/auditEvent.js new file mode 100644 index 000000000..6a7a6cefe --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/auditEvent.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AuditEventAgentSerializer = require('../backbone_elements/auditEventAgent.js'); +const AuditEventSourceSerializer = require('../backbone_elements/auditEventSource.js'); +const AuditEventEntitySerializer = require('../backbone_elements/auditEventEntity.js'); + +class AuditEventSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + type: (value) => CodingSerializer.serialize(value), + subtype: (value) => CodingSerializer.serialize(value), + action: null, + period: (value) => PeriodSerializer.serialize(value), + recorded: null, + outcome: null, + outcomeDesc: null, + purposeOfEvent: (value) => CodeableConceptSerializer.serialize(value), + agent: (value) => AuditEventAgentSerializer.serialize(value), + source: (value) => AuditEventSourceSerializer.serialize(value), + entity: (value) => AuditEventEntitySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => AuditEventSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in AuditEventSerializer.propertyToSerializerMap) { + if (AuditEventSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = AuditEventSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = AuditEventSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/basic.js b/src/fhir/serializers/4_0_0/resources/basic.js new file mode 100644 index 000000000..c8bd0226f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/basic.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class BasicSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + created: null, + author: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BasicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BasicSerializer.propertyToSerializerMap) { + if (BasicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BasicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BasicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/binary.js b/src/fhir/serializers/4_0_0/resources/binary.js new file mode 100644 index 000000000..b471f299b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/binary.js @@ -0,0 +1,61 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class BinarySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + contentType: null, + securityContext: (value) => ReferenceSerializer.serialize(value), + data: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BinarySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BinarySerializer.propertyToSerializerMap) { + if (BinarySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BinarySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BinarySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/biologicallyDerivedProduct.js b/src/fhir/serializers/4_0_0/resources/biologicallyDerivedProduct.js new file mode 100644 index 000000000..8ff389797 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/biologicallyDerivedProduct.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const BiologicallyDerivedProductCollectionSerializer = require('../backbone_elements/biologicallyDerivedProductCollection.js'); +const BiologicallyDerivedProductProcessingSerializer = require('../backbone_elements/biologicallyDerivedProductProcessing.js'); +const BiologicallyDerivedProductManipulationSerializer = require('../backbone_elements/biologicallyDerivedProductManipulation.js'); +const BiologicallyDerivedProductStorageSerializer = require('../backbone_elements/biologicallyDerivedProductStorage.js'); + +class BiologicallyDerivedProductSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + productCategory: null, + productCode: (value) => CodeableConceptSerializer.serialize(value), + status: null, + request: (value) => ReferenceSerializer.serialize(value), + quantity: null, + parent: (value) => ReferenceSerializer.serialize(value), + collection: (value) => BiologicallyDerivedProductCollectionSerializer.serialize(value), + processing: (value) => BiologicallyDerivedProductProcessingSerializer.serialize(value), + manipulation: (value) => BiologicallyDerivedProductManipulationSerializer.serialize(value), + storage: (value) => BiologicallyDerivedProductStorageSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BiologicallyDerivedProductSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BiologicallyDerivedProductSerializer.propertyToSerializerMap) { + if (BiologicallyDerivedProductSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BiologicallyDerivedProductSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BiologicallyDerivedProductSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/bodyStructure.js b/src/fhir/serializers/4_0_0/resources/bodyStructure.js new file mode 100644 index 000000000..07b1d42b1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/bodyStructure.js @@ -0,0 +1,76 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class BodyStructureSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + morphology: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => CodeableConceptSerializer.serialize(value), + locationQualifier: (value) => CodeableConceptSerializer.serialize(value), + description: null, + image: (value) => AttachmentSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BodyStructureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BodyStructureSerializer.propertyToSerializerMap) { + if (BodyStructureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BodyStructureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BodyStructureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/bundle.js b/src/fhir/serializers/4_0_0/resources/bundle.js new file mode 100644 index 000000000..465839084 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/bundle.js @@ -0,0 +1,68 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const BundleLinkSerializer = require('../backbone_elements/bundleLink.js'); +const BundleEntrySerializer = require('../backbone_elements/bundleEntry.js'); +const SignatureSerializer = require('../complex_types/signature.js'); + +class BundleSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + identifier: (value) => IdentifierSerializer.serialize(value), + type: null, + timestamp: null, + total: null, + link: (value) => BundleLinkSerializer.serialize(value), + entry: (value) => BundleEntrySerializer.serialize(value), + signature: (value) => SignatureSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => BundleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in BundleSerializer.propertyToSerializerMap) { + if (BundleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = BundleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = BundleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/capabilityStatement.js b/src/fhir/serializers/4_0_0/resources/capabilityStatement.js new file mode 100644 index 000000000..1e790cd14 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/capabilityStatement.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CapabilityStatementSoftwareSerializer = require('../backbone_elements/capabilityStatementSoftware.js'); +const CapabilityStatementImplementationSerializer = require('../backbone_elements/capabilityStatementImplementation.js'); +const CapabilityStatementRestSerializer = require('../backbone_elements/capabilityStatementRest.js'); +const CapabilityStatementMessagingSerializer = require('../backbone_elements/capabilityStatementMessaging.js'); +const CapabilityStatementDocumentSerializer = require('../backbone_elements/capabilityStatementDocument.js'); + +class CapabilityStatementSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + kind: null, + instantiates: null, + imports: null, + software: (value) => CapabilityStatementSoftwareSerializer.serialize(value), + implementation: (value) => CapabilityStatementImplementationSerializer.serialize(value), + fhirVersion: null, + format: null, + patchFormat: null, + implementationGuide: null, + rest: (value) => CapabilityStatementRestSerializer.serialize(value), + messaging: (value) => CapabilityStatementMessagingSerializer.serialize(value), + document: (value) => CapabilityStatementDocumentSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CapabilityStatementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CapabilityStatementSerializer.propertyToSerializerMap) { + if (CapabilityStatementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CapabilityStatementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CapabilityStatementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/carePlan.js b/src/fhir/serializers/4_0_0/resources/carePlan.js new file mode 100644 index 000000000..666f92e2b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/carePlan.js @@ -0,0 +1,93 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CarePlanActivitySerializer = require('../backbone_elements/carePlanActivity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class CarePlanSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + replaces: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + intent: null, + category: (value) => CodeableConceptSerializer.serialize(value), + title: null, + description: null, + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + created: null, + author: (value) => ReferenceSerializer.serialize(value), + contributor: (value) => ReferenceSerializer.serialize(value), + careTeam: (value) => ReferenceSerializer.serialize(value), + addresses: (value) => ReferenceSerializer.serialize(value), + supportingInfo: (value) => ReferenceSerializer.serialize(value), + goal: (value) => ReferenceSerializer.serialize(value), + activity: (value) => CarePlanActivitySerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CarePlanSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CarePlanSerializer.propertyToSerializerMap) { + if (CarePlanSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CarePlanSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CarePlanSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/careTeam.js b/src/fhir/serializers/4_0_0/resources/careTeam.js new file mode 100644 index 000000000..c48573134 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/careTeam.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CareTeamParticipantSerializer = require('../backbone_elements/careTeamParticipant.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class CareTeamSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + name: null, + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + participant: (value) => CareTeamParticipantSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + managingOrganization: (value) => ReferenceSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CareTeamSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CareTeamSerializer.propertyToSerializerMap) { + if (CareTeamSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CareTeamSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CareTeamSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/catalogEntry.js b/src/fhir/serializers/4_0_0/resources/catalogEntry.js new file mode 100644 index 000000000..cf6b7b5a8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/catalogEntry.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CatalogEntryRelatedEntrySerializer = require('../backbone_elements/catalogEntryRelatedEntry.js'); + +class CatalogEntrySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + orderable: null, + referencedItem: (value) => ReferenceSerializer.serialize(value), + additionalIdentifier: (value) => IdentifierSerializer.serialize(value), + classification: (value) => CodeableConceptSerializer.serialize(value), + status: null, + validityPeriod: (value) => PeriodSerializer.serialize(value), + validTo: null, + lastUpdated: null, + additionalCharacteristic: (value) => CodeableConceptSerializer.serialize(value), + additionalClassification: (value) => CodeableConceptSerializer.serialize(value), + relatedEntry: (value) => CatalogEntryRelatedEntrySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CatalogEntrySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CatalogEntrySerializer.propertyToSerializerMap) { + if (CatalogEntrySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CatalogEntrySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CatalogEntrySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/chargeItem.js b/src/fhir/serializers/4_0_0/resources/chargeItem.js new file mode 100644 index 000000000..c312060a1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/chargeItem.js @@ -0,0 +1,102 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const ChargeItemPerformerSerializer = require('../backbone_elements/chargeItemPerformer.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MoneySerializer = require('../complex_types/money.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class ChargeItemSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + definitionUri: null, + definitionCanonical: null, + status: null, + partOf: (value) => ReferenceSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + context: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + performer: (value) => ChargeItemPerformerSerializer.serialize(value), + performingOrganization: (value) => ReferenceSerializer.serialize(value), + requestingOrganization: (value) => ReferenceSerializer.serialize(value), + costCenter: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + bodysite: (value) => CodeableConceptSerializer.serialize(value), + factorOverride: null, + priceOverride: (value) => MoneySerializer.serialize(value), + overrideReason: null, + enterer: (value) => ReferenceSerializer.serialize(value), + enteredDate: null, + reason: (value) => CodeableConceptSerializer.serialize(value), + service: (value) => ReferenceSerializer.serialize(value), + productReference: (value) => ReferenceSerializer.serialize(value), + productCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + account: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + supportingInformation: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemSerializer.propertyToSerializerMap) { + if (ChargeItemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/chargeItemDefinition.js b/src/fhir/serializers/4_0_0/resources/chargeItemDefinition.js new file mode 100644 index 000000000..f5da0375e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/chargeItemDefinition.js @@ -0,0 +1,95 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ChargeItemDefinitionApplicabilitySerializer = require('../backbone_elements/chargeItemDefinitionApplicability.js'); +const ChargeItemDefinitionPropertyGroupSerializer = require('../backbone_elements/chargeItemDefinitionPropertyGroup.js'); + +class ChargeItemDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + title: null, + derivedFromUri: null, + partOf: null, + replaces: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + instance: (value) => ReferenceSerializer.serialize(value), + applicability: (value) => ChargeItemDefinitionApplicabilitySerializer.serialize(value), + propertyGroup: (value) => ChargeItemDefinitionPropertyGroupSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ChargeItemDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ChargeItemDefinitionSerializer.propertyToSerializerMap) { + if (ChargeItemDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ChargeItemDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ChargeItemDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/citation.js b/src/fhir/serializers/4_0_0/resources/citation.js new file mode 100644 index 000000000..df3e9b29e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/citation.js @@ -0,0 +1,104 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CitationSummarySerializer = require('../backbone_elements/citationSummary.js'); +const CitationClassificationSerializer = require('../backbone_elements/citationClassification.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const CitationStatusDateSerializer = require('../backbone_elements/citationStatusDate.js'); +const CitationRelatesToSerializer = require('../backbone_elements/citationRelatesTo.js'); +const CitationCitedArtifactSerializer = require('../backbone_elements/citationCitedArtifact.js'); + +class CitationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + summary: (value) => CitationSummarySerializer.serialize(value), + classification: (value) => CitationClassificationSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + currentState: (value) => CodeableConceptSerializer.serialize(value), + statusDate: (value) => CitationStatusDateSerializer.serialize(value), + relatesTo: (value) => CitationRelatesToSerializer.serialize(value), + citedArtifact: (value) => CitationCitedArtifactSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CitationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CitationSerializer.propertyToSerializerMap) { + if (CitationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CitationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CitationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/claim.js b/src/fhir/serializers/4_0_0/resources/claim.js new file mode 100644 index 000000000..f45ee9ca8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/claim.js @@ -0,0 +1,105 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ClaimRelatedSerializer = require('../backbone_elements/claimRelated.js'); +const ClaimPayeeSerializer = require('../backbone_elements/claimPayee.js'); +const ClaimCareTeamSerializer = require('../backbone_elements/claimCareTeam.js'); +const ClaimSupportingInfoSerializer = require('../backbone_elements/claimSupportingInfo.js'); +const ClaimDiagnosisSerializer = require('../backbone_elements/claimDiagnosis.js'); +const ClaimProcedureSerializer = require('../backbone_elements/claimProcedure.js'); +const ClaimInsuranceSerializer = require('../backbone_elements/claimInsurance.js'); +const ClaimAccidentSerializer = require('../backbone_elements/claimAccident.js'); +const ClaimItemSerializer = require('../backbone_elements/claimItem.js'); +const MoneySerializer = require('../complex_types/money.js'); + +class ClaimSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + use: null, + patient: (value) => ReferenceSerializer.serialize(value), + billablePeriod: (value) => PeriodSerializer.serialize(value), + created: null, + enterer: (value) => ReferenceSerializer.serialize(value), + insurer: (value) => ReferenceSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + priority: (value) => CodeableConceptSerializer.serialize(value), + fundsReserve: (value) => CodeableConceptSerializer.serialize(value), + related: (value) => ClaimRelatedSerializer.serialize(value), + prescription: (value) => ReferenceSerializer.serialize(value), + originalPrescription: (value) => ReferenceSerializer.serialize(value), + payee: (value) => ClaimPayeeSerializer.serialize(value), + referral: (value) => ReferenceSerializer.serialize(value), + facility: (value) => ReferenceSerializer.serialize(value), + careTeam: (value) => ClaimCareTeamSerializer.serialize(value), + supportingInfo: (value) => ClaimSupportingInfoSerializer.serialize(value), + diagnosis: (value) => ClaimDiagnosisSerializer.serialize(value), + procedure: (value) => ClaimProcedureSerializer.serialize(value), + insurance: (value) => ClaimInsuranceSerializer.serialize(value), + accident: (value) => ClaimAccidentSerializer.serialize(value), + item: (value) => ClaimItemSerializer.serialize(value), + total: (value) => MoneySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimSerializer.propertyToSerializerMap) { + if (ClaimSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/claimResponse.js b/src/fhir/serializers/4_0_0/resources/claimResponse.js new file mode 100644 index 000000000..02bf8e2d7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/claimResponse.js @@ -0,0 +1,104 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ClaimResponseItemSerializer = require('../backbone_elements/claimResponseItem.js'); +const ClaimResponseAddItemSerializer = require('../backbone_elements/claimResponseAddItem.js'); +const ClaimResponseAdjudicationSerializer = require('../backbone_elements/claimResponseAdjudication.js'); +const ClaimResponseTotalSerializer = require('../backbone_elements/claimResponseTotal.js'); +const ClaimResponsePaymentSerializer = require('../backbone_elements/claimResponsePayment.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ClaimResponseProcessNoteSerializer = require('../backbone_elements/claimResponseProcessNote.js'); +const ClaimResponseInsuranceSerializer = require('../backbone_elements/claimResponseInsurance.js'); +const ClaimResponseErrorSerializer = require('../backbone_elements/claimResponseError.js'); + +class ClaimResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + use: null, + patient: (value) => ReferenceSerializer.serialize(value), + created: null, + insurer: (value) => ReferenceSerializer.serialize(value), + requestor: (value) => ReferenceSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + outcome: null, + disposition: null, + preAuthRef: null, + preAuthPeriod: (value) => PeriodSerializer.serialize(value), + payeeType: (value) => CodeableConceptSerializer.serialize(value), + item: (value) => ClaimResponseItemSerializer.serialize(value), + addItem: (value) => ClaimResponseAddItemSerializer.serialize(value), + adjudication: (value) => ClaimResponseAdjudicationSerializer.serialize(value), + total: (value) => ClaimResponseTotalSerializer.serialize(value), + payment: (value) => ClaimResponsePaymentSerializer.serialize(value), + fundsReserve: (value) => CodeableConceptSerializer.serialize(value), + formCode: (value) => CodeableConceptSerializer.serialize(value), + form: (value) => AttachmentSerializer.serialize(value), + processNote: (value) => ClaimResponseProcessNoteSerializer.serialize(value), + communicationRequest: (value) => ReferenceSerializer.serialize(value), + insurance: (value) => ClaimResponseInsuranceSerializer.serialize(value), + error: (value) => ClaimResponseErrorSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClaimResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClaimResponseSerializer.propertyToSerializerMap) { + if (ClaimResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClaimResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClaimResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/clinicalImpression.js b/src/fhir/serializers/4_0_0/resources/clinicalImpression.js new file mode 100644 index 000000000..c399d3a60 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/clinicalImpression.js @@ -0,0 +1,92 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ClinicalImpressionInvestigationSerializer = require('../backbone_elements/clinicalImpressionInvestigation.js'); +const ClinicalImpressionFindingSerializer = require('../backbone_elements/clinicalImpressionFinding.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class ClinicalImpressionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + effectiveDateTime: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + date: null, + assessor: (value) => ReferenceSerializer.serialize(value), + previous: (value) => ReferenceSerializer.serialize(value), + problem: (value) => ReferenceSerializer.serialize(value), + investigation: (value) => ClinicalImpressionInvestigationSerializer.serialize(value), + protocol: null, + summary: null, + finding: (value) => ClinicalImpressionFindingSerializer.serialize(value), + prognosisCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + prognosisReference: (value) => ReferenceSerializer.serialize(value), + supportingInfo: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalImpressionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalImpressionSerializer.propertyToSerializerMap) { + if (ClinicalImpressionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalImpressionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalImpressionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/clinicalUseDefinition.js b/src/fhir/serializers/4_0_0/resources/clinicalUseDefinition.js new file mode 100644 index 000000000..01ac4e2cf --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/clinicalUseDefinition.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ClinicalUseDefinitionContraindicationSerializer = require('../backbone_elements/clinicalUseDefinitionContraindication.js'); +const ClinicalUseDefinitionIndicationSerializer = require('../backbone_elements/clinicalUseDefinitionIndication.js'); +const ClinicalUseDefinitionInteractionSerializer = require('../backbone_elements/clinicalUseDefinitionInteraction.js'); +const ClinicalUseDefinitionUndesirableEffectSerializer = require('../backbone_elements/clinicalUseDefinitionUndesirableEffect.js'); +const ClinicalUseDefinitionWarningSerializer = require('../backbone_elements/clinicalUseDefinitionWarning.js'); + +class ClinicalUseDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: null, + category: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + contraindication: (value) => ClinicalUseDefinitionContraindicationSerializer.serialize(value), + indication: (value) => ClinicalUseDefinitionIndicationSerializer.serialize(value), + interaction: (value) => ClinicalUseDefinitionInteractionSerializer.serialize(value), + population: (value) => ReferenceSerializer.serialize(value), + undesirableEffect: (value) => ClinicalUseDefinitionUndesirableEffectSerializer.serialize(value), + warning: (value) => ClinicalUseDefinitionWarningSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ClinicalUseDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ClinicalUseDefinitionSerializer.propertyToSerializerMap) { + if (ClinicalUseDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ClinicalUseDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ClinicalUseDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/codeSystem.js b/src/fhir/serializers/4_0_0/resources/codeSystem.js new file mode 100644 index 000000000..7319fb1ec --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/codeSystem.js @@ -0,0 +1,97 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodeSystemFilterSerializer = require('../backbone_elements/codeSystemFilter.js'); +const CodeSystemPropertySerializer = require('../backbone_elements/codeSystemProperty.js'); +const CodeSystemConceptSerializer = require('../backbone_elements/codeSystemConcept.js'); + +class CodeSystemSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + caseSensitive: null, + valueSet: null, + hierarchyMeaning: null, + compositional: null, + versionNeeded: null, + content: null, + supplements: null, + count: null, + filter: (value) => CodeSystemFilterSerializer.serialize(value), + property: (value) => CodeSystemPropertySerializer.serialize(value), + concept: (value) => CodeSystemConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CodeSystemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CodeSystemSerializer.propertyToSerializerMap) { + if (CodeSystemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CodeSystemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CodeSystemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/communication.js b/src/fhir/serializers/4_0_0/resources/communication.js new file mode 100644 index 000000000..bf727cefb --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/communication.js @@ -0,0 +1,92 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CommunicationPayloadSerializer = require('../backbone_elements/communicationPayload.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class CommunicationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + inResponseTo: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + priority: null, + medium: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + about: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + sent: null, + received: null, + recipient: (value) => ReferenceSerializer.serialize(value), + sender: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + payload: (value) => CommunicationPayloadSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CommunicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CommunicationSerializer.propertyToSerializerMap) { + if (CommunicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CommunicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CommunicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/communicationRequest.js b/src/fhir/serializers/4_0_0/resources/communicationRequest.js new file mode 100644 index 000000000..8527d79a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/communicationRequest.js @@ -0,0 +1,93 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CommunicationRequestPayloadSerializer = require('../backbone_elements/communicationRequestPayload.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class CommunicationRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + replaces: (value) => ReferenceSerializer.serialize(value), + groupIdentifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + priority: null, + doNotPerform: null, + medium: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + about: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + payload: (value) => CommunicationRequestPayloadSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + authoredOn: null, + requester: (value) => ReferenceSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value), + sender: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CommunicationRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CommunicationRequestSerializer.propertyToSerializerMap) { + if (CommunicationRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CommunicationRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CommunicationRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/compartmentDefinition.js b/src/fhir/serializers/4_0_0/resources/compartmentDefinition.js new file mode 100644 index 000000000..a44e63477 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/compartmentDefinition.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CompartmentDefinitionResourceSerializer = require('../backbone_elements/compartmentDefinitionResource.js'); + +class CompartmentDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + purpose: null, + code: null, + search: null, + resource: (value) => CompartmentDefinitionResourceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompartmentDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompartmentDefinitionSerializer.propertyToSerializerMap) { + if (CompartmentDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompartmentDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompartmentDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/composition.js b/src/fhir/serializers/4_0_0/resources/composition.js new file mode 100644 index 000000000..147280b0b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/composition.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CompositionAttesterSerializer = require('../backbone_elements/compositionAttester.js'); +const CompositionRelatesToSerializer = require('../backbone_elements/compositionRelatesTo.js'); +const CompositionEventSerializer = require('../backbone_elements/compositionEvent.js'); +const CompositionSectionSerializer = require('../backbone_elements/compositionSection.js'); + +class CompositionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + date: null, + author: (value) => ReferenceSerializer.serialize(value), + title: null, + confidentiality: null, + attester: (value) => CompositionAttesterSerializer.serialize(value), + custodian: (value) => ReferenceSerializer.serialize(value), + relatesTo: (value) => CompositionRelatesToSerializer.serialize(value), + event: (value) => CompositionEventSerializer.serialize(value), + section: (value) => CompositionSectionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CompositionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CompositionSerializer.propertyToSerializerMap) { + if (CompositionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CompositionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CompositionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/conceptMap.js b/src/fhir/serializers/4_0_0/resources/conceptMap.js new file mode 100644 index 000000000..6e2edd21b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/conceptMap.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ConceptMapGroupSerializer = require('../backbone_elements/conceptMapGroup.js'); + +class ConceptMapSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + sourceUri: null, + sourceCanonical: null, + targetUri: null, + targetCanonical: null, + group: (value) => ConceptMapGroupSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConceptMapSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConceptMapSerializer.propertyToSerializerMap) { + if (ConceptMapSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConceptMapSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConceptMapSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/condition.js b/src/fhir/serializers/4_0_0/resources/condition.js new file mode 100644 index 000000000..1dcd6b7e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/condition.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ConditionStageSerializer = require('../backbone_elements/conditionStage.js'); +const ConditionEvidenceSerializer = require('../backbone_elements/conditionEvidence.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class ConditionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + clinicalStatus: (value) => CodeableConceptSerializer.serialize(value), + verificationStatus: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + severity: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + onsetDateTime: null, + onsetAge: (value) => QuantitySerializer.serialize(value), + onsetPeriod: (value) => PeriodSerializer.serialize(value), + onsetRange: (value) => RangeSerializer.serialize(value), + onsetString: null, + abatementDateTime: null, + abatementAge: (value) => QuantitySerializer.serialize(value), + abatementPeriod: (value) => PeriodSerializer.serialize(value), + abatementRange: (value) => RangeSerializer.serialize(value), + abatementString: null, + recordedDate: null, + recorder: (value) => ReferenceSerializer.serialize(value), + asserter: (value) => ReferenceSerializer.serialize(value), + stage: (value) => ConditionStageSerializer.serialize(value), + evidence: (value) => ConditionEvidenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConditionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConditionSerializer.propertyToSerializerMap) { + if (ConditionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConditionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConditionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/consent.js b/src/fhir/serializers/4_0_0/resources/consent.js new file mode 100644 index 000000000..93f226c18 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/consent.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ConsentPolicySerializer = require('../backbone_elements/consentPolicy.js'); +const ConsentVerificationSerializer = require('../backbone_elements/consentVerification.js'); +const ConsentProvisionSerializer = require('../backbone_elements/consentProvision.js'); + +class ConsentSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + scope: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + dateTime: null, + performer: (value) => ReferenceSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + sourceAttachment: (value) => AttachmentSerializer.serialize(value), + sourceReference: (value) => ReferenceSerializer.serialize(value), + policy: (value) => ConsentPolicySerializer.serialize(value), + policyRule: (value) => CodeableConceptSerializer.serialize(value), + verification: (value) => ConsentVerificationSerializer.serialize(value), + provision: (value) => ConsentProvisionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ConsentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ConsentSerializer.propertyToSerializerMap) { + if (ConsentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ConsentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ConsentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/contract.js b/src/fhir/serializers/4_0_0/resources/contract.js new file mode 100644 index 000000000..85e68afef --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/contract.js @@ -0,0 +1,110 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ContractContentDefinitionSerializer = require('../backbone_elements/contractContentDefinition.js'); +const ContractTermSerializer = require('../backbone_elements/contractTerm.js'); +const ContractSignerSerializer = require('../backbone_elements/contractSigner.js'); +const ContractFriendlySerializer = require('../backbone_elements/contractFriendly.js'); +const ContractLegalSerializer = require('../backbone_elements/contractLegal.js'); +const ContractRuleSerializer = require('../backbone_elements/contractRule.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class ContractSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + url: null, + version: null, + status: null, + legalState: (value) => CodeableConceptSerializer.serialize(value), + instantiatesCanonical: (value) => ReferenceSerializer.serialize(value), + instantiatesUri: null, + contentDerivative: (value) => CodeableConceptSerializer.serialize(value), + issued: null, + applies: (value) => PeriodSerializer.serialize(value), + expirationType: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + authority: (value) => ReferenceSerializer.serialize(value), + domain: (value) => ReferenceSerializer.serialize(value), + site: (value) => ReferenceSerializer.serialize(value), + name: null, + title: null, + subtitle: null, + alias: null, + author: (value) => ReferenceSerializer.serialize(value), + scope: (value) => CodeableConceptSerializer.serialize(value), + topicCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + topicReference: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + contentDefinition: (value) => ContractContentDefinitionSerializer.serialize(value), + term: (value) => ContractTermSerializer.serialize(value), + supportingInfo: (value) => ReferenceSerializer.serialize(value), + relevantHistory: (value) => ReferenceSerializer.serialize(value), + signer: (value) => ContractSignerSerializer.serialize(value), + friendly: (value) => ContractFriendlySerializer.serialize(value), + legal: (value) => ContractLegalSerializer.serialize(value), + rule: (value) => ContractRuleSerializer.serialize(value), + legallyBindingAttachment: (value) => AttachmentSerializer.serialize(value), + legallyBindingReference: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ContractSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ContractSerializer.propertyToSerializerMap) { + if (ContractSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ContractSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ContractSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/coverage.js b/src/fhir/serializers/4_0_0/resources/coverage.js new file mode 100644 index 000000000..1ce853d9f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/coverage.js @@ -0,0 +1,87 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CoverageClassSerializer = require('../backbone_elements/coverageClass.js'); +const CoverageCostToBeneficiarySerializer = require('../backbone_elements/coverageCostToBeneficiary.js'); + +class CoverageSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + policyHolder: (value) => ReferenceSerializer.serialize(value), + subscriber: (value) => ReferenceSerializer.serialize(value), + subscriberId: null, + beneficiary: (value) => ReferenceSerializer.serialize(value), + dependent: null, + relationship: (value) => CodeableConceptSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + payor: (value) => ReferenceSerializer.serialize(value), + class: (value) => CoverageClassSerializer.serialize(value), + order: null, + network: null, + costToBeneficiary: (value) => CoverageCostToBeneficiarySerializer.serialize(value), + subrogation: null, + contract: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageSerializer.propertyToSerializerMap) { + if (CoverageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/coverageEligibilityRequest.js b/src/fhir/serializers/4_0_0/resources/coverageEligibilityRequest.js new file mode 100644 index 000000000..df293993e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/coverageEligibilityRequest.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CoverageEligibilityRequestSupportingInfoSerializer = require('../backbone_elements/coverageEligibilityRequestSupportingInfo.js'); +const CoverageEligibilityRequestInsuranceSerializer = require('../backbone_elements/coverageEligibilityRequestInsurance.js'); +const CoverageEligibilityRequestItemSerializer = require('../backbone_elements/coverageEligibilityRequestItem.js'); + +class CoverageEligibilityRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + priority: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + patient: (value) => ReferenceSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + created: null, + enterer: (value) => ReferenceSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + insurer: (value) => ReferenceSerializer.serialize(value), + facility: (value) => ReferenceSerializer.serialize(value), + supportingInfo: (value) => CoverageEligibilityRequestSupportingInfoSerializer.serialize(value), + insurance: (value) => CoverageEligibilityRequestInsuranceSerializer.serialize(value), + item: (value) => CoverageEligibilityRequestItemSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityRequestSerializer.propertyToSerializerMap) { + if (CoverageEligibilityRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/coverageEligibilityResponse.js b/src/fhir/serializers/4_0_0/resources/coverageEligibilityResponse.js new file mode 100644 index 000000000..2fa0f9385 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/coverageEligibilityResponse.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CoverageEligibilityResponseInsuranceSerializer = require('../backbone_elements/coverageEligibilityResponseInsurance.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CoverageEligibilityResponseErrorSerializer = require('../backbone_elements/coverageEligibilityResponseError.js'); + +class CoverageEligibilityResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + purpose: null, + patient: (value) => ReferenceSerializer.serialize(value), + servicedDate: null, + servicedPeriod: (value) => PeriodSerializer.serialize(value), + created: null, + requestor: (value) => ReferenceSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + outcome: null, + disposition: null, + insurer: (value) => ReferenceSerializer.serialize(value), + insurance: (value) => CoverageEligibilityResponseInsuranceSerializer.serialize(value), + preAuthRef: null, + form: (value) => CodeableConceptSerializer.serialize(value), + error: (value) => CoverageEligibilityResponseErrorSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => CoverageEligibilityResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in CoverageEligibilityResponseSerializer.propertyToSerializerMap) { + if (CoverageEligibilityResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = CoverageEligibilityResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = CoverageEligibilityResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/detectedIssue.js b/src/fhir/serializers/4_0_0/resources/detectedIssue.js new file mode 100644 index 000000000..97a76a2a9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/detectedIssue.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const DetectedIssueEvidenceSerializer = require('../backbone_elements/detectedIssueEvidence.js'); +const DetectedIssueMitigationSerializer = require('../backbone_elements/detectedIssueMitigation.js'); + +class DetectedIssueSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + code: (value) => CodeableConceptSerializer.serialize(value), + severity: null, + patient: (value) => ReferenceSerializer.serialize(value), + identifiedDateTime: null, + identifiedPeriod: (value) => PeriodSerializer.serialize(value), + author: (value) => ReferenceSerializer.serialize(value), + implicated: (value) => ReferenceSerializer.serialize(value), + evidence: (value) => DetectedIssueEvidenceSerializer.serialize(value), + detail: null, + reference: null, + mitigation: (value) => DetectedIssueMitigationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DetectedIssueSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DetectedIssueSerializer.propertyToSerializerMap) { + if (DetectedIssueSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DetectedIssueSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DetectedIssueSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/device.js b/src/fhir/serializers/4_0_0/resources/device.js new file mode 100644 index 000000000..404dee1cf --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/device.js @@ -0,0 +1,100 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DeviceUdiCarrierSerializer = require('../backbone_elements/deviceUdiCarrier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const DeviceDeviceNameSerializer = require('../backbone_elements/deviceDeviceName.js'); +const DeviceSpecializationSerializer = require('../backbone_elements/deviceSpecialization.js'); +const DeviceVersionSerializer = require('../backbone_elements/deviceVersion.js'); +const DevicePropertySerializer = require('../backbone_elements/deviceProperty.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class DeviceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + definition: (value) => ReferenceSerializer.serialize(value), + udiCarrier: (value) => DeviceUdiCarrierSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + distinctIdentifier: null, + manufacturer: null, + manufactureDate: null, + expirationDate: null, + lotNumber: null, + serialNumber: null, + deviceName: (value) => DeviceDeviceNameSerializer.serialize(value), + modelNumber: null, + partNumber: null, + type: (value) => CodeableConceptSerializer.serialize(value), + specialization: (value) => DeviceSpecializationSerializer.serialize(value), + version: (value) => DeviceVersionSerializer.serialize(value), + property: (value) => DevicePropertySerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + owner: (value) => ReferenceSerializer.serialize(value), + contact: (value) => ContactPointSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + url: null, + note: (value) => AnnotationSerializer.serialize(value), + safety: (value) => CodeableConceptSerializer.serialize(value), + parent: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceSerializer.propertyToSerializerMap) { + if (DeviceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/deviceDefinition.js b/src/fhir/serializers/4_0_0/resources/deviceDefinition.js new file mode 100644 index 000000000..b9b1b0d14 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/deviceDefinition.js @@ -0,0 +1,101 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const DeviceDefinitionUdiDeviceIdentifierSerializer = require('../backbone_elements/deviceDefinitionUdiDeviceIdentifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DeviceDefinitionDeviceNameSerializer = require('../backbone_elements/deviceDefinitionDeviceName.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const DeviceDefinitionSpecializationSerializer = require('../backbone_elements/deviceDefinitionSpecialization.js'); +const ProductShelfLifeSerializer = require('../backbone_elements/productShelfLife.js'); +const ProdCharacteristicSerializer = require('../backbone_elements/prodCharacteristic.js'); +const DeviceDefinitionCapabilitySerializer = require('../backbone_elements/deviceDefinitionCapability.js'); +const DeviceDefinitionPropertySerializer = require('../backbone_elements/deviceDefinitionProperty.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const DeviceDefinitionMaterialSerializer = require('../backbone_elements/deviceDefinitionMaterial.js'); + +class DeviceDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + udiDeviceIdentifier: (value) => DeviceDefinitionUdiDeviceIdentifierSerializer.serialize(value), + manufacturerString: null, + manufacturerReference: (value) => ReferenceSerializer.serialize(value), + deviceName: (value) => DeviceDefinitionDeviceNameSerializer.serialize(value), + modelNumber: null, + type: (value) => CodeableConceptSerializer.serialize(value), + specialization: (value) => DeviceDefinitionSpecializationSerializer.serialize(value), + version: null, + safety: (value) => CodeableConceptSerializer.serialize(value), + shelfLifeStorage: (value) => ProductShelfLifeSerializer.serialize(value), + physicalCharacteristics: (value) => ProdCharacteristicSerializer.serialize(value), + languageCode: (value) => CodeableConceptSerializer.serialize(value), + capability: (value) => DeviceDefinitionCapabilitySerializer.serialize(value), + property: (value) => DeviceDefinitionPropertySerializer.serialize(value), + owner: (value) => ReferenceSerializer.serialize(value), + contact: (value) => ContactPointSerializer.serialize(value), + url: null, + onlineInformation: null, + note: (value) => AnnotationSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + parentDevice: (value) => ReferenceSerializer.serialize(value), + material: (value) => DeviceDefinitionMaterialSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceDefinitionSerializer.propertyToSerializerMap) { + if (DeviceDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/deviceMetric.js b/src/fhir/serializers/4_0_0/resources/deviceMetric.js new file mode 100644 index 000000000..fe5b88a5b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/deviceMetric.js @@ -0,0 +1,79 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const DeviceMetricCalibrationSerializer = require('../backbone_elements/deviceMetricCalibration.js'); + +class DeviceMetricSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + unit: (value) => CodeableConceptSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value), + parent: (value) => ReferenceSerializer.serialize(value), + operationalStatus: null, + color: null, + category: null, + measurementPeriod: (value) => TimingSerializer.serialize(value), + calibration: (value) => DeviceMetricCalibrationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceMetricSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceMetricSerializer.propertyToSerializerMap) { + if (DeviceMetricSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceMetricSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceMetricSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/deviceRequest.js b/src/fhir/serializers/4_0_0/resources/deviceRequest.js new file mode 100644 index 000000000..475e562ac --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/deviceRequest.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const DeviceRequestParameterSerializer = require('../backbone_elements/deviceRequestParameter.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class DeviceRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + priorRequest: (value) => ReferenceSerializer.serialize(value), + groupIdentifier: (value) => IdentifierSerializer.serialize(value), + status: null, + intent: null, + priority: null, + codeReference: (value) => ReferenceSerializer.serialize(value), + codeCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + parameter: (value) => DeviceRequestParameterSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + authoredOn: null, + requester: (value) => ReferenceSerializer.serialize(value), + performerType: (value) => CodeableConceptSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + insurance: (value) => ReferenceSerializer.serialize(value), + supportingInfo: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + relevantHistory: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceRequestSerializer.propertyToSerializerMap) { + if (DeviceRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/deviceUseStatement.js b/src/fhir/serializers/4_0_0/resources/deviceUseStatement.js new file mode 100644 index 000000000..01767f2a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/deviceUseStatement.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class DeviceUseStatementSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + status: null, + subject: (value) => ReferenceSerializer.serialize(value), + derivedFrom: (value) => ReferenceSerializer.serialize(value), + timingTiming: (value) => TimingSerializer.serialize(value), + timingPeriod: (value) => PeriodSerializer.serialize(value), + timingDateTime: null, + recordedOn: null, + source: (value) => ReferenceSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DeviceUseStatementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DeviceUseStatementSerializer.propertyToSerializerMap) { + if (DeviceUseStatementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DeviceUseStatementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DeviceUseStatementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/diagnosticReport.js b/src/fhir/serializers/4_0_0/resources/diagnosticReport.js new file mode 100644 index 000000000..87544988c --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/diagnosticReport.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const DiagnosticReportMediaSerializer = require('../backbone_elements/diagnosticReportMedia.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class DiagnosticReportSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + effectiveDateTime: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + issued: null, + performer: (value) => ReferenceSerializer.serialize(value), + resultsInterpreter: (value) => ReferenceSerializer.serialize(value), + specimen: (value) => ReferenceSerializer.serialize(value), + result: (value) => ReferenceSerializer.serialize(value), + imagingStudy: (value) => ReferenceSerializer.serialize(value), + media: (value) => DiagnosticReportMediaSerializer.serialize(value), + conclusion: null, + conclusionCode: (value) => CodeableConceptSerializer.serialize(value), + presentedForm: (value) => AttachmentSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DiagnosticReportSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DiagnosticReportSerializer.propertyToSerializerMap) { + if (DiagnosticReportSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DiagnosticReportSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DiagnosticReportSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/documentManifest.js b/src/fhir/serializers/4_0_0/resources/documentManifest.js new file mode 100644 index 000000000..c5e53e453 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/documentManifest.js @@ -0,0 +1,80 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DocumentManifestRelatedSerializer = require('../backbone_elements/documentManifestRelated.js'); + +class DocumentManifestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + masterIdentifier: (value) => IdentifierSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + created: null, + author: (value) => ReferenceSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value), + source: null, + description: null, + content: (value) => ReferenceSerializer.serialize(value), + related: (value) => DocumentManifestRelatedSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentManifestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentManifestSerializer.propertyToSerializerMap) { + if (DocumentManifestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentManifestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentManifestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/documentReference.js b/src/fhir/serializers/4_0_0/resources/documentReference.js new file mode 100644 index 000000000..19f99af5e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/documentReference.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const DocumentReferenceRelatesToSerializer = require('../backbone_elements/documentReferenceRelatesTo.js'); +const DocumentReferenceContentSerializer = require('../backbone_elements/documentReferenceContent.js'); +const DocumentReferenceContextSerializer = require('../backbone_elements/documentReferenceContext.js'); + +class DocumentReferenceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + masterIdentifier: (value) => IdentifierSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + docStatus: null, + type: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + date: null, + author: (value) => ReferenceSerializer.serialize(value), + authenticator: (value) => ReferenceSerializer.serialize(value), + custodian: (value) => ReferenceSerializer.serialize(value), + relatesTo: (value) => DocumentReferenceRelatesToSerializer.serialize(value), + description: null, + securityLabel: (value) => CodeableConceptSerializer.serialize(value), + content: (value) => DocumentReferenceContentSerializer.serialize(value), + context: (value) => DocumentReferenceContextSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DocumentReferenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DocumentReferenceSerializer.propertyToSerializerMap) { + if (DocumentReferenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DocumentReferenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DocumentReferenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/domainResource.js b/src/fhir/serializers/4_0_0/resources/domainResource.js new file mode 100644 index 000000000..3f42ab4c4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/domainResource.js @@ -0,0 +1,64 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); + +class DomainResourceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => DomainResourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in DomainResourceSerializer.propertyToSerializerMap) { + if (DomainResourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = DomainResourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = DomainResourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/encounter.js b/src/fhir/serializers/4_0_0/resources/encounter.js new file mode 100644 index 000000000..42de25109 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/encounter.js @@ -0,0 +1,99 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const EncounterStatusHistorySerializer = require('../backbone_elements/encounterStatusHistory.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const EncounterClassHistorySerializer = require('../backbone_elements/encounterClassHistory.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const EncounterParticipantSerializer = require('../backbone_elements/encounterParticipant.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const EncounterDiagnosisSerializer = require('../backbone_elements/encounterDiagnosis.js'); +const EncounterHospitalizationSerializer = require('../backbone_elements/encounterHospitalization.js'); +const EncounterLocationSerializer = require('../backbone_elements/encounterLocation.js'); + +class EncounterSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusHistory: (value) => EncounterStatusHistorySerializer.serialize(value), + class: (value) => CodingSerializer.serialize(value), + classHistory: (value) => EncounterClassHistorySerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + serviceType: (value) => CodeableConceptSerializer.serialize(value), + priority: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + episodeOfCare: (value) => ReferenceSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + participant: (value) => EncounterParticipantSerializer.serialize(value), + appointment: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + length: (value) => QuantitySerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + diagnosis: (value) => EncounterDiagnosisSerializer.serialize(value), + account: (value) => ReferenceSerializer.serialize(value), + hospitalization: (value) => EncounterHospitalizationSerializer.serialize(value), + location: (value) => EncounterLocationSerializer.serialize(value), + serviceProvider: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EncounterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EncounterSerializer.propertyToSerializerMap) { + if (EncounterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EncounterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EncounterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/endpoint.js b/src/fhir/serializers/4_0_0/resources/endpoint.js new file mode 100644 index 000000000..f24928b60 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/endpoint.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class EndpointSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + connectionType: (value) => CodingSerializer.serialize(value), + name: null, + managingOrganization: (value) => ReferenceSerializer.serialize(value), + contact: (value) => ContactPointSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + payloadType: (value) => CodeableConceptSerializer.serialize(value), + payloadMimeType: null, + address: null, + header: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EndpointSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EndpointSerializer.propertyToSerializerMap) { + if (EndpointSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EndpointSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EndpointSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/enrollmentRequest.js b/src/fhir/serializers/4_0_0/resources/enrollmentRequest.js new file mode 100644 index 000000000..4f148deeb --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/enrollmentRequest.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class EnrollmentRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + created: null, + insurer: (value) => ReferenceSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + candidate: (value) => ReferenceSerializer.serialize(value), + coverage: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EnrollmentRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EnrollmentRequestSerializer.propertyToSerializerMap) { + if (EnrollmentRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EnrollmentRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EnrollmentRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/enrollmentResponse.js b/src/fhir/serializers/4_0_0/resources/enrollmentResponse.js new file mode 100644 index 000000000..5c2e22553 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/enrollmentResponse.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class EnrollmentResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + request: (value) => ReferenceSerializer.serialize(value), + outcome: null, + disposition: null, + created: null, + organization: (value) => ReferenceSerializer.serialize(value), + requestProvider: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EnrollmentResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EnrollmentResponseSerializer.propertyToSerializerMap) { + if (EnrollmentResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EnrollmentResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EnrollmentResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/episodeOfCare.js b/src/fhir/serializers/4_0_0/resources/episodeOfCare.js new file mode 100644 index 000000000..ade754e42 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/episodeOfCare.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const EpisodeOfCareStatusHistorySerializer = require('../backbone_elements/episodeOfCareStatusHistory.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const EpisodeOfCareDiagnosisSerializer = require('../backbone_elements/episodeOfCareDiagnosis.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class EpisodeOfCareSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusHistory: (value) => EpisodeOfCareStatusHistorySerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + diagnosis: (value) => EpisodeOfCareDiagnosisSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + managingOrganization: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + referralRequest: (value) => ReferenceSerializer.serialize(value), + careManager: (value) => ReferenceSerializer.serialize(value), + team: (value) => ReferenceSerializer.serialize(value), + account: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EpisodeOfCareSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EpisodeOfCareSerializer.propertyToSerializerMap) { + if (EpisodeOfCareSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EpisodeOfCareSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EpisodeOfCareSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/eventDefinition.js b/src/fhir/serializers/4_0_0/resources/eventDefinition.js new file mode 100644 index 000000000..4f3bd9fcc --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/eventDefinition.js @@ -0,0 +1,101 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const TriggerDefinitionSerializer = require('../complex_types/triggerDefinition.js'); + +class EventDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + subtitle: null, + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + trigger: (value) => TriggerDefinitionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EventDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EventDefinitionSerializer.propertyToSerializerMap) { + if (EventDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EventDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EventDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/evidence.js b/src/fhir/serializers/4_0_0/resources/evidence.js new file mode 100644 index 000000000..a2bf5e23c --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/evidence.js @@ -0,0 +1,100 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const EvidenceVariableDefinitionSerializer = require('../backbone_elements/evidenceVariableDefinition.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const EvidenceStatisticSerializer = require('../backbone_elements/evidenceStatistic.js'); +const EvidenceCertaintySerializer = require('../backbone_elements/evidenceCertainty.js'); + +class EvidenceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + title: null, + citeAsReference: (value) => ReferenceSerializer.serialize(value), + citeAsMarkdown: null, + status: null, + date: null, + useContext: (value) => UsageContextSerializer.serialize(value), + approvalDate: null, + lastReviewDate: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + description: null, + assertion: null, + note: (value) => AnnotationSerializer.serialize(value), + variableDefinition: (value) => EvidenceVariableDefinitionSerializer.serialize(value), + synthesisType: (value) => CodeableConceptSerializer.serialize(value), + studyType: (value) => CodeableConceptSerializer.serialize(value), + statistic: (value) => EvidenceStatisticSerializer.serialize(value), + certainty: (value) => EvidenceCertaintySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceSerializer.propertyToSerializerMap) { + if (EvidenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/evidenceReport.js b/src/fhir/serializers/4_0_0/resources/evidenceReport.js new file mode 100644 index 000000000..78354c63f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/evidenceReport.js @@ -0,0 +1,93 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const EvidenceReportSubjectSerializer = require('../backbone_elements/evidenceReportSubject.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const EvidenceReportRelatesToSerializer = require('../backbone_elements/evidenceReportRelatesTo.js'); +const EvidenceReportSectionSerializer = require('../backbone_elements/evidenceReportSection.js'); + +class EvidenceReportSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + status: null, + useContext: (value) => UsageContextSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + relatedIdentifier: (value) => IdentifierSerializer.serialize(value), + citeAsReference: (value) => ReferenceSerializer.serialize(value), + citeAsMarkdown: null, + type: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + subject: (value) => EvidenceReportSubjectSerializer.serialize(value), + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatesTo: (value) => EvidenceReportRelatesToSerializer.serialize(value), + section: (value) => EvidenceReportSectionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceReportSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceReportSerializer.propertyToSerializerMap) { + if (EvidenceReportSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceReportSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceReportSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/evidenceVariable.js b/src/fhir/serializers/4_0_0/resources/evidenceVariable.js new file mode 100644 index 000000000..d4f9333e3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/evidenceVariable.js @@ -0,0 +1,95 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const EvidenceVariableCharacteristicSerializer = require('../backbone_elements/evidenceVariableCharacteristic.js'); +const EvidenceVariableCategorySerializer = require('../backbone_elements/evidenceVariableCategory.js'); + +class EvidenceVariableSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + shortTitle: null, + subtitle: null, + status: null, + date: null, + description: null, + note: (value) => AnnotationSerializer.serialize(value), + useContext: (value) => UsageContextSerializer.serialize(value), + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + actual: null, + characteristicCombination: null, + characteristic: (value) => EvidenceVariableCharacteristicSerializer.serialize(value), + handling: null, + category: (value) => EvidenceVariableCategorySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => EvidenceVariableSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in EvidenceVariableSerializer.propertyToSerializerMap) { + if (EvidenceVariableSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = EvidenceVariableSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = EvidenceVariableSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/exampleScenario.js b/src/fhir/serializers/4_0_0/resources/exampleScenario.js new file mode 100644 index 000000000..0dc795dcb --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/exampleScenario.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ExampleScenarioActorSerializer = require('../backbone_elements/exampleScenarioActor.js'); +const ExampleScenarioInstanceSerializer = require('../backbone_elements/exampleScenarioInstance.js'); +const ExampleScenarioProcessSerializer = require('../backbone_elements/exampleScenarioProcess.js'); + +class ExampleScenarioSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + copyright: null, + purpose: null, + actor: (value) => ExampleScenarioActorSerializer.serialize(value), + instance: (value) => ExampleScenarioInstanceSerializer.serialize(value), + process: (value) => ExampleScenarioProcessSerializer.serialize(value), + workflow: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExampleScenarioSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExampleScenarioSerializer.propertyToSerializerMap) { + if (ExampleScenarioSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExampleScenarioSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExampleScenarioSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/explanationOfBenefit.js b/src/fhir/serializers/4_0_0/resources/explanationOfBenefit.js new file mode 100644 index 000000000..2148d2ba7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/explanationOfBenefit.js @@ -0,0 +1,127 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ExplanationOfBenefitRelatedSerializer = require('../backbone_elements/explanationOfBenefitRelated.js'); +const ExplanationOfBenefitPayeeSerializer = require('../backbone_elements/explanationOfBenefitPayee.js'); +const ExplanationOfBenefitCareTeamSerializer = require('../backbone_elements/explanationOfBenefitCareTeam.js'); +const ExplanationOfBenefitSupportingInfoSerializer = require('../backbone_elements/explanationOfBenefitSupportingInfo.js'); +const ExplanationOfBenefitDiagnosisSerializer = require('../backbone_elements/explanationOfBenefitDiagnosis.js'); +const ExplanationOfBenefitProcedureSerializer = require('../backbone_elements/explanationOfBenefitProcedure.js'); +const ExplanationOfBenefitInsuranceSerializer = require('../backbone_elements/explanationOfBenefitInsurance.js'); +const ExplanationOfBenefitAccidentSerializer = require('../backbone_elements/explanationOfBenefitAccident.js'); +const ExplanationOfBenefitItemSerializer = require('../backbone_elements/explanationOfBenefitItem.js'); +const ExplanationOfBenefitAddItemSerializer = require('../backbone_elements/explanationOfBenefitAddItem.js'); +const ExplanationOfBenefitAdjudicationSerializer = require('../backbone_elements/explanationOfBenefitAdjudication.js'); +const ExplanationOfBenefitTotalSerializer = require('../backbone_elements/explanationOfBenefitTotal.js'); +const ExplanationOfBenefitPaymentSerializer = require('../backbone_elements/explanationOfBenefitPayment.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ExplanationOfBenefitProcessNoteSerializer = require('../backbone_elements/explanationOfBenefitProcessNote.js'); +const ExplanationOfBenefitBenefitBalanceSerializer = require('../backbone_elements/explanationOfBenefitBenefitBalance.js'); + +class ExplanationOfBenefitSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subType: (value) => CodeableConceptSerializer.serialize(value), + use: null, + patient: (value) => ReferenceSerializer.serialize(value), + billablePeriod: (value) => PeriodSerializer.serialize(value), + created: null, + enterer: (value) => ReferenceSerializer.serialize(value), + insurer: (value) => ReferenceSerializer.serialize(value), + provider: (value) => ReferenceSerializer.serialize(value), + priority: (value) => CodeableConceptSerializer.serialize(value), + fundsReserveRequested: (value) => CodeableConceptSerializer.serialize(value), + fundsReserve: (value) => CodeableConceptSerializer.serialize(value), + related: (value) => ExplanationOfBenefitRelatedSerializer.serialize(value), + prescription: (value) => ReferenceSerializer.serialize(value), + originalPrescription: (value) => ReferenceSerializer.serialize(value), + payee: (value) => ExplanationOfBenefitPayeeSerializer.serialize(value), + referral: (value) => ReferenceSerializer.serialize(value), + facility: (value) => ReferenceSerializer.serialize(value), + claim: (value) => ReferenceSerializer.serialize(value), + claimResponse: (value) => ReferenceSerializer.serialize(value), + outcome: null, + disposition: null, + preAuthRef: null, + preAuthRefPeriod: (value) => PeriodSerializer.serialize(value), + careTeam: (value) => ExplanationOfBenefitCareTeamSerializer.serialize(value), + supportingInfo: (value) => ExplanationOfBenefitSupportingInfoSerializer.serialize(value), + diagnosis: (value) => ExplanationOfBenefitDiagnosisSerializer.serialize(value), + procedure: (value) => ExplanationOfBenefitProcedureSerializer.serialize(value), + precedence: null, + insurance: (value) => ExplanationOfBenefitInsuranceSerializer.serialize(value), + accident: (value) => ExplanationOfBenefitAccidentSerializer.serialize(value), + item: (value) => ExplanationOfBenefitItemSerializer.serialize(value), + addItem: (value) => ExplanationOfBenefitAddItemSerializer.serialize(value), + adjudication: (value) => ExplanationOfBenefitAdjudicationSerializer.serialize(value), + total: (value) => ExplanationOfBenefitTotalSerializer.serialize(value), + payment: (value) => ExplanationOfBenefitPaymentSerializer.serialize(value), + formCode: (value) => CodeableConceptSerializer.serialize(value), + form: (value) => AttachmentSerializer.serialize(value), + processNote: (value) => ExplanationOfBenefitProcessNoteSerializer.serialize(value), + benefitPeriod: (value) => PeriodSerializer.serialize(value), + benefitBalance: (value) => ExplanationOfBenefitBenefitBalanceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ExplanationOfBenefitSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ExplanationOfBenefitSerializer.propertyToSerializerMap) { + if (ExplanationOfBenefitSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ExplanationOfBenefitSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ExplanationOfBenefitSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/familyMemberHistory.js b/src/fhir/serializers/4_0_0/resources/familyMemberHistory.js new file mode 100644 index 000000000..5b52048ff --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/familyMemberHistory.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const FamilyMemberHistoryConditionSerializer = require('../backbone_elements/familyMemberHistoryCondition.js'); + +class FamilyMemberHistorySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + status: null, + dataAbsentReason: (value) => CodeableConceptSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + date: null, + name: null, + relationship: (value) => CodeableConceptSerializer.serialize(value), + sex: (value) => CodeableConceptSerializer.serialize(value), + bornPeriod: (value) => PeriodSerializer.serialize(value), + bornDate: null, + bornString: null, + ageAge: (value) => QuantitySerializer.serialize(value), + ageRange: (value) => RangeSerializer.serialize(value), + ageString: null, + estimatedAge: null, + deceasedBoolean: null, + deceasedAge: (value) => QuantitySerializer.serialize(value), + deceasedRange: (value) => RangeSerializer.serialize(value), + deceasedDate: null, + deceasedString: null, + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + condition: (value) => FamilyMemberHistoryConditionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => FamilyMemberHistorySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in FamilyMemberHistorySerializer.propertyToSerializerMap) { + if (FamilyMemberHistorySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = FamilyMemberHistorySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = FamilyMemberHistorySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/flag.js b/src/fhir/serializers/4_0_0/resources/flag.js new file mode 100644 index 000000000..7093aedb4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/flag.js @@ -0,0 +1,76 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class FlagSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + author: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => FlagSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in FlagSerializer.propertyToSerializerMap) { + if (FlagSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = FlagSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = FlagSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/goal.js b/src/fhir/serializers/4_0_0/resources/goal.js new file mode 100644 index 000000000..04b5d6038 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/goal.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const GoalTargetSerializer = require('../backbone_elements/goalTarget.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class GoalSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + lifecycleStatus: null, + achievementStatus: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + priority: (value) => CodeableConceptSerializer.serialize(value), + description: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + startDate: null, + startCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + target: (value) => GoalTargetSerializer.serialize(value), + statusDate: null, + statusReason: null, + expressedBy: (value) => ReferenceSerializer.serialize(value), + addresses: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + outcomeCode: (value) => CodeableConceptSerializer.serialize(value), + outcomeReference: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GoalSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GoalSerializer.propertyToSerializerMap) { + if (GoalSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GoalSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GoalSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/graphDefinition.js b/src/fhir/serializers/4_0_0/resources/graphDefinition.js new file mode 100644 index 000000000..06d815c28 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/graphDefinition.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const GraphDefinitionLinkSerializer = require('../backbone_elements/graphDefinitionLink.js'); + +class GraphDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + start: null, + profile: null, + link: (value) => GraphDefinitionLinkSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GraphDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GraphDefinitionSerializer.propertyToSerializerMap) { + if (GraphDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GraphDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GraphDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/group.js b/src/fhir/serializers/4_0_0/resources/group.js new file mode 100644 index 000000000..744a2b4a3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/group.js @@ -0,0 +1,79 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const GroupCharacteristicSerializer = require('../backbone_elements/groupCharacteristic.js'); +const GroupMemberSerializer = require('../backbone_elements/groupMember.js'); + +class GroupSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + type: null, + actual: null, + code: (value) => CodeableConceptSerializer.serialize(value), + name: null, + quantity: null, + managingEntity: (value) => ReferenceSerializer.serialize(value), + characteristic: (value) => GroupCharacteristicSerializer.serialize(value), + member: (value) => GroupMemberSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GroupSerializer.propertyToSerializerMap) { + if (GroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/guidanceResponse.js b/src/fhir/serializers/4_0_0/resources/guidanceResponse.js new file mode 100644 index 000000000..140958fd8 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/guidanceResponse.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); + +class GuidanceResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + requestIdentifier: (value) => IdentifierSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + moduleUri: null, + moduleCanonical: null, + moduleCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + status: null, + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + performer: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + evaluationMessage: (value) => ReferenceSerializer.serialize(value), + outputParameters: (value) => ReferenceSerializer.serialize(value), + result: (value) => ReferenceSerializer.serialize(value), + dataRequirement: (value) => DataRequirementSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => GuidanceResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in GuidanceResponseSerializer.propertyToSerializerMap) { + if (GuidanceResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = GuidanceResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = GuidanceResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/healthcareService.js b/src/fhir/serializers/4_0_0/resources/healthcareService.js new file mode 100644 index 000000000..784dc4be4 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/healthcareService.js @@ -0,0 +1,96 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const HealthcareServiceEligibilitySerializer = require('../backbone_elements/healthcareServiceEligibility.js'); +const HealthcareServiceAvailableTimeSerializer = require('../backbone_elements/healthcareServiceAvailableTime.js'); +const HealthcareServiceNotAvailableSerializer = require('../backbone_elements/healthcareServiceNotAvailable.js'); + +class HealthcareServiceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + providedBy: (value) => ReferenceSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + name: null, + comment: null, + extraDetails: null, + photo: (value) => AttachmentSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + coverageArea: (value) => ReferenceSerializer.serialize(value), + serviceProvisionCode: (value) => CodeableConceptSerializer.serialize(value), + eligibility: (value) => HealthcareServiceEligibilitySerializer.serialize(value), + program: (value) => CodeableConceptSerializer.serialize(value), + characteristic: (value) => CodeableConceptSerializer.serialize(value), + communication: (value) => CodeableConceptSerializer.serialize(value), + referralMethod: (value) => CodeableConceptSerializer.serialize(value), + appointmentRequired: null, + availableTime: (value) => HealthcareServiceAvailableTimeSerializer.serialize(value), + notAvailable: (value) => HealthcareServiceNotAvailableSerializer.serialize(value), + availabilityExceptions: null, + endpoint: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => HealthcareServiceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in HealthcareServiceSerializer.propertyToSerializerMap) { + if (HealthcareServiceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = HealthcareServiceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = HealthcareServiceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/imagingStudy.js b/src/fhir/serializers/4_0_0/resources/imagingStudy.js new file mode 100644 index 000000000..fde44e29b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/imagingStudy.js @@ -0,0 +1,90 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ImagingStudySeriesSerializer = require('../backbone_elements/imagingStudySeries.js'); + +class ImagingStudySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + modality: (value) => CodingSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + started: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + referrer: (value) => ReferenceSerializer.serialize(value), + interpreter: (value) => ReferenceSerializer.serialize(value), + endpoint: (value) => ReferenceSerializer.serialize(value), + numberOfSeries: null, + numberOfInstances: null, + procedureReference: (value) => ReferenceSerializer.serialize(value), + procedureCode: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + description: null, + series: (value) => ImagingStudySeriesSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImagingStudySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImagingStudySerializer.propertyToSerializerMap) { + if (ImagingStudySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImagingStudySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImagingStudySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/immunization.js b/src/fhir/serializers/4_0_0/resources/immunization.js new file mode 100644 index 000000000..14ce1c667 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/immunization.js @@ -0,0 +1,102 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const ImmunizationPerformerSerializer = require('../backbone_elements/immunizationPerformer.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ImmunizationEducationSerializer = require('../backbone_elements/immunizationEducation.js'); +const ImmunizationReactionSerializer = require('../backbone_elements/immunizationReaction.js'); +const ImmunizationProtocolAppliedSerializer = require('../backbone_elements/immunizationProtocolApplied.js'); + +class ImmunizationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + vaccineCode: (value) => CodeableConceptSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + occurrenceString: null, + recorded: null, + primarySource: null, + reportOrigin: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + manufacturer: (value) => ReferenceSerializer.serialize(value), + lotNumber: null, + expirationDate: null, + site: (value) => CodeableConceptSerializer.serialize(value), + route: (value) => CodeableConceptSerializer.serialize(value), + doseQuantity: (value) => QuantitySerializer.serialize(value), + performer: (value) => ImmunizationPerformerSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + isSubpotent: null, + subpotentReason: (value) => CodeableConceptSerializer.serialize(value), + education: (value) => ImmunizationEducationSerializer.serialize(value), + programEligibility: (value) => CodeableConceptSerializer.serialize(value), + fundingSource: (value) => CodeableConceptSerializer.serialize(value), + reaction: (value) => ImmunizationReactionSerializer.serialize(value), + protocolApplied: (value) => ImmunizationProtocolAppliedSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationSerializer.propertyToSerializerMap) { + if (ImmunizationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/immunizationEvaluation.js b/src/fhir/serializers/4_0_0/resources/immunizationEvaluation.js new file mode 100644 index 000000000..5f0e22aa1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/immunizationEvaluation.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class ImmunizationEvaluationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + patient: (value) => ReferenceSerializer.serialize(value), + date: null, + authority: (value) => ReferenceSerializer.serialize(value), + targetDisease: (value) => CodeableConceptSerializer.serialize(value), + immunizationEvent: (value) => ReferenceSerializer.serialize(value), + doseStatus: (value) => CodeableConceptSerializer.serialize(value), + doseStatusReason: (value) => CodeableConceptSerializer.serialize(value), + description: null, + series: null, + doseNumberPositiveInt: null, + doseNumberString: null, + seriesDosesPositiveInt: null, + seriesDosesString: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationEvaluationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationEvaluationSerializer.propertyToSerializerMap) { + if (ImmunizationEvaluationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationEvaluationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationEvaluationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/immunizationRecommendation.js b/src/fhir/serializers/4_0_0/resources/immunizationRecommendation.js new file mode 100644 index 000000000..4f25155c7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/immunizationRecommendation.js @@ -0,0 +1,72 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ImmunizationRecommendationRecommendationSerializer = require('../backbone_elements/immunizationRecommendationRecommendation.js'); + +class ImmunizationRecommendationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + patient: (value) => ReferenceSerializer.serialize(value), + date: null, + authority: (value) => ReferenceSerializer.serialize(value), + recommendation: (value) => ImmunizationRecommendationRecommendationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImmunizationRecommendationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImmunizationRecommendationSerializer.propertyToSerializerMap) { + if (ImmunizationRecommendationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImmunizationRecommendationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImmunizationRecommendationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/implementationGuide.js b/src/fhir/serializers/4_0_0/resources/implementationGuide.js new file mode 100644 index 000000000..dd2b5aebe --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/implementationGuide.js @@ -0,0 +1,91 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ImplementationGuideDependsOnSerializer = require('../backbone_elements/implementationGuideDependsOn.js'); +const ImplementationGuideGlobalSerializer = require('../backbone_elements/implementationGuideGlobal.js'); +const ImplementationGuideDefinitionSerializer = require('../backbone_elements/implementationGuideDefinition.js'); +const ImplementationGuideManifestSerializer = require('../backbone_elements/implementationGuideManifest.js'); + +class ImplementationGuideSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + copyright: null, + packageId: null, + license: null, + fhirVersion: null, + dependsOn: (value) => ImplementationGuideDependsOnSerializer.serialize(value), + global: (value) => ImplementationGuideGlobalSerializer.serialize(value), + definition: (value) => ImplementationGuideDefinitionSerializer.serialize(value), + manifest: (value) => ImplementationGuideManifestSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ImplementationGuideSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ImplementationGuideSerializer.propertyToSerializerMap) { + if (ImplementationGuideSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ImplementationGuideSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ImplementationGuideSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/index.js b/src/fhir/serializers/4_0_0/resources/index.js new file mode 100644 index 000000000..0b562f73b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/index.js @@ -0,0 +1,292 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const domainresourceSerializer = require('./domainResource'); +const resourceSerializer = require('./resource'); +const accountSerializer = require('./account'); +const activitydefinitionSerializer = require('./activityDefinition'); +const administrableproductdefinitionSerializer = require('./administrableProductDefinition'); +const adverseeventSerializer = require('./adverseEvent'); +const allergyintoleranceSerializer = require('./allergyIntolerance'); +const appointmentSerializer = require('./appointment'); +const appointmentresponseSerializer = require('./appointmentResponse'); +const auditeventSerializer = require('./auditEvent'); +const basicSerializer = require('./basic'); +const binarySerializer = require('./binary'); +const biologicallyderivedproductSerializer = require('./biologicallyDerivedProduct'); +const bodystructureSerializer = require('./bodyStructure'); +const bundleSerializer = require('./bundle'); +const capabilitystatementSerializer = require('./capabilityStatement'); +const careplanSerializer = require('./carePlan'); +const careteamSerializer = require('./careTeam'); +const catalogentrySerializer = require('./catalogEntry'); +const chargeitemSerializer = require('./chargeItem'); +const chargeitemdefinitionSerializer = require('./chargeItemDefinition'); +const citationSerializer = require('./citation'); +const claimSerializer = require('./claim'); +const claimresponseSerializer = require('./claimResponse'); +const clinicalimpressionSerializer = require('./clinicalImpression'); +const clinicalusedefinitionSerializer = require('./clinicalUseDefinition'); +const codesystemSerializer = require('./codeSystem'); +const communicationSerializer = require('./communication'); +const communicationrequestSerializer = require('./communicationRequest'); +const compartmentdefinitionSerializer = require('./compartmentDefinition'); +const compositionSerializer = require('./composition'); +const conceptmapSerializer = require('./conceptMap'); +const conditionSerializer = require('./condition'); +const consentSerializer = require('./consent'); +const contractSerializer = require('./contract'); +const coverageSerializer = require('./coverage'); +const coverageeligibilityrequestSerializer = require('./coverageEligibilityRequest'); +const coverageeligibilityresponseSerializer = require('./coverageEligibilityResponse'); +const detectedissueSerializer = require('./detectedIssue'); +const deviceSerializer = require('./device'); +const devicedefinitionSerializer = require('./deviceDefinition'); +const devicemetricSerializer = require('./deviceMetric'); +const devicerequestSerializer = require('./deviceRequest'); +const deviceusestatementSerializer = require('./deviceUseStatement'); +const diagnosticreportSerializer = require('./diagnosticReport'); +const documentmanifestSerializer = require('./documentManifest'); +const documentreferenceSerializer = require('./documentReference'); +const encounterSerializer = require('./encounter'); +const endpointSerializer = require('./endpoint'); +const enrollmentrequestSerializer = require('./enrollmentRequest'); +const enrollmentresponseSerializer = require('./enrollmentResponse'); +const episodeofcareSerializer = require('./episodeOfCare'); +const eventdefinitionSerializer = require('./eventDefinition'); +const evidenceSerializer = require('./evidence'); +const evidencereportSerializer = require('./evidenceReport'); +const evidencevariableSerializer = require('./evidenceVariable'); +const examplescenarioSerializer = require('./exampleScenario'); +const explanationofbenefitSerializer = require('./explanationOfBenefit'); +const familymemberhistorySerializer = require('./familyMemberHistory'); +const flagSerializer = require('./flag'); +const goalSerializer = require('./goal'); +const graphdefinitionSerializer = require('./graphDefinition'); +const groupSerializer = require('./group'); +const guidanceresponseSerializer = require('./guidanceResponse'); +const healthcareserviceSerializer = require('./healthcareService'); +const imagingstudySerializer = require('./imagingStudy'); +const immunizationSerializer = require('./immunization'); +const immunizationevaluationSerializer = require('./immunizationEvaluation'); +const immunizationrecommendationSerializer = require('./immunizationRecommendation'); +const implementationguideSerializer = require('./implementationGuide'); +const ingredientSerializer = require('./ingredient'); +const insuranceplanSerializer = require('./insurancePlan'); +const invoiceSerializer = require('./invoice'); +const librarySerializer = require('./library'); +const linkageSerializer = require('./linkage'); +const listSerializer = require('./list'); +const locationSerializer = require('./location'); +const manufactureditemdefinitionSerializer = require('./manufacturedItemDefinition'); +const measureSerializer = require('./measure'); +const measurereportSerializer = require('./measureReport'); +const mediaSerializer = require('./media'); +const medicationSerializer = require('./medication'); +const medicationadministrationSerializer = require('./medicationAdministration'); +const medicationdispenseSerializer = require('./medicationDispense'); +const medicationknowledgeSerializer = require('./medicationKnowledge'); +const medicationrequestSerializer = require('./medicationRequest'); +const medicationstatementSerializer = require('./medicationStatement'); +const medicinalproductdefinitionSerializer = require('./medicinalProductDefinition'); +const messagedefinitionSerializer = require('./messageDefinition'); +const messageheaderSerializer = require('./messageHeader'); +const molecularsequenceSerializer = require('./molecularSequence'); +const namingsystemSerializer = require('./namingSystem'); +const nutritionorderSerializer = require('./nutritionOrder'); +const nutritionproductSerializer = require('./nutritionProduct'); +const observationSerializer = require('./observation'); +const observationdefinitionSerializer = require('./observationDefinition'); +const operationdefinitionSerializer = require('./operationDefinition'); +const operationoutcomeSerializer = require('./operationOutcome'); +const organizationSerializer = require('./organization'); +const organizationaffiliationSerializer = require('./organizationAffiliation'); +const packagedproductdefinitionSerializer = require('./packagedProductDefinition'); +const parametersSerializer = require('./parameters'); +const patientSerializer = require('./patient'); +const paymentnoticeSerializer = require('./paymentNotice'); +const paymentreconciliationSerializer = require('./paymentReconciliation'); +const personSerializer = require('./person'); +const plandefinitionSerializer = require('./planDefinition'); +const practitionerSerializer = require('./practitioner'); +const practitionerroleSerializer = require('./practitionerRole'); +const procedureSerializer = require('./procedure'); +const provenanceSerializer = require('./provenance'); +const questionnaireSerializer = require('./questionnaire'); +const questionnaireresponseSerializer = require('./questionnaireResponse'); +const regulatedauthorizationSerializer = require('./regulatedAuthorization'); +const relatedpersonSerializer = require('./relatedPerson'); +const requestgroupSerializer = require('./requestGroup'); +const researchdefinitionSerializer = require('./researchDefinition'); +const researchelementdefinitionSerializer = require('./researchElementDefinition'); +const researchstudySerializer = require('./researchStudy'); +const researchsubjectSerializer = require('./researchSubject'); +const riskassessmentSerializer = require('./riskAssessment'); +const scheduleSerializer = require('./schedule'); +const searchparameterSerializer = require('./searchParameter'); +const servicerequestSerializer = require('./serviceRequest'); +const slotSerializer = require('./slot'); +const specimenSerializer = require('./specimen'); +const specimendefinitionSerializer = require('./specimenDefinition'); +const structuredefinitionSerializer = require('./structureDefinition'); +const structuremapSerializer = require('./structureMap'); +const subscriptionSerializer = require('./subscription'); +const subscriptionstatusSerializer = require('./subscriptionStatus'); +const subscriptiontopicSerializer = require('./subscriptionTopic'); +const substanceSerializer = require('./substance'); +const substancedefinitionSerializer = require('./substanceDefinition'); +const supplydeliverySerializer = require('./supplyDelivery'); +const supplyrequestSerializer = require('./supplyRequest'); +const taskSerializer = require('./task'); +const terminologycapabilitiesSerializer = require('./terminologyCapabilities'); +const testreportSerializer = require('./testReport'); +const testscriptSerializer = require('./testScript'); +const valuesetSerializer = require('./valueSet'); +const verificationresultSerializer = require('./verificationResult'); +const visionprescriptionSerializer = require('./visionPrescription'); + +module.exports = { + domainresourceSerializer, + resourceSerializer, + accountSerializer, + activitydefinitionSerializer, + administrableproductdefinitionSerializer, + adverseeventSerializer, + allergyintoleranceSerializer, + appointmentSerializer, + appointmentresponseSerializer, + auditeventSerializer, + basicSerializer, + binarySerializer, + biologicallyderivedproductSerializer, + bodystructureSerializer, + bundleSerializer, + capabilitystatementSerializer, + careplanSerializer, + careteamSerializer, + catalogentrySerializer, + chargeitemSerializer, + chargeitemdefinitionSerializer, + citationSerializer, + claimSerializer, + claimresponseSerializer, + clinicalimpressionSerializer, + clinicalusedefinitionSerializer, + codesystemSerializer, + communicationSerializer, + communicationrequestSerializer, + compartmentdefinitionSerializer, + compositionSerializer, + conceptmapSerializer, + conditionSerializer, + consentSerializer, + contractSerializer, + coverageSerializer, + coverageeligibilityrequestSerializer, + coverageeligibilityresponseSerializer, + detectedissueSerializer, + deviceSerializer, + devicedefinitionSerializer, + devicemetricSerializer, + devicerequestSerializer, + deviceusestatementSerializer, + diagnosticreportSerializer, + documentmanifestSerializer, + documentreferenceSerializer, + encounterSerializer, + endpointSerializer, + enrollmentrequestSerializer, + enrollmentresponseSerializer, + episodeofcareSerializer, + eventdefinitionSerializer, + evidenceSerializer, + evidencereportSerializer, + evidencevariableSerializer, + examplescenarioSerializer, + explanationofbenefitSerializer, + familymemberhistorySerializer, + flagSerializer, + goalSerializer, + graphdefinitionSerializer, + groupSerializer, + guidanceresponseSerializer, + healthcareserviceSerializer, + imagingstudySerializer, + immunizationSerializer, + immunizationevaluationSerializer, + immunizationrecommendationSerializer, + implementationguideSerializer, + ingredientSerializer, + insuranceplanSerializer, + invoiceSerializer, + librarySerializer, + linkageSerializer, + listSerializer, + locationSerializer, + manufactureditemdefinitionSerializer, + measureSerializer, + measurereportSerializer, + mediaSerializer, + medicationSerializer, + medicationadministrationSerializer, + medicationdispenseSerializer, + medicationknowledgeSerializer, + medicationrequestSerializer, + medicationstatementSerializer, + medicinalproductdefinitionSerializer, + messagedefinitionSerializer, + messageheaderSerializer, + molecularsequenceSerializer, + namingsystemSerializer, + nutritionorderSerializer, + nutritionproductSerializer, + observationSerializer, + observationdefinitionSerializer, + operationdefinitionSerializer, + operationoutcomeSerializer, + organizationSerializer, + organizationaffiliationSerializer, + packagedproductdefinitionSerializer, + parametersSerializer, + patientSerializer, + paymentnoticeSerializer, + paymentreconciliationSerializer, + personSerializer, + plandefinitionSerializer, + practitionerSerializer, + practitionerroleSerializer, + procedureSerializer, + provenanceSerializer, + questionnaireSerializer, + questionnaireresponseSerializer, + regulatedauthorizationSerializer, + relatedpersonSerializer, + requestgroupSerializer, + researchdefinitionSerializer, + researchelementdefinitionSerializer, + researchstudySerializer, + researchsubjectSerializer, + riskassessmentSerializer, + scheduleSerializer, + searchparameterSerializer, + servicerequestSerializer, + slotSerializer, + specimenSerializer, + specimendefinitionSerializer, + structuredefinitionSerializer, + structuremapSerializer, + subscriptionSerializer, + subscriptionstatusSerializer, + subscriptiontopicSerializer, + substanceSerializer, + substancedefinitionSerializer, + supplydeliverySerializer, + supplyrequestSerializer, + taskSerializer, + terminologycapabilitiesSerializer, + testreportSerializer, + testscriptSerializer, + valuesetSerializer, + verificationresultSerializer, + visionprescriptionSerializer +}; + diff --git a/src/fhir/serializers/4_0_0/resources/ingredient.js b/src/fhir/serializers/4_0_0/resources/ingredient.js new file mode 100644 index 000000000..3414cc525 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/ingredient.js @@ -0,0 +1,77 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IngredientManufacturerSerializer = require('../backbone_elements/ingredientManufacturer.js'); +const IngredientSubstanceSerializer = require('../backbone_elements/ingredientSubstance.js'); + +class IngredientSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + for: (value) => ReferenceSerializer.serialize(value), + role: (value) => CodeableConceptSerializer.serialize(value), + function: (value) => CodeableConceptSerializer.serialize(value), + allergenicIndicator: null, + manufacturer: (value) => IngredientManufacturerSerializer.serialize(value), + substance: (value) => IngredientSubstanceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => IngredientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in IngredientSerializer.propertyToSerializerMap) { + if (IngredientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = IngredientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = IngredientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/insurancePlan.js b/src/fhir/serializers/4_0_0/resources/insurancePlan.js new file mode 100644 index 000000000..f4dd3db19 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/insurancePlan.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const InsurancePlanContactSerializer = require('../backbone_elements/insurancePlanContact.js'); +const InsurancePlanCoverageSerializer = require('../backbone_elements/insurancePlanCoverage.js'); +const InsurancePlanPlanSerializer = require('../backbone_elements/insurancePlanPlan.js'); + +class InsurancePlanSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + name: null, + alias: null, + period: (value) => PeriodSerializer.serialize(value), + ownedBy: (value) => ReferenceSerializer.serialize(value), + administeredBy: (value) => ReferenceSerializer.serialize(value), + coverageArea: (value) => ReferenceSerializer.serialize(value), + contact: (value) => InsurancePlanContactSerializer.serialize(value), + endpoint: (value) => ReferenceSerializer.serialize(value), + network: (value) => ReferenceSerializer.serialize(value), + coverage: (value) => InsurancePlanCoverageSerializer.serialize(value), + plan: (value) => InsurancePlanPlanSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InsurancePlanSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InsurancePlanSerializer.propertyToSerializerMap) { + if (InsurancePlanSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InsurancePlanSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InsurancePlanSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/invoice.js b/src/fhir/serializers/4_0_0/resources/invoice.js new file mode 100644 index 000000000..f017e40c1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/invoice.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const InvoiceParticipantSerializer = require('../backbone_elements/invoiceParticipant.js'); +const InvoiceLineItemSerializer = require('../backbone_elements/invoiceLineItem.js'); +const InvoicePriceComponentSerializer = require('../backbone_elements/invoicePriceComponent.js'); +const MoneySerializer = require('../complex_types/money.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class InvoiceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + cancelledReason: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value), + date: null, + participant: (value) => InvoiceParticipantSerializer.serialize(value), + issuer: (value) => ReferenceSerializer.serialize(value), + account: (value) => ReferenceSerializer.serialize(value), + lineItem: (value) => InvoiceLineItemSerializer.serialize(value), + totalPriceComponent: (value) => InvoicePriceComponentSerializer.serialize(value), + totalNet: (value) => MoneySerializer.serialize(value), + totalGross: (value) => MoneySerializer.serialize(value), + paymentTerms: null, + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => InvoiceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in InvoiceSerializer.propertyToSerializerMap) { + if (InvoiceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = InvoiceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = InvoiceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/library.js b/src/fhir/serializers/4_0_0/resources/library.js new file mode 100644 index 000000000..711b309cd --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/library.js @@ -0,0 +1,106 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const ParameterDefinitionSerializer = require('../complex_types/parameterDefinition.js'); +const DataRequirementSerializer = require('../complex_types/dataRequirement.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); + +class LibrarySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + subtitle: null, + status: null, + experimental: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + parameter: (value) => ParameterDefinitionSerializer.serialize(value), + dataRequirement: (value) => DataRequirementSerializer.serialize(value), + content: (value) => AttachmentSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LibrarySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LibrarySerializer.propertyToSerializerMap) { + if (LibrarySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LibrarySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LibrarySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/linkage.js b/src/fhir/serializers/4_0_0/resources/linkage.js new file mode 100644 index 000000000..401de2c3d --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/linkage.js @@ -0,0 +1,69 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const LinkageItemSerializer = require('../backbone_elements/linkageItem.js'); + +class LinkageSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + active: null, + author: (value) => ReferenceSerializer.serialize(value), + item: (value) => LinkageItemSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LinkageSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LinkageSerializer.propertyToSerializerMap) { + if (LinkageSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LinkageSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LinkageSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/list.js b/src/fhir/serializers/4_0_0/resources/list.js new file mode 100644 index 000000000..2a5ebcc37 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/list.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ListEntrySerializer = require('../backbone_elements/listEntry.js'); + +class ListSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + mode: null, + title: null, + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + date: null, + source: (value) => ReferenceSerializer.serialize(value), + orderedBy: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + entry: (value) => ListEntrySerializer.serialize(value), + emptyReason: (value) => CodeableConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ListSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ListSerializer.propertyToSerializerMap) { + if (ListSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ListSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ListSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/location.js b/src/fhir/serializers/4_0_0/resources/location.js new file mode 100644 index 000000000..655ef5fcd --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/location.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const LocationPositionSerializer = require('../backbone_elements/locationPosition.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const LocationHoursOfOperationSerializer = require('../backbone_elements/locationHoursOfOperation.js'); + +class LocationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + operationalStatus: (value) => CodingSerializer.serialize(value), + name: null, + alias: null, + description: null, + mode: null, + type: (value) => CodeableConceptSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value), + physicalType: (value) => CodeableConceptSerializer.serialize(value), + position: (value) => LocationPositionSerializer.serialize(value), + managingOrganization: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + hoursOfOperation: (value) => LocationHoursOfOperationSerializer.serialize(value), + availabilityExceptions: null, + endpoint: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => LocationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in LocationSerializer.propertyToSerializerMap) { + if (LocationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = LocationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = LocationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/manufacturedItemDefinition.js b/src/fhir/serializers/4_0_0/resources/manufacturedItemDefinition.js new file mode 100644 index 000000000..d5c712e67 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/manufacturedItemDefinition.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ManufacturedItemDefinitionPropertySerializer = require('../backbone_elements/manufacturedItemDefinitionProperty.js'); + +class ManufacturedItemDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + manufacturedDoseForm: (value) => CodeableConceptSerializer.serialize(value), + unitOfPresentation: (value) => CodeableConceptSerializer.serialize(value), + manufacturer: (value) => ReferenceSerializer.serialize(value), + ingredient: (value) => CodeableConceptSerializer.serialize(value), + property: (value) => ManufacturedItemDefinitionPropertySerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ManufacturedItemDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ManufacturedItemDefinitionSerializer.propertyToSerializerMap) { + if (ManufacturedItemDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ManufacturedItemDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ManufacturedItemDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/measure.js b/src/fhir/serializers/4_0_0/resources/measure.js new file mode 100644 index 000000000..235426f69 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/measure.js @@ -0,0 +1,115 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const MeasureGroupSerializer = require('../backbone_elements/measureGroup.js'); +const MeasureSupplementalDataSerializer = require('../backbone_elements/measureSupplementalData.js'); + +class MeasureSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + subtitle: null, + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + library: null, + disclaimer: null, + scoring: (value) => CodeableConceptSerializer.serialize(value), + compositeScoring: (value) => CodeableConceptSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + riskAdjustment: null, + rateAggregation: null, + rationale: null, + clinicalRecommendationStatement: null, + improvementNotation: (value) => CodeableConceptSerializer.serialize(value), + definition: null, + guidance: null, + group: (value) => MeasureGroupSerializer.serialize(value), + supplementalData: (value) => MeasureSupplementalDataSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureSerializer.propertyToSerializerMap) { + if (MeasureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/measureReport.js b/src/fhir/serializers/4_0_0/resources/measureReport.js new file mode 100644 index 000000000..1759f5c2e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/measureReport.js @@ -0,0 +1,80 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MeasureReportGroupSerializer = require('../backbone_elements/measureReportGroup.js'); + +class MeasureReportSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: null, + measure: null, + subject: (value) => ReferenceSerializer.serialize(value), + date: null, + reporter: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + improvementNotation: (value) => CodeableConceptSerializer.serialize(value), + group: (value) => MeasureReportGroupSerializer.serialize(value), + evaluatedResource: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MeasureReportSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MeasureReportSerializer.propertyToSerializerMap) { + if (MeasureReportSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MeasureReportSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MeasureReportSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/media.js b/src/fhir/serializers/4_0_0/resources/media.js new file mode 100644 index 000000000..56233fdc5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/media.js @@ -0,0 +1,93 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class MediaSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + modality: (value) => CodeableConceptSerializer.serialize(value), + view: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + createdDateTime: null, + createdPeriod: (value) => PeriodSerializer.serialize(value), + issued: null, + operator: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + deviceName: null, + device: (value) => ReferenceSerializer.serialize(value), + height: null, + width: null, + frames: null, + duration: null, + content: (value) => AttachmentSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MediaSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MediaSerializer.propertyToSerializerMap) { + if (MediaSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MediaSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MediaSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medication.js b/src/fhir/serializers/4_0_0/resources/medication.js new file mode 100644 index 000000000..5b5650359 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medication.js @@ -0,0 +1,78 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const MedicationIngredientSerializer = require('../backbone_elements/medicationIngredient.js'); +const MedicationBatchSerializer = require('../backbone_elements/medicationBatch.js'); + +class MedicationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + status: null, + manufacturer: (value) => ReferenceSerializer.serialize(value), + form: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => RatioSerializer.serialize(value), + ingredient: (value) => MedicationIngredientSerializer.serialize(value), + batch: (value) => MedicationBatchSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationSerializer.propertyToSerializerMap) { + if (MedicationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicationAdministration.js b/src/fhir/serializers/4_0_0/resources/medicationAdministration.js new file mode 100644 index 000000000..e0ca7255d --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicationAdministration.js @@ -0,0 +1,92 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const MedicationAdministrationPerformerSerializer = require('../backbone_elements/medicationAdministrationPerformer.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const MedicationAdministrationDosageSerializer = require('../backbone_elements/medicationAdministrationDosage.js'); + +class MedicationAdministrationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiates: null, + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + medicationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + medicationReference: (value) => ReferenceSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + context: (value) => ReferenceSerializer.serialize(value), + supportingInformation: (value) => ReferenceSerializer.serialize(value), + effectiveDateTime: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + performer: (value) => MedicationAdministrationPerformerSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + dosage: (value) => MedicationAdministrationDosageSerializer.serialize(value), + eventHistory: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationAdministrationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationAdministrationSerializer.propertyToSerializerMap) { + if (MedicationAdministrationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationAdministrationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationAdministrationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicationDispense.js b/src/fhir/serializers/4_0_0/resources/medicationDispense.js new file mode 100644 index 000000000..8f85b23e1 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicationDispense.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MedicationDispensePerformerSerializer = require('../backbone_elements/medicationDispensePerformer.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MedicationDispenseSubstitutionSerializer = require('../backbone_elements/medicationDispenseSubstitution.js'); + +class MedicationDispenseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReasonCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + statusReasonReference: (value) => ReferenceSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + medicationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + medicationReference: (value) => ReferenceSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + context: (value) => ReferenceSerializer.serialize(value), + supportingInformation: (value) => ReferenceSerializer.serialize(value), + performer: (value) => MedicationDispensePerformerSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + authorizingPrescription: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + daysSupply: (value) => QuantitySerializer.serialize(value), + whenPrepared: null, + whenHandedOver: null, + destination: (value) => ReferenceSerializer.serialize(value), + receiver: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + dosageInstruction: (value) => DosageSerializer.serialize(value), + substitution: (value) => MedicationDispenseSubstitutionSerializer.serialize(value), + detectedIssue: (value) => ReferenceSerializer.serialize(value), + eventHistory: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationDispenseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationDispenseSerializer.propertyToSerializerMap) { + if (MedicationDispenseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationDispenseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationDispenseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicationKnowledge.js b/src/fhir/serializers/4_0_0/resources/medicationKnowledge.js new file mode 100644 index 000000000..f2d0c7c56 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicationKnowledge.js @@ -0,0 +1,100 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MedicationKnowledgeRelatedMedicationKnowledgeSerializer = require('../backbone_elements/medicationKnowledgeRelatedMedicationKnowledge.js'); +const MedicationKnowledgeMonographSerializer = require('../backbone_elements/medicationKnowledgeMonograph.js'); +const MedicationKnowledgeIngredientSerializer = require('../backbone_elements/medicationKnowledgeIngredient.js'); +const MedicationKnowledgeCostSerializer = require('../backbone_elements/medicationKnowledgeCost.js'); +const MedicationKnowledgeMonitoringProgramSerializer = require('../backbone_elements/medicationKnowledgeMonitoringProgram.js'); +const MedicationKnowledgeAdministrationGuidelinesSerializer = require('../backbone_elements/medicationKnowledgeAdministrationGuidelines.js'); +const MedicationKnowledgeMedicineClassificationSerializer = require('../backbone_elements/medicationKnowledgeMedicineClassification.js'); +const MedicationKnowledgePackagingSerializer = require('../backbone_elements/medicationKnowledgePackaging.js'); +const MedicationKnowledgeDrugCharacteristicSerializer = require('../backbone_elements/medicationKnowledgeDrugCharacteristic.js'); +const MedicationKnowledgeRegulatorySerializer = require('../backbone_elements/medicationKnowledgeRegulatory.js'); +const MedicationKnowledgeKineticsSerializer = require('../backbone_elements/medicationKnowledgeKinetics.js'); + +class MedicationKnowledgeSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + status: null, + manufacturer: (value) => ReferenceSerializer.serialize(value), + doseForm: (value) => CodeableConceptSerializer.serialize(value), + amount: (value) => QuantitySerializer.serialize(value), + synonym: null, + relatedMedicationKnowledge: (value) => MedicationKnowledgeRelatedMedicationKnowledgeSerializer.serialize(value), + associatedMedication: (value) => ReferenceSerializer.serialize(value), + productType: (value) => CodeableConceptSerializer.serialize(value), + monograph: (value) => MedicationKnowledgeMonographSerializer.serialize(value), + ingredient: (value) => MedicationKnowledgeIngredientSerializer.serialize(value), + preparationInstruction: null, + intendedRoute: (value) => CodeableConceptSerializer.serialize(value), + cost: (value) => MedicationKnowledgeCostSerializer.serialize(value), + monitoringProgram: (value) => MedicationKnowledgeMonitoringProgramSerializer.serialize(value), + administrationGuidelines: (value) => MedicationKnowledgeAdministrationGuidelinesSerializer.serialize(value), + medicineClassification: (value) => MedicationKnowledgeMedicineClassificationSerializer.serialize(value), + packaging: (value) => MedicationKnowledgePackagingSerializer.serialize(value), + drugCharacteristic: (value) => MedicationKnowledgeDrugCharacteristicSerializer.serialize(value), + contraindication: (value) => ReferenceSerializer.serialize(value), + regulatory: (value) => MedicationKnowledgeRegulatorySerializer.serialize(value), + kinetics: (value) => MedicationKnowledgeKineticsSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationKnowledgeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationKnowledgeSerializer.propertyToSerializerMap) { + if (MedicationKnowledgeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationKnowledgeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationKnowledgeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicationRequest.js b/src/fhir/serializers/4_0_0/resources/medicationRequest.js new file mode 100644 index 000000000..8bcfa4a1b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicationRequest.js @@ -0,0 +1,105 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); +const MedicationRequestDispenseRequestSerializer = require('../backbone_elements/medicationRequestDispenseRequest.js'); +const MedicationRequestSubstitutionSerializer = require('../backbone_elements/medicationRequestSubstitution.js'); + +class MedicationRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + intent: null, + category: (value) => CodeableConceptSerializer.serialize(value), + priority: null, + doNotPerform: null, + reportedBoolean: null, + reportedReference: (value) => ReferenceSerializer.serialize(value), + medicationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + medicationReference: (value) => ReferenceSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + supportingInformation: (value) => ReferenceSerializer.serialize(value), + authoredOn: null, + requester: (value) => ReferenceSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + performerType: (value) => CodeableConceptSerializer.serialize(value), + recorder: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + groupIdentifier: (value) => IdentifierSerializer.serialize(value), + courseOfTherapyType: (value) => CodeableConceptSerializer.serialize(value), + insurance: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + dosageInstruction: (value) => DosageSerializer.serialize(value), + dispenseRequest: (value) => MedicationRequestDispenseRequestSerializer.serialize(value), + substitution: (value) => MedicationRequestSubstitutionSerializer.serialize(value), + priorPrescription: (value) => ReferenceSerializer.serialize(value), + detectedIssue: (value) => ReferenceSerializer.serialize(value), + eventHistory: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationRequestSerializer.propertyToSerializerMap) { + if (MedicationRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicationStatement.js b/src/fhir/serializers/4_0_0/resources/medicationStatement.js new file mode 100644 index 000000000..cd39ff74d --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicationStatement.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const DosageSerializer = require('../backbone_elements/dosage.js'); + +class MedicationStatementSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + medicationCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + medicationReference: (value) => ReferenceSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + context: (value) => ReferenceSerializer.serialize(value), + effectiveDateTime: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + dateAsserted: null, + informationSource: (value) => ReferenceSerializer.serialize(value), + derivedFrom: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + dosage: (value) => DosageSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicationStatementSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicationStatementSerializer.propertyToSerializerMap) { + if (MedicationStatementSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicationStatementSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicationStatementSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/medicinalProductDefinition.js b/src/fhir/serializers/4_0_0/resources/medicinalProductDefinition.js new file mode 100644 index 000000000..2141d2f18 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/medicinalProductDefinition.js @@ -0,0 +1,103 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MarketingStatusSerializer = require('../backbone_elements/marketingStatus.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MedicinalProductDefinitionContactSerializer = require('../backbone_elements/medicinalProductDefinitionContact.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const MedicinalProductDefinitionNameSerializer = require('../backbone_elements/medicinalProductDefinitionName.js'); +const MedicinalProductDefinitionCrossReferenceSerializer = require('../backbone_elements/medicinalProductDefinitionCrossReference.js'); +const MedicinalProductDefinitionOperationSerializer = require('../backbone_elements/medicinalProductDefinitionOperation.js'); +const MedicinalProductDefinitionCharacteristicSerializer = require('../backbone_elements/medicinalProductDefinitionCharacteristic.js'); + +class MedicinalProductDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + domain: (value) => CodeableConceptSerializer.serialize(value), + version: null, + status: (value) => CodeableConceptSerializer.serialize(value), + statusDate: null, + description: null, + combinedPharmaceuticalDoseForm: (value) => CodeableConceptSerializer.serialize(value), + route: (value) => CodeableConceptSerializer.serialize(value), + indication: null, + legalStatusOfSupply: (value) => CodeableConceptSerializer.serialize(value), + additionalMonitoringIndicator: (value) => CodeableConceptSerializer.serialize(value), + specialMeasures: (value) => CodeableConceptSerializer.serialize(value), + pediatricUseIndicator: (value) => CodeableConceptSerializer.serialize(value), + classification: (value) => CodeableConceptSerializer.serialize(value), + marketingStatus: (value) => MarketingStatusSerializer.serialize(value), + packagedMedicinalProduct: (value) => CodeableConceptSerializer.serialize(value), + ingredient: (value) => CodeableConceptSerializer.serialize(value), + impurity: (value) => CodeableReferenceSerializer.serialize(value), + attachedDocument: (value) => ReferenceSerializer.serialize(value), + masterFile: (value) => ReferenceSerializer.serialize(value), + contact: (value) => MedicinalProductDefinitionContactSerializer.serialize(value), + clinicalTrial: (value) => ReferenceSerializer.serialize(value), + code: (value) => CodingSerializer.serialize(value), + name: (value) => MedicinalProductDefinitionNameSerializer.serialize(value), + crossReference: (value) => MedicinalProductDefinitionCrossReferenceSerializer.serialize(value), + operation: (value) => MedicinalProductDefinitionOperationSerializer.serialize(value), + characteristic: (value) => MedicinalProductDefinitionCharacteristicSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MedicinalProductDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MedicinalProductDefinitionSerializer.propertyToSerializerMap) { + if (MedicinalProductDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MedicinalProductDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MedicinalProductDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/messageDefinition.js b/src/fhir/serializers/4_0_0/resources/messageDefinition.js new file mode 100644 index 000000000..3ba6d552c --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/messageDefinition.js @@ -0,0 +1,96 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const MessageDefinitionFocusSerializer = require('../backbone_elements/messageDefinitionFocus.js'); +const MessageDefinitionAllowedResponseSerializer = require('../backbone_elements/messageDefinitionAllowedResponse.js'); + +class MessageDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + replaces: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + base: null, + parent: null, + eventCoding: (value) => CodingSerializer.serialize(value), + eventUri: null, + category: null, + focus: (value) => MessageDefinitionFocusSerializer.serialize(value), + responseRequired: null, + allowedResponse: (value) => MessageDefinitionAllowedResponseSerializer.serialize(value), + graph: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageDefinitionSerializer.propertyToSerializerMap) { + if (MessageDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/messageHeader.js b/src/fhir/serializers/4_0_0/resources/messageHeader.js new file mode 100644 index 000000000..1ddb3ba05 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/messageHeader.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const MessageHeaderDestinationSerializer = require('../backbone_elements/messageHeaderDestination.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MessageHeaderSourceSerializer = require('../backbone_elements/messageHeaderSource.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const MessageHeaderResponseSerializer = require('../backbone_elements/messageHeaderResponse.js'); + +class MessageHeaderSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + eventCoding: (value) => CodingSerializer.serialize(value), + eventUri: null, + destination: (value) => MessageHeaderDestinationSerializer.serialize(value), + sender: (value) => ReferenceSerializer.serialize(value), + enterer: (value) => ReferenceSerializer.serialize(value), + author: (value) => ReferenceSerializer.serialize(value), + source: (value) => MessageHeaderSourceSerializer.serialize(value), + responsible: (value) => ReferenceSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + response: (value) => MessageHeaderResponseSerializer.serialize(value), + focus: (value) => ReferenceSerializer.serialize(value), + definition: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MessageHeaderSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MessageHeaderSerializer.propertyToSerializerMap) { + if (MessageHeaderSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MessageHeaderSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MessageHeaderSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/molecularSequence.js b/src/fhir/serializers/4_0_0/resources/molecularSequence.js new file mode 100644 index 000000000..b4af14311 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/molecularSequence.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const MolecularSequenceReferenceSeqSerializer = require('../backbone_elements/molecularSequenceReferenceSeq.js'); +const MolecularSequenceVariantSerializer = require('../backbone_elements/molecularSequenceVariant.js'); +const MolecularSequenceQualitySerializer = require('../backbone_elements/molecularSequenceQuality.js'); +const MolecularSequenceRepositorySerializer = require('../backbone_elements/molecularSequenceRepository.js'); +const MolecularSequenceStructureVariantSerializer = require('../backbone_elements/molecularSequenceStructureVariant.js'); + +class MolecularSequenceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + type: null, + coordinateSystem: null, + patient: (value) => ReferenceSerializer.serialize(value), + specimen: (value) => ReferenceSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + referenceSeq: (value) => MolecularSequenceReferenceSeqSerializer.serialize(value), + variant: (value) => MolecularSequenceVariantSerializer.serialize(value), + observedSeq: null, + quality: (value) => MolecularSequenceQualitySerializer.serialize(value), + readCoverage: null, + repository: (value) => MolecularSequenceRepositorySerializer.serialize(value), + pointer: (value) => ReferenceSerializer.serialize(value), + structureVariant: (value) => MolecularSequenceStructureVariantSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => MolecularSequenceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in MolecularSequenceSerializer.propertyToSerializerMap) { + if (MolecularSequenceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = MolecularSequenceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = MolecularSequenceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/namingSystem.js b/src/fhir/serializers/4_0_0/resources/namingSystem.js new file mode 100644 index 000000000..cdcd02079 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/namingSystem.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const NamingSystemUniqueIdSerializer = require('../backbone_elements/namingSystemUniqueId.js'); + +class NamingSystemSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + name: null, + status: null, + kind: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + responsible: null, + type: (value) => CodeableConceptSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + usage: null, + uniqueId: (value) => NamingSystemUniqueIdSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NamingSystemSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NamingSystemSerializer.propertyToSerializerMap) { + if (NamingSystemSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NamingSystemSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NamingSystemSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/nutritionOrder.js b/src/fhir/serializers/4_0_0/resources/nutritionOrder.js new file mode 100644 index 000000000..029e9f567 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/nutritionOrder.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const NutritionOrderOralDietSerializer = require('../backbone_elements/nutritionOrderOralDiet.js'); +const NutritionOrderSupplementSerializer = require('../backbone_elements/nutritionOrderSupplement.js'); +const NutritionOrderEnteralFormulaSerializer = require('../backbone_elements/nutritionOrderEnteralFormula.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class NutritionOrderSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + instantiates: null, + status: null, + intent: null, + patient: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + dateTime: null, + orderer: (value) => ReferenceSerializer.serialize(value), + allergyIntolerance: (value) => ReferenceSerializer.serialize(value), + foodPreferenceModifier: (value) => CodeableConceptSerializer.serialize(value), + excludeFoodModifier: (value) => CodeableConceptSerializer.serialize(value), + oralDiet: (value) => NutritionOrderOralDietSerializer.serialize(value), + supplement: (value) => NutritionOrderSupplementSerializer.serialize(value), + enteralFormula: (value) => NutritionOrderEnteralFormulaSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionOrderSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionOrderSerializer.propertyToSerializerMap) { + if (NutritionOrderSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionOrderSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionOrderSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/nutritionProduct.js b/src/fhir/serializers/4_0_0/resources/nutritionProduct.js new file mode 100644 index 000000000..bfa780215 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/nutritionProduct.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const NutritionProductNutrientSerializer = require('../backbone_elements/nutritionProductNutrient.js'); +const NutritionProductIngredientSerializer = require('../backbone_elements/nutritionProductIngredient.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const NutritionProductProductCharacteristicSerializer = require('../backbone_elements/nutritionProductProductCharacteristic.js'); +const NutritionProductInstanceSerializer = require('../backbone_elements/nutritionProductInstance.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class NutritionProductSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + manufacturer: (value) => ReferenceSerializer.serialize(value), + nutrient: (value) => NutritionProductNutrientSerializer.serialize(value), + ingredient: (value) => NutritionProductIngredientSerializer.serialize(value), + knownAllergen: (value) => CodeableReferenceSerializer.serialize(value), + productCharacteristic: (value) => NutritionProductProductCharacteristicSerializer.serialize(value), + instance: (value) => NutritionProductInstanceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => NutritionProductSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in NutritionProductSerializer.propertyToSerializerMap) { + if (NutritionProductSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = NutritionProductSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = NutritionProductSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/observation.js b/src/fhir/serializers/4_0_0/resources/observation.js new file mode 100644 index 000000000..19a7efeb7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/observation.js @@ -0,0 +1,113 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const SampledDataSerializer = require('../complex_types/sampledData.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ObservationReferenceRangeSerializer = require('../backbone_elements/observationReferenceRange.js'); +const ObservationComponentSerializer = require('../backbone_elements/observationComponent.js'); + +class ObservationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + focus: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + effectiveDateTime: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + effectiveTiming: (value) => TimingSerializer.serialize(value), + effectiveInstant: null, + issued: null, + performer: (value) => ReferenceSerializer.serialize(value), + valueQuantity: (value) => QuantitySerializer.serialize(value), + valueCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + valueString: null, + valueBoolean: null, + valueInteger: null, + valueRange: (value) => RangeSerializer.serialize(value), + valueRatio: (value) => RatioSerializer.serialize(value), + valueSampledData: (value) => SampledDataSerializer.serialize(value), + valueTime: null, + valueDateTime: null, + valuePeriod: (value) => PeriodSerializer.serialize(value), + dataAbsentReason: (value) => CodeableConceptSerializer.serialize(value), + interpretation: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + method: (value) => CodeableConceptSerializer.serialize(value), + specimen: (value) => ReferenceSerializer.serialize(value), + device: (value) => ReferenceSerializer.serialize(value), + referenceRange: (value) => ObservationReferenceRangeSerializer.serialize(value), + hasMember: (value) => ReferenceSerializer.serialize(value), + derivedFrom: (value) => ReferenceSerializer.serialize(value), + component: (value) => ObservationComponentSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationSerializer.propertyToSerializerMap) { + if (ObservationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/observationDefinition.js b/src/fhir/serializers/4_0_0/resources/observationDefinition.js new file mode 100644 index 000000000..287cf49c3 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/observationDefinition.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ObservationDefinitionQuantitativeDetailsSerializer = require('../backbone_elements/observationDefinitionQuantitativeDetails.js'); +const ObservationDefinitionQualifiedIntervalSerializer = require('../backbone_elements/observationDefinitionQualifiedInterval.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ObservationDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + permittedDataType: null, + multipleResultsAllowed: null, + method: (value) => CodeableConceptSerializer.serialize(value), + preferredReportName: null, + quantitativeDetails: (value) => ObservationDefinitionQuantitativeDetailsSerializer.serialize(value), + qualifiedInterval: (value) => ObservationDefinitionQualifiedIntervalSerializer.serialize(value), + validCodedValueSet: (value) => ReferenceSerializer.serialize(value), + normalCodedValueSet: (value) => ReferenceSerializer.serialize(value), + abnormalCodedValueSet: (value) => ReferenceSerializer.serialize(value), + criticalCodedValueSet: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ObservationDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ObservationDefinitionSerializer.propertyToSerializerMap) { + if (ObservationDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ObservationDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ObservationDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/operationDefinition.js b/src/fhir/serializers/4_0_0/resources/operationDefinition.js new file mode 100644 index 000000000..862c43182 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/operationDefinition.js @@ -0,0 +1,95 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const OperationDefinitionParameterSerializer = require('../backbone_elements/operationDefinitionParameter.js'); +const OperationDefinitionOverloadSerializer = require('../backbone_elements/operationDefinitionOverload.js'); + +class OperationDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + title: null, + status: null, + kind: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + affectsState: null, + code: null, + comment: null, + base: null, + resource: null, + system: null, + type: null, + instance: null, + inputProfile: null, + outputProfile: null, + parameter: (value) => OperationDefinitionParameterSerializer.serialize(value), + overload: (value) => OperationDefinitionOverloadSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationDefinitionSerializer.propertyToSerializerMap) { + if (OperationDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/operationOutcome.js b/src/fhir/serializers/4_0_0/resources/operationOutcome.js new file mode 100644 index 000000000..62e558096 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/operationOutcome.js @@ -0,0 +1,66 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const OperationOutcomeIssueSerializer = require('../backbone_elements/operationOutcomeIssue.js'); + +class OperationOutcomeSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + issue: (value) => OperationOutcomeIssueSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OperationOutcomeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OperationOutcomeSerializer.propertyToSerializerMap) { + if (OperationOutcomeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OperationOutcomeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OperationOutcomeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/organization.js b/src/fhir/serializers/4_0_0/resources/organization.js new file mode 100644 index 000000000..02dc62b6a --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/organization.js @@ -0,0 +1,80 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const OrganizationContactSerializer = require('../backbone_elements/organizationContact.js'); + +class OrganizationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + type: (value) => CodeableConceptSerializer.serialize(value), + name: null, + alias: null, + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + contact: (value) => OrganizationContactSerializer.serialize(value), + endpoint: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OrganizationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OrganizationSerializer.propertyToSerializerMap) { + if (OrganizationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OrganizationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OrganizationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/organizationAffiliation.js b/src/fhir/serializers/4_0_0/resources/organizationAffiliation.js new file mode 100644 index 000000000..7bf4cdec6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/organizationAffiliation.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); + +class OrganizationAffiliationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + period: (value) => PeriodSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + participatingOrganization: (value) => ReferenceSerializer.serialize(value), + network: (value) => ReferenceSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + healthcareService: (value) => ReferenceSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + endpoint: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => OrganizationAffiliationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in OrganizationAffiliationSerializer.propertyToSerializerMap) { + if (OrganizationAffiliationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = OrganizationAffiliationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = OrganizationAffiliationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/packagedProductDefinition.js b/src/fhir/serializers/4_0_0/resources/packagedProductDefinition.js new file mode 100644 index 000000000..2c4093c74 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/packagedProductDefinition.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const PackagedProductDefinitionLegalStatusOfSupplySerializer = require('../backbone_elements/packagedProductDefinitionLegalStatusOfSupply.js'); +const MarketingStatusSerializer = require('../backbone_elements/marketingStatus.js'); +const PackagedProductDefinitionPackageSerializer = require('../backbone_elements/packagedProductDefinitionPackage.js'); + +class PackagedProductDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + name: null, + type: (value) => CodeableConceptSerializer.serialize(value), + packageFor: (value) => ReferenceSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + statusDate: null, + containedItemQuantity: (value) => QuantitySerializer.serialize(value), + description: null, + legalStatusOfSupply: (value) => PackagedProductDefinitionLegalStatusOfSupplySerializer.serialize(value), + marketingStatus: (value) => MarketingStatusSerializer.serialize(value), + characteristic: (value) => CodeableConceptSerializer.serialize(value), + copackagedIndicator: null, + manufacturer: (value) => ReferenceSerializer.serialize(value), + package: (value) => PackagedProductDefinitionPackageSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PackagedProductDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PackagedProductDefinitionSerializer.propertyToSerializerMap) { + if (PackagedProductDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PackagedProductDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PackagedProductDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/parameters.js b/src/fhir/serializers/4_0_0/resources/parameters.js new file mode 100644 index 000000000..a09fc0566 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/parameters.js @@ -0,0 +1,59 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const ParametersParameterSerializer = require('../backbone_elements/parametersParameter.js'); + +class ParametersSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + parameter: (value) => ParametersParameterSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ParametersSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ParametersSerializer.propertyToSerializerMap) { + if (ParametersSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ParametersSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ParametersSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/patient.js b/src/fhir/serializers/4_0_0/resources/patient.js new file mode 100644 index 000000000..c34b06a5a --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/patient.js @@ -0,0 +1,92 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const PatientContactSerializer = require('../backbone_elements/patientContact.js'); +const PatientCommunicationSerializer = require('../backbone_elements/patientCommunication.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PatientLinkSerializer = require('../backbone_elements/patientLink.js'); + +class PatientSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + gender: null, + birthDate: null, + deceasedBoolean: null, + deceasedDateTime: null, + address: (value) => AddressSerializer.serialize(value), + maritalStatus: (value) => CodeableConceptSerializer.serialize(value), + multipleBirthBoolean: null, + multipleBirthInteger: null, + photo: (value) => AttachmentSerializer.serialize(value), + contact: (value) => PatientContactSerializer.serialize(value), + communication: (value) => PatientCommunicationSerializer.serialize(value), + generalPractitioner: (value) => ReferenceSerializer.serialize(value), + managingOrganization: (value) => ReferenceSerializer.serialize(value), + link: (value) => PatientLinkSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PatientSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PatientSerializer.propertyToSerializerMap) { + if (PatientSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PatientSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PatientSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/paymentNotice.js b/src/fhir/serializers/4_0_0/resources/paymentNotice.js new file mode 100644 index 000000000..d2ce9522e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/paymentNotice.js @@ -0,0 +1,80 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MoneySerializer = require('../complex_types/money.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PaymentNoticeSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + request: (value) => ReferenceSerializer.serialize(value), + response: (value) => ReferenceSerializer.serialize(value), + created: null, + provider: (value) => ReferenceSerializer.serialize(value), + payment: (value) => ReferenceSerializer.serialize(value), + paymentDate: null, + payee: (value) => ReferenceSerializer.serialize(value), + recipient: (value) => ReferenceSerializer.serialize(value), + amount: (value) => MoneySerializer.serialize(value), + paymentStatus: (value) => CodeableConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PaymentNoticeSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PaymentNoticeSerializer.propertyToSerializerMap) { + if (PaymentNoticeSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PaymentNoticeSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PaymentNoticeSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/paymentReconciliation.js b/src/fhir/serializers/4_0_0/resources/paymentReconciliation.js new file mode 100644 index 000000000..a80a2f68e --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/paymentReconciliation.js @@ -0,0 +1,86 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const MoneySerializer = require('../complex_types/money.js'); +const PaymentReconciliationDetailSerializer = require('../backbone_elements/paymentReconciliationDetail.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PaymentReconciliationProcessNoteSerializer = require('../backbone_elements/paymentReconciliationProcessNote.js'); + +class PaymentReconciliationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + period: (value) => PeriodSerializer.serialize(value), + created: null, + paymentIssuer: (value) => ReferenceSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + requestor: (value) => ReferenceSerializer.serialize(value), + outcome: null, + disposition: null, + paymentDate: null, + paymentAmount: (value) => MoneySerializer.serialize(value), + paymentIdentifier: (value) => IdentifierSerializer.serialize(value), + detail: (value) => PaymentReconciliationDetailSerializer.serialize(value), + formCode: (value) => CodeableConceptSerializer.serialize(value), + processNote: (value) => PaymentReconciliationProcessNoteSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PaymentReconciliationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PaymentReconciliationSerializer.propertyToSerializerMap) { + if (PaymentReconciliationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PaymentReconciliationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PaymentReconciliationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/person.js b/src/fhir/serializers/4_0_0/resources/person.js new file mode 100644 index 000000000..5a0844468 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/person.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PersonLinkSerializer = require('../backbone_elements/personLink.js'); + +class PersonSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + gender: null, + birthDate: null, + address: (value) => AddressSerializer.serialize(value), + photo: (value) => AttachmentSerializer.serialize(value), + managingOrganization: (value) => ReferenceSerializer.serialize(value), + active: null, + link: (value) => PersonLinkSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PersonSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PersonSerializer.propertyToSerializerMap) { + if (PersonSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PersonSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PersonSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/planDefinition.js b/src/fhir/serializers/4_0_0/resources/planDefinition.js new file mode 100644 index 000000000..3bae748e6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/planDefinition.js @@ -0,0 +1,106 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const PlanDefinitionGoalSerializer = require('../backbone_elements/planDefinitionGoal.js'); +const PlanDefinitionActionSerializer = require('../backbone_elements/planDefinitionAction.js'); + +class PlanDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + subtitle: null, + type: (value) => CodeableConceptSerializer.serialize(value), + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + subjectCanonical: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + library: null, + goal: (value) => PlanDefinitionGoalSerializer.serialize(value), + action: (value) => PlanDefinitionActionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PlanDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PlanDefinitionSerializer.propertyToSerializerMap) { + if (PlanDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PlanDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PlanDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/practitioner.js b/src/fhir/serializers/4_0_0/resources/practitioner.js new file mode 100644 index 000000000..a0149336b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/practitioner.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const PractitionerQualificationSerializer = require('../backbone_elements/practitionerQualification.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class PractitionerSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + address: (value) => AddressSerializer.serialize(value), + gender: null, + birthDate: null, + photo: (value) => AttachmentSerializer.serialize(value), + qualification: (value) => PractitionerQualificationSerializer.serialize(value), + communication: (value) => CodeableConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PractitionerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PractitionerSerializer.propertyToSerializerMap) { + if (PractitionerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PractitionerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PractitionerSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/practitionerRole.js b/src/fhir/serializers/4_0_0/resources/practitionerRole.js new file mode 100644 index 000000000..55644e107 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/practitionerRole.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const PractitionerRoleAvailableTimeSerializer = require('../backbone_elements/practitionerRoleAvailableTime.js'); +const PractitionerRoleNotAvailableSerializer = require('../backbone_elements/practitionerRoleNotAvailable.js'); + +class PractitionerRoleSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + period: (value) => PeriodSerializer.serialize(value), + practitioner: (value) => ReferenceSerializer.serialize(value), + organization: (value) => ReferenceSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + healthcareService: (value) => ReferenceSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + availableTime: (value) => PractitionerRoleAvailableTimeSerializer.serialize(value), + notAvailable: (value) => PractitionerRoleNotAvailableSerializer.serialize(value), + availabilityExceptions: null, + endpoint: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => PractitionerRoleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in PractitionerRoleSerializer.propertyToSerializerMap) { + if (PractitionerRoleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = PractitionerRoleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = PractitionerRoleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/procedure.js b/src/fhir/serializers/4_0_0/resources/procedure.js new file mode 100644 index 000000000..22e063c66 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/procedure.js @@ -0,0 +1,105 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RangeSerializer = require('../complex_types/range.js'); +const ProcedurePerformerSerializer = require('../backbone_elements/procedurePerformer.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ProcedureFocalDeviceSerializer = require('../backbone_elements/procedureFocalDevice.js'); + +class ProcedureSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + performedDateTime: null, + performedPeriod: (value) => PeriodSerializer.serialize(value), + performedString: null, + performedAge: (value) => QuantitySerializer.serialize(value), + performedRange: (value) => RangeSerializer.serialize(value), + recorder: (value) => ReferenceSerializer.serialize(value), + asserter: (value) => ReferenceSerializer.serialize(value), + performer: (value) => ProcedurePerformerSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + outcome: (value) => CodeableConceptSerializer.serialize(value), + report: (value) => ReferenceSerializer.serialize(value), + complication: (value) => CodeableConceptSerializer.serialize(value), + complicationDetail: (value) => ReferenceSerializer.serialize(value), + followUp: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + focalDevice: (value) => ProcedureFocalDeviceSerializer.serialize(value), + usedReference: (value) => ReferenceSerializer.serialize(value), + usedCode: (value) => CodeableConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProcedureSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProcedureSerializer.propertyToSerializerMap) { + if (ProcedureSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProcedureSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProcedureSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/provenance.js b/src/fhir/serializers/4_0_0/resources/provenance.js new file mode 100644 index 000000000..68ebe2ee5 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/provenance.js @@ -0,0 +1,81 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ProvenanceAgentSerializer = require('../backbone_elements/provenanceAgent.js'); +const ProvenanceEntitySerializer = require('../backbone_elements/provenanceEntity.js'); +const SignatureSerializer = require('../complex_types/signature.js'); + +class ProvenanceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + target: (value) => ReferenceSerializer.serialize(value), + occurredPeriod: (value) => PeriodSerializer.serialize(value), + occurredDateTime: null, + recorded: null, + policy: null, + location: (value) => ReferenceSerializer.serialize(value), + reason: (value) => CodeableConceptSerializer.serialize(value), + activity: (value) => CodeableConceptSerializer.serialize(value), + agent: (value) => ProvenanceAgentSerializer.serialize(value), + entity: (value) => ProvenanceEntitySerializer.serialize(value), + signature: (value) => SignatureSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ProvenanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ProvenanceSerializer.propertyToSerializerMap) { + if (ProvenanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ProvenanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ProvenanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/questionnaire.js b/src/fhir/serializers/4_0_0/resources/questionnaire.js new file mode 100644 index 000000000..d5bfb5a2d --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/questionnaire.js @@ -0,0 +1,93 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const QuestionnaireItemSerializer = require('../backbone_elements/questionnaireItem.js'); + +class QuestionnaireSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + derivedFrom: null, + status: null, + experimental: null, + subjectType: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + code: (value) => CodingSerializer.serialize(value), + item: (value) => QuestionnaireItemSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireSerializer.propertyToSerializerMap) { + if (QuestionnaireSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/questionnaireResponse.js b/src/fhir/serializers/4_0_0/resources/questionnaireResponse.js new file mode 100644 index 000000000..b14c65cc9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/questionnaireResponse.js @@ -0,0 +1,78 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuestionnaireResponseItemSerializer = require('../backbone_elements/questionnaireResponseItem.js'); + +class QuestionnaireResponseSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + questionnaire: null, + status: null, + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + authored: null, + author: (value) => ReferenceSerializer.serialize(value), + source: (value) => ReferenceSerializer.serialize(value), + item: (value) => QuestionnaireResponseItemSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => QuestionnaireResponseSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in QuestionnaireResponseSerializer.propertyToSerializerMap) { + if (QuestionnaireResponseSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = QuestionnaireResponseSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = QuestionnaireResponseSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/regulatedAuthorization.js b/src/fhir/serializers/4_0_0/resources/regulatedAuthorization.js new file mode 100644 index 000000000..5c712845f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/regulatedAuthorization.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const CodeableReferenceSerializer = require('../complex_types/codeableReference.js'); +const RegulatedAuthorizationCaseSerializer = require('../backbone_elements/regulatedAuthorizationCase.js'); + +class RegulatedAuthorizationSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + description: null, + region: (value) => CodeableConceptSerializer.serialize(value), + status: (value) => CodeableConceptSerializer.serialize(value), + statusDate: null, + validityPeriod: (value) => PeriodSerializer.serialize(value), + indication: (value) => CodeableReferenceSerializer.serialize(value), + intendedUse: (value) => CodeableConceptSerializer.serialize(value), + basis: (value) => CodeableConceptSerializer.serialize(value), + holder: (value) => ReferenceSerializer.serialize(value), + regulator: (value) => ReferenceSerializer.serialize(value), + case: (value) => RegulatedAuthorizationCaseSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RegulatedAuthorizationSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RegulatedAuthorizationSerializer.propertyToSerializerMap) { + if (RegulatedAuthorizationSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RegulatedAuthorizationSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RegulatedAuthorizationSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/relatedPerson.js b/src/fhir/serializers/4_0_0/resources/relatedPerson.js new file mode 100644 index 000000000..5febed3be --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/relatedPerson.js @@ -0,0 +1,85 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const HumanNameSerializer = require('../complex_types/humanName.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const AddressSerializer = require('../complex_types/address.js'); +const AttachmentSerializer = require('../complex_types/attachment.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedPersonCommunicationSerializer = require('../backbone_elements/relatedPersonCommunication.js'); + +class RelatedPersonSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + patient: (value) => ReferenceSerializer.serialize(value), + relationship: (value) => CodeableConceptSerializer.serialize(value), + name: (value) => HumanNameSerializer.serialize(value), + telecom: (value) => ContactPointSerializer.serialize(value), + gender: null, + birthDate: null, + address: (value) => AddressSerializer.serialize(value), + photo: (value) => AttachmentSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + communication: (value) => RelatedPersonCommunicationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RelatedPersonSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RelatedPersonSerializer.propertyToSerializerMap) { + if (RelatedPersonSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RelatedPersonSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RelatedPersonSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/requestGroup.js b/src/fhir/serializers/4_0_0/resources/requestGroup.js new file mode 100644 index 000000000..022d04edc --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/requestGroup.js @@ -0,0 +1,87 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const RequestGroupActionSerializer = require('../backbone_elements/requestGroupAction.js'); + +class RequestGroupSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + replaces: (value) => ReferenceSerializer.serialize(value), + groupIdentifier: (value) => IdentifierSerializer.serialize(value), + status: null, + intent: null, + priority: null, + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + authoredOn: null, + author: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + action: (value) => RequestGroupActionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RequestGroupSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RequestGroupSerializer.propertyToSerializerMap) { + if (RequestGroupSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RequestGroupSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RequestGroupSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/researchDefinition.js b/src/fhir/serializers/4_0_0/resources/researchDefinition.js new file mode 100644 index 000000000..6436b23fd --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/researchDefinition.js @@ -0,0 +1,106 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); + +class ResearchDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + shortTitle: null, + subtitle: null, + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + comment: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + library: null, + population: (value) => ReferenceSerializer.serialize(value), + exposure: (value) => ReferenceSerializer.serialize(value), + exposureAlternative: (value) => ReferenceSerializer.serialize(value), + outcome: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchDefinitionSerializer.propertyToSerializerMap) { + if (ResearchDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/researchElementDefinition.js b/src/fhir/serializers/4_0_0/resources/researchElementDefinition.js new file mode 100644 index 000000000..23415ea37 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/researchElementDefinition.js @@ -0,0 +1,106 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const ResearchElementDefinitionCharacteristicSerializer = require('../backbone_elements/researchElementDefinitionCharacteristic.js'); + +class ResearchElementDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + shortTitle: null, + subtitle: null, + status: null, + experimental: null, + subjectCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + subjectReference: (value) => ReferenceSerializer.serialize(value), + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + comment: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + usage: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + topic: (value) => CodeableConceptSerializer.serialize(value), + author: (value) => ContactDetailSerializer.serialize(value), + editor: (value) => ContactDetailSerializer.serialize(value), + reviewer: (value) => ContactDetailSerializer.serialize(value), + endorser: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + library: null, + type: null, + variableType: null, + characteristic: (value) => ResearchElementDefinitionCharacteristicSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchElementDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchElementDefinitionSerializer.propertyToSerializerMap) { + if (ResearchElementDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchElementDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchElementDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/researchStudy.js b/src/fhir/serializers/4_0_0/resources/researchStudy.js new file mode 100644 index 000000000..ab59c56d9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/researchStudy.js @@ -0,0 +1,97 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const RelatedArtifactSerializer = require('../complex_types/relatedArtifact.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const ResearchStudyArmSerializer = require('../backbone_elements/researchStudyArm.js'); +const ResearchStudyObjectiveSerializer = require('../backbone_elements/researchStudyObjective.js'); + +class ResearchStudySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + title: null, + protocol: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + primaryPurposeType: (value) => CodeableConceptSerializer.serialize(value), + phase: (value) => CodeableConceptSerializer.serialize(value), + category: (value) => CodeableConceptSerializer.serialize(value), + focus: (value) => CodeableConceptSerializer.serialize(value), + condition: (value) => CodeableConceptSerializer.serialize(value), + contact: (value) => ContactDetailSerializer.serialize(value), + relatedArtifact: (value) => RelatedArtifactSerializer.serialize(value), + keyword: (value) => CodeableConceptSerializer.serialize(value), + location: (value) => CodeableConceptSerializer.serialize(value), + description: null, + enrollment: (value) => ReferenceSerializer.serialize(value), + period: (value) => PeriodSerializer.serialize(value), + sponsor: (value) => ReferenceSerializer.serialize(value), + principalInvestigator: (value) => ReferenceSerializer.serialize(value), + site: (value) => ReferenceSerializer.serialize(value), + reasonStopped: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + arm: (value) => ResearchStudyArmSerializer.serialize(value), + objective: (value) => ResearchStudyObjectiveSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchStudySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchStudySerializer.propertyToSerializerMap) { + if (ResearchStudySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchStudySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchStudySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/researchSubject.js b/src/fhir/serializers/4_0_0/resources/researchSubject.js new file mode 100644 index 000000000..80fe678af --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/researchSubject.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class ResearchSubjectSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + period: (value) => PeriodSerializer.serialize(value), + study: (value) => ReferenceSerializer.serialize(value), + individual: (value) => ReferenceSerializer.serialize(value), + assignedArm: null, + actualArm: null, + consent: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResearchSubjectSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResearchSubjectSerializer.propertyToSerializerMap) { + if (ResearchSubjectSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResearchSubjectSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResearchSubjectSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/resource.js b/src/fhir/serializers/4_0_0/resources/resource.js new file mode 100644 index 000000000..f19b6bcc9 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/resource.js @@ -0,0 +1,57 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); + +class ResourceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResourceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResourceSerializer.propertyToSerializerMap) { + if (ResourceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResourceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResourceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/riskAssessment.js b/src/fhir/serializers/4_0_0/resources/riskAssessment.js new file mode 100644 index 000000000..6f015785b --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/riskAssessment.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const RiskAssessmentPredictionSerializer = require('../backbone_elements/riskAssessmentPrediction.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class RiskAssessmentSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + parent: (value) => ReferenceSerializer.serialize(value), + status: null, + method: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + condition: (value) => ReferenceSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + basis: (value) => ReferenceSerializer.serialize(value), + prediction: (value) => RiskAssessmentPredictionSerializer.serialize(value), + mitigation: null, + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => RiskAssessmentSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in RiskAssessmentSerializer.propertyToSerializerMap) { + if (RiskAssessmentSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = RiskAssessmentSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = RiskAssessmentSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/schedule.js b/src/fhir/serializers/4_0_0/resources/schedule.js new file mode 100644 index 000000000..39707fe2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/schedule.js @@ -0,0 +1,76 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const PeriodSerializer = require('../complex_types/period.js'); + +class ScheduleSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + active: null, + serviceCategory: (value) => CodeableConceptSerializer.serialize(value), + serviceType: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + actor: (value) => ReferenceSerializer.serialize(value), + planningHorizon: (value) => PeriodSerializer.serialize(value), + comment: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ScheduleSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ScheduleSerializer.propertyToSerializerMap) { + if (ScheduleSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ScheduleSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ScheduleSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/searchParameter.js b/src/fhir/serializers/4_0_0/resources/searchParameter.js new file mode 100644 index 000000000..087815a80 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/searchParameter.js @@ -0,0 +1,94 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SearchParameterComponentSerializer = require('../backbone_elements/searchParameterComponent.js'); + +class SearchParameterSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + derivedFrom: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + code: null, + base: null, + type: null, + expression: null, + xpath: null, + xpathUsage: null, + target: null, + multipleOr: null, + multipleAnd: null, + comparator: null, + modifier: null, + chain: null, + component: (value) => SearchParameterComponentSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SearchParameterSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SearchParameterSerializer.propertyToSerializerMap) { + if (SearchParameterSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SearchParameterSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SearchParameterSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/serviceRequest.js b/src/fhir/serializers/4_0_0/resources/serviceRequest.js new file mode 100644 index 000000000..3540a7d45 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/serviceRequest.js @@ -0,0 +1,111 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const RatioSerializer = require('../complex_types/ratio.js'); +const RangeSerializer = require('../complex_types/range.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class ServiceRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + replaces: (value) => ReferenceSerializer.serialize(value), + requisition: (value) => IdentifierSerializer.serialize(value), + status: null, + intent: null, + category: (value) => CodeableConceptSerializer.serialize(value), + priority: null, + doNotPerform: null, + code: (value) => CodeableConceptSerializer.serialize(value), + orderDetail: (value) => CodeableConceptSerializer.serialize(value), + quantityQuantity: (value) => QuantitySerializer.serialize(value), + quantityRatio: (value) => RatioSerializer.serialize(value), + quantityRange: (value) => RangeSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + asNeededBoolean: null, + asNeededCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + authoredOn: null, + requester: (value) => ReferenceSerializer.serialize(value), + performerType: (value) => CodeableConceptSerializer.serialize(value), + performer: (value) => ReferenceSerializer.serialize(value), + locationCode: (value) => CodeableConceptSerializer.serialize(value), + locationReference: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + insurance: (value) => ReferenceSerializer.serialize(value), + supportingInfo: (value) => ReferenceSerializer.serialize(value), + specimen: (value) => ReferenceSerializer.serialize(value), + bodySite: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + patientInstruction: null, + relevantHistory: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ServiceRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ServiceRequestSerializer.propertyToSerializerMap) { + if (ServiceRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ServiceRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ServiceRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/slot.js b/src/fhir/serializers/4_0_0/resources/slot.js new file mode 100644 index 000000000..36bdcbd79 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/slot.js @@ -0,0 +1,78 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); + +class SlotSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + serviceCategory: (value) => CodeableConceptSerializer.serialize(value), + serviceType: (value) => CodeableConceptSerializer.serialize(value), + specialty: (value) => CodeableConceptSerializer.serialize(value), + appointmentType: (value) => CodeableConceptSerializer.serialize(value), + schedule: (value) => ReferenceSerializer.serialize(value), + status: null, + start: null, + end: null, + overbooked: null, + comment: null, + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SlotSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SlotSerializer.propertyToSerializerMap) { + if (SlotSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SlotSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SlotSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/specimen.js b/src/fhir/serializers/4_0_0/resources/specimen.js new file mode 100644 index 000000000..fc7c18b2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/specimen.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const SpecimenCollectionSerializer = require('../backbone_elements/specimenCollection.js'); +const SpecimenProcessingSerializer = require('../backbone_elements/specimenProcessing.js'); +const SpecimenContainerSerializer = require('../backbone_elements/specimenContainer.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); + +class SpecimenSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + accessionIdentifier: (value) => IdentifierSerializer.serialize(value), + status: null, + type: (value) => CodeableConceptSerializer.serialize(value), + subject: (value) => ReferenceSerializer.serialize(value), + receivedTime: null, + parent: (value) => ReferenceSerializer.serialize(value), + request: (value) => ReferenceSerializer.serialize(value), + collection: (value) => SpecimenCollectionSerializer.serialize(value), + processing: (value) => SpecimenProcessingSerializer.serialize(value), + container: (value) => SpecimenContainerSerializer.serialize(value), + condition: (value) => CodeableConceptSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenSerializer.propertyToSerializerMap) { + if (SpecimenSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/specimenDefinition.js b/src/fhir/serializers/4_0_0/resources/specimenDefinition.js new file mode 100644 index 000000000..ef4efd150 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/specimenDefinition.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SpecimenDefinitionTypeTestedSerializer = require('../backbone_elements/specimenDefinitionTypeTested.js'); + +class SpecimenDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + typeCollected: (value) => CodeableConceptSerializer.serialize(value), + patientPreparation: (value) => CodeableConceptSerializer.serialize(value), + timeAspect: null, + collection: (value) => CodeableConceptSerializer.serialize(value), + typeTested: (value) => SpecimenDefinitionTypeTestedSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SpecimenDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SpecimenDefinitionSerializer.propertyToSerializerMap) { + if (SpecimenDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SpecimenDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SpecimenDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/structureDefinition.js b/src/fhir/serializers/4_0_0/resources/structureDefinition.js new file mode 100644 index 000000000..2d5810a2f --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/structureDefinition.js @@ -0,0 +1,100 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const CodingSerializer = require('../complex_types/coding.js'); +const StructureDefinitionMappingSerializer = require('../backbone_elements/structureDefinitionMapping.js'); +const StructureDefinitionContextSerializer = require('../backbone_elements/structureDefinitionContext.js'); +const StructureDefinitionSnapshotSerializer = require('../backbone_elements/structureDefinitionSnapshot.js'); +const StructureDefinitionDifferentialSerializer = require('../backbone_elements/structureDefinitionDifferential.js'); + +class StructureDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + keyword: (value) => CodingSerializer.serialize(value), + fhirVersion: null, + mapping: (value) => StructureDefinitionMappingSerializer.serialize(value), + kind: null, + abstract: null, + context: (value) => StructureDefinitionContextSerializer.serialize(value), + contextInvariant: null, + type: null, + baseDefinition: null, + derivation: null, + snapshot: (value) => StructureDefinitionSnapshotSerializer.serialize(value), + differential: (value) => StructureDefinitionDifferentialSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureDefinitionSerializer.propertyToSerializerMap) { + if (StructureDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/structureMap.js b/src/fhir/serializers/4_0_0/resources/structureMap.js new file mode 100644 index 000000000..d3a3894ae --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/structureMap.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const StructureMapStructureSerializer = require('../backbone_elements/structureMapStructure.js'); +const StructureMapGroupSerializer = require('../backbone_elements/structureMapGroup.js'); + +class StructureMapSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + structure: (value) => StructureMapStructureSerializer.serialize(value), + import: null, + group: (value) => StructureMapGroupSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => StructureMapSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in StructureMapSerializer.propertyToSerializerMap) { + if (StructureMapSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = StructureMapSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = StructureMapSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/subscription.js b/src/fhir/serializers/4_0_0/resources/subscription.js new file mode 100644 index 000000000..7f8738a3a --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/subscription.js @@ -0,0 +1,73 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactPointSerializer = require('../complex_types/contactPoint.js'); +const SubscriptionChannelSerializer = require('../backbone_elements/subscriptionChannel.js'); + +class SubscriptionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + contact: (value) => ContactPointSerializer.serialize(value), + end: null, + reason: null, + criteria: null, + error: null, + channel: (value) => SubscriptionChannelSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionSerializer.propertyToSerializerMap) { + if (SubscriptionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/subscriptionStatus.js b/src/fhir/serializers/4_0_0/resources/subscriptionStatus.js new file mode 100644 index 000000000..964986460 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/subscriptionStatus.js @@ -0,0 +1,74 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const SubscriptionStatusNotificationEventSerializer = require('../backbone_elements/subscriptionStatusNotificationEvent.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); + +class SubscriptionStatusSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + status: null, + type: null, + eventsSinceSubscriptionStart: null, + notificationEvent: (value) => SubscriptionStatusNotificationEventSerializer.serialize(value), + subscription: (value) => ReferenceSerializer.serialize(value), + topic: null, + error: (value) => CodeableConceptSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionStatusSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionStatusSerializer.propertyToSerializerMap) { + if (SubscriptionStatusSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionStatusSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionStatusSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/subscriptionTopic.js b/src/fhir/serializers/4_0_0/resources/subscriptionTopic.js new file mode 100644 index 000000000..7f5bcbd67 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/subscriptionTopic.js @@ -0,0 +1,95 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const SubscriptionTopicResourceTriggerSerializer = require('../backbone_elements/subscriptionTopicResourceTrigger.js'); +const SubscriptionTopicEventTriggerSerializer = require('../backbone_elements/subscriptionTopicEventTrigger.js'); +const SubscriptionTopicCanFilterBySerializer = require('../backbone_elements/subscriptionTopicCanFilterBy.js'); +const SubscriptionTopicNotificationShapeSerializer = require('../backbone_elements/subscriptionTopicNotificationShape.js'); + +class SubscriptionTopicSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + title: null, + derivedFrom: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + approvalDate: null, + lastReviewDate: null, + effectivePeriod: (value) => PeriodSerializer.serialize(value), + resourceTrigger: (value) => SubscriptionTopicResourceTriggerSerializer.serialize(value), + eventTrigger: (value) => SubscriptionTopicEventTriggerSerializer.serialize(value), + canFilterBy: (value) => SubscriptionTopicCanFilterBySerializer.serialize(value), + notificationShape: (value) => SubscriptionTopicNotificationShapeSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubscriptionTopicSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubscriptionTopicSerializer.propertyToSerializerMap) { + if (SubscriptionTopicSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubscriptionTopicSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubscriptionTopicSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/substance.js b/src/fhir/serializers/4_0_0/resources/substance.js new file mode 100644 index 000000000..7c4a63cfa --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/substance.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SubstanceInstanceSerializer = require('../backbone_elements/substanceInstance.js'); +const SubstanceIngredientSerializer = require('../backbone_elements/substanceIngredient.js'); + +class SubstanceSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + instance: (value) => SubstanceInstanceSerializer.serialize(value), + ingredient: (value) => SubstanceIngredientSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceSerializer.propertyToSerializerMap) { + if (SubstanceSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/substanceDefinition.js b/src/fhir/serializers/4_0_0/resources/substanceDefinition.js new file mode 100644 index 000000000..60fa00cc6 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/substanceDefinition.js @@ -0,0 +1,95 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const SubstanceDefinitionMoietySerializer = require('../backbone_elements/substanceDefinitionMoiety.js'); +const SubstanceDefinitionPropertySerializer = require('../backbone_elements/substanceDefinitionProperty.js'); +const SubstanceDefinitionMolecularWeightSerializer = require('../backbone_elements/substanceDefinitionMolecularWeight.js'); +const SubstanceDefinitionStructureSerializer = require('../backbone_elements/substanceDefinitionStructure.js'); +const SubstanceDefinitionCodeSerializer = require('../backbone_elements/substanceDefinitionCode.js'); +const SubstanceDefinitionNameSerializer = require('../backbone_elements/substanceDefinitionName.js'); +const SubstanceDefinitionRelationshipSerializer = require('../backbone_elements/substanceDefinitionRelationship.js'); +const SubstanceDefinitionSourceMaterialSerializer = require('../backbone_elements/substanceDefinitionSourceMaterial.js'); + +class SubstanceDefinitionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + status: (value) => CodeableConceptSerializer.serialize(value), + classification: (value) => CodeableConceptSerializer.serialize(value), + domain: (value) => CodeableConceptSerializer.serialize(value), + grade: (value) => CodeableConceptSerializer.serialize(value), + description: null, + informationSource: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + manufacturer: (value) => ReferenceSerializer.serialize(value), + supplier: (value) => ReferenceSerializer.serialize(value), + moiety: (value) => SubstanceDefinitionMoietySerializer.serialize(value), + property: (value) => SubstanceDefinitionPropertySerializer.serialize(value), + molecularWeight: (value) => SubstanceDefinitionMolecularWeightSerializer.serialize(value), + structure: (value) => SubstanceDefinitionStructureSerializer.serialize(value), + code: (value) => SubstanceDefinitionCodeSerializer.serialize(value), + name: (value) => SubstanceDefinitionNameSerializer.serialize(value), + relationship: (value) => SubstanceDefinitionRelationshipSerializer.serialize(value), + sourceMaterial: (value) => SubstanceDefinitionSourceMaterialSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SubstanceDefinitionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SubstanceDefinitionSerializer.propertyToSerializerMap) { + if (SubstanceDefinitionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SubstanceDefinitionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SubstanceDefinitionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/supplyDelivery.js b/src/fhir/serializers/4_0_0/resources/supplyDelivery.js new file mode 100644 index 000000000..673d09ae7 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/supplyDelivery.js @@ -0,0 +1,83 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const SupplyDeliverySuppliedItemSerializer = require('../backbone_elements/supplyDeliverySuppliedItem.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); + +class SupplyDeliverySerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + basedOn: (value) => ReferenceSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + patient: (value) => ReferenceSerializer.serialize(value), + type: (value) => CodeableConceptSerializer.serialize(value), + suppliedItem: (value) => SupplyDeliverySuppliedItemSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + supplier: (value) => ReferenceSerializer.serialize(value), + destination: (value) => ReferenceSerializer.serialize(value), + receiver: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SupplyDeliverySerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SupplyDeliverySerializer.propertyToSerializerMap) { + if (SupplyDeliverySerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SupplyDeliverySerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SupplyDeliverySerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/supplyRequest.js b/src/fhir/serializers/4_0_0/resources/supplyRequest.js new file mode 100644 index 000000000..6165a6e73 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/supplyRequest.js @@ -0,0 +1,89 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const QuantitySerializer = require('../complex_types/quantity.js'); +const SupplyRequestParameterSerializer = require('../backbone_elements/supplyRequestParameter.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); + +class SupplyRequestSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + category: (value) => CodeableConceptSerializer.serialize(value), + priority: null, + itemCodeableConcept: (value) => CodeableConceptSerializer.serialize(value), + itemReference: (value) => ReferenceSerializer.serialize(value), + quantity: (value) => QuantitySerializer.serialize(value), + parameter: (value) => SupplyRequestParameterSerializer.serialize(value), + occurrenceDateTime: null, + occurrencePeriod: (value) => PeriodSerializer.serialize(value), + occurrenceTiming: (value) => TimingSerializer.serialize(value), + authoredOn: null, + requester: (value) => ReferenceSerializer.serialize(value), + supplier: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + deliverFrom: (value) => ReferenceSerializer.serialize(value), + deliverTo: (value) => ReferenceSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => SupplyRequestSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in SupplyRequestSerializer.propertyToSerializerMap) { + if (SupplyRequestSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = SupplyRequestSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = SupplyRequestSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/task.js b/src/fhir/serializers/4_0_0/resources/task.js new file mode 100644 index 000000000..7a81df969 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/task.js @@ -0,0 +1,103 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const PeriodSerializer = require('../complex_types/period.js'); +const AnnotationSerializer = require('../complex_types/annotation.js'); +const TaskRestrictionSerializer = require('../backbone_elements/taskRestriction.js'); +const TaskInputSerializer = require('../backbone_elements/taskInput.js'); +const TaskOutputSerializer = require('../backbone_elements/taskOutput.js'); + +class TaskSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + instantiatesCanonical: null, + instantiatesUri: null, + basedOn: (value) => ReferenceSerializer.serialize(value), + groupIdentifier: (value) => IdentifierSerializer.serialize(value), + partOf: (value) => ReferenceSerializer.serialize(value), + status: null, + statusReason: (value) => CodeableConceptSerializer.serialize(value), + businessStatus: (value) => CodeableConceptSerializer.serialize(value), + intent: null, + priority: null, + code: (value) => CodeableConceptSerializer.serialize(value), + description: null, + focus: (value) => ReferenceSerializer.serialize(value), + for: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + executionPeriod: (value) => PeriodSerializer.serialize(value), + authoredOn: null, + lastModified: null, + requester: (value) => ReferenceSerializer.serialize(value), + performerType: (value) => CodeableConceptSerializer.serialize(value), + owner: (value) => ReferenceSerializer.serialize(value), + location: (value) => ReferenceSerializer.serialize(value), + reasonCode: (value) => CodeableConceptSerializer.serialize(value), + reasonReference: (value) => ReferenceSerializer.serialize(value), + insurance: (value) => ReferenceSerializer.serialize(value), + note: (value) => AnnotationSerializer.serialize(value), + relevantHistory: (value) => ReferenceSerializer.serialize(value), + restriction: (value) => TaskRestrictionSerializer.serialize(value), + input: (value) => TaskInputSerializer.serialize(value), + output: (value) => TaskOutputSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TaskSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TaskSerializer.propertyToSerializerMap) { + if (TaskSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TaskSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TaskSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/terminologyCapabilities.js b/src/fhir/serializers/4_0_0/resources/terminologyCapabilities.js new file mode 100644 index 000000000..7cdfb0ca0 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/terminologyCapabilities.js @@ -0,0 +1,98 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TerminologyCapabilitiesSoftwareSerializer = require('../backbone_elements/terminologyCapabilitiesSoftware.js'); +const TerminologyCapabilitiesImplementationSerializer = require('../backbone_elements/terminologyCapabilitiesImplementation.js'); +const TerminologyCapabilitiesCodeSystemSerializer = require('../backbone_elements/terminologyCapabilitiesCodeSystem.js'); +const TerminologyCapabilitiesExpansionSerializer = require('../backbone_elements/terminologyCapabilitiesExpansion.js'); +const TerminologyCapabilitiesValidateCodeSerializer = require('../backbone_elements/terminologyCapabilitiesValidateCode.js'); +const TerminologyCapabilitiesTranslationSerializer = require('../backbone_elements/terminologyCapabilitiesTranslation.js'); +const TerminologyCapabilitiesClosureSerializer = require('../backbone_elements/terminologyCapabilitiesClosure.js'); + +class TerminologyCapabilitiesSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + kind: null, + software: (value) => TerminologyCapabilitiesSoftwareSerializer.serialize(value), + implementation: (value) => TerminologyCapabilitiesImplementationSerializer.serialize(value), + lockedDate: null, + codeSystem: (value) => TerminologyCapabilitiesCodeSystemSerializer.serialize(value), + expansion: (value) => TerminologyCapabilitiesExpansionSerializer.serialize(value), + codeSearch: null, + validateCode: (value) => TerminologyCapabilitiesValidateCodeSerializer.serialize(value), + translation: (value) => TerminologyCapabilitiesTranslationSerializer.serialize(value), + closure: (value) => TerminologyCapabilitiesClosureSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TerminologyCapabilitiesSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TerminologyCapabilitiesSerializer.propertyToSerializerMap) { + if (TerminologyCapabilitiesSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TerminologyCapabilitiesSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TerminologyCapabilitiesSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/testReport.js b/src/fhir/serializers/4_0_0/resources/testReport.js new file mode 100644 index 000000000..ffcb59df2 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/testReport.js @@ -0,0 +1,82 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TestReportParticipantSerializer = require('../backbone_elements/testReportParticipant.js'); +const TestReportSetupSerializer = require('../backbone_elements/testReportSetup.js'); +const TestReportTestSerializer = require('../backbone_elements/testReportTest.js'); +const TestReportTeardownSerializer = require('../backbone_elements/testReportTeardown.js'); + +class TestReportSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + name: null, + status: null, + testScript: (value) => ReferenceSerializer.serialize(value), + result: null, + score: null, + tester: null, + issued: null, + participant: (value) => TestReportParticipantSerializer.serialize(value), + setup: (value) => TestReportSetupSerializer.serialize(value), + test: (value) => TestReportTestSerializer.serialize(value), + teardown: (value) => TestReportTeardownSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestReportSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestReportSerializer.propertyToSerializerMap) { + if (TestReportSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestReportSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestReportSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/testScript.js b/src/fhir/serializers/4_0_0/resources/testScript.js new file mode 100644 index 000000000..3177c9f53 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/testScript.js @@ -0,0 +1,101 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TestScriptOriginSerializer = require('../backbone_elements/testScriptOrigin.js'); +const TestScriptDestinationSerializer = require('../backbone_elements/testScriptDestination.js'); +const TestScriptMetadataSerializer = require('../backbone_elements/testScriptMetadata.js'); +const TestScriptFixtureSerializer = require('../backbone_elements/testScriptFixture.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const TestScriptVariableSerializer = require('../backbone_elements/testScriptVariable.js'); +const TestScriptSetupSerializer = require('../backbone_elements/testScriptSetup.js'); +const TestScriptTestSerializer = require('../backbone_elements/testScriptTest.js'); +const TestScriptTeardownSerializer = require('../backbone_elements/testScriptTeardown.js'); + +class TestScriptSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + purpose: null, + copyright: null, + origin: (value) => TestScriptOriginSerializer.serialize(value), + destination: (value) => TestScriptDestinationSerializer.serialize(value), + metadata: (value) => TestScriptMetadataSerializer.serialize(value), + fixture: (value) => TestScriptFixtureSerializer.serialize(value), + profile: (value) => ReferenceSerializer.serialize(value), + variable: (value) => TestScriptVariableSerializer.serialize(value), + setup: (value) => TestScriptSetupSerializer.serialize(value), + test: (value) => TestScriptTestSerializer.serialize(value), + teardown: (value) => TestScriptTeardownSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => TestScriptSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in TestScriptSerializer.propertyToSerializerMap) { + if (TestScriptSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = TestScriptSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = TestScriptSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/valueSet.js b/src/fhir/serializers/4_0_0/resources/valueSet.js new file mode 100644 index 000000000..429fced93 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/valueSet.js @@ -0,0 +1,88 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ContactDetailSerializer = require('../complex_types/contactDetail.js'); +const UsageContextSerializer = require('../complex_types/usageContext.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const ValueSetComposeSerializer = require('../backbone_elements/valueSetCompose.js'); +const ValueSetExpansionSerializer = require('../backbone_elements/valueSetExpansion.js'); + +class ValueSetSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + url: null, + identifier: (value) => IdentifierSerializer.serialize(value), + version: null, + name: null, + title: null, + status: null, + experimental: null, + date: null, + publisher: null, + contact: (value) => ContactDetailSerializer.serialize(value), + description: null, + useContext: (value) => UsageContextSerializer.serialize(value), + jurisdiction: (value) => CodeableConceptSerializer.serialize(value), + immutable: null, + purpose: null, + copyright: null, + compose: (value) => ValueSetComposeSerializer.serialize(value), + expansion: (value) => ValueSetExpansionSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ValueSetSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ValueSetSerializer.propertyToSerializerMap) { + if (ValueSetSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ValueSetSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ValueSetSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/verificationResult.js b/src/fhir/serializers/4_0_0/resources/verificationResult.js new file mode 100644 index 000000000..6bced6e72 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/verificationResult.js @@ -0,0 +1,84 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const CodeableConceptSerializer = require('../complex_types/codeableConcept.js'); +const TimingSerializer = require('../backbone_elements/timing.js'); +const VerificationResultPrimarySourceSerializer = require('../backbone_elements/verificationResultPrimarySource.js'); +const VerificationResultAttestationSerializer = require('../backbone_elements/verificationResultAttestation.js'); +const VerificationResultValidatorSerializer = require('../backbone_elements/verificationResultValidator.js'); + +class VerificationResultSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + target: (value) => ReferenceSerializer.serialize(value), + targetLocation: null, + need: (value) => CodeableConceptSerializer.serialize(value), + status: null, + statusDate: null, + validationType: (value) => CodeableConceptSerializer.serialize(value), + validationProcess: (value) => CodeableConceptSerializer.serialize(value), + frequency: (value) => TimingSerializer.serialize(value), + lastPerformed: null, + nextScheduled: null, + failureAction: (value) => CodeableConceptSerializer.serialize(value), + primarySource: (value) => VerificationResultPrimarySourceSerializer.serialize(value), + attestation: (value) => VerificationResultAttestationSerializer.serialize(value), + validator: (value) => VerificationResultValidatorSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VerificationResultSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VerificationResultSerializer.propertyToSerializerMap) { + if (VerificationResultSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VerificationResultSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VerificationResultSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/resources/visionPrescription.js b/src/fhir/serializers/4_0_0/resources/visionPrescription.js new file mode 100644 index 000000000..200c3d403 --- /dev/null +++ b/src/fhir/serializers/4_0_0/resources/visionPrescription.js @@ -0,0 +1,75 @@ +// This file is auto-generated by generate_classes so do not edit manually + +const MetaSerializer = require('../complex_types/meta.js'); +const NarrativeSerializer = require('../complex_types/narrative.js'); +const ResourceContainerSerializer = require('../simple_types/resourceContainer.js'); +const ExtensionSerializer = require('../complex_types/extension.js'); +const IdentifierSerializer = require('../complex_types/identifier.js'); +const ReferenceSerializer = require('../complex_types/reference.js'); +const VisionPrescriptionLensSpecificationSerializer = require('../backbone_elements/visionPrescriptionLensSpecification.js'); + +class VisionPrescriptionSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + implicitRules: null, + language: null, + text: (value) => NarrativeSerializer.serialize(value), + contained: (value) => ResourceContainerSerializer.serialize(value), + extension: (value) => ExtensionSerializer.serialize(value), + modifierExtension: (value) => ExtensionSerializer.serialize(value), + identifier: (value) => IdentifierSerializer.serialize(value), + status: null, + created: null, + patient: (value) => ReferenceSerializer.serialize(value), + encounter: (value) => ReferenceSerializer.serialize(value), + dateWritten: null, + prescriber: (value) => ReferenceSerializer.serialize(value), + lensSpecification: (value) => VisionPrescriptionLensSpecificationSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => VisionPrescriptionSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(rawJson).forEach(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in VisionPrescriptionSerializer.propertyToSerializerMap) { + if (VisionPrescriptionSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = VisionPrescriptionSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = VisionPrescriptionSerializer; \ No newline at end of file diff --git a/src/fhir/serializers/4_0_0/simple_types/resourceContainer.js b/src/fhir/serializers/4_0_0/simple_types/resourceContainer.js new file mode 100644 index 000000000..fa26b4b06 --- /dev/null +++ b/src/fhir/serializers/4_0_0/simple_types/resourceContainer.js @@ -0,0 +1,51 @@ +class ResourceContainerSerializer { + static propertyToSerializerMap = { + id: null, + meta: (value) => MetaSerializer.serialize(value), + resourceType: null + }; + + /** + * This methods cleans the raw json by removing additional fields which are not defined + * according to FHIR Specs + * @param {any} rawJson + * @returns {any} Cleaned object + */ + static serialize(rawJson) { + if (!rawJson) return rawJson; + + // Handle array case + if (Array.isArray(rawJson)) { + return rawJson.map(item => ResourceContainerSerializer.serialize(item)); + } + + // Handle non-object case + if (typeof rawJson !== 'object') return rawJson; + + Object.keys(propertyName => { + const value = rawJson[propertyName]; + + if (value === null || value === undefined) { + delete rawJson[propertyName]; + return; + } + + if (propertyName in ResourceContainerSerializer.propertyToSerializerMap) { + if (ResourceContainerSerializer.propertyToSerializerMap[propertyName]) { + const serializedValue = ResourceContainerSerializer.propertyToSerializerMap[propertyName](value); + if (serializedValue === null || serializedValue === undefined) { + delete rawJson[propertyName]; + } else { + rawJson[propertyName] = serializedValue; + } + } + } else { + delete rawJson[propertyName]; + } + }); + + return rawJson; + } +} + +module.exports = ResourceContainerSerializer; \ No newline at end of file