class GoodsNomenclatureParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="goods.nomenclature" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="goods.nomenclature.sid" type="SID"/> <xs:element name="goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="producline.suffix" type="ProductLineSuffix"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="statistical.indicator" type="StatisticalIndicator"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "400" subrecord_code = "00" tag = Tag("goods.nomenclature") sid = TextElement(Tag("goods.nomenclature.sid")) item_id = TextElement(Tag("goods.nomenclature.item.id")) suffix = TextElement(Tag("producline.suffix")) # XXX not a typo valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper statistical = BooleanElement(Tag("statistical.indicator"))
class RegulationGroupDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="regulation.group.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="regulation.group.id" type="RegulationGroupId"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="description" type="ShortDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "150" subrecord_code = "05" tag = Tag("regulation.group.description") group_id = TextElement(Tag("regulation.group.id")) language_id = ConstantElement(Tag("language.id"), value="EN") description = TextElement(Tag("description"))
class CertificateParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="certificate" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="certificate.type.code" type="CertificateTypeCode"/> <xs:element name="certificate.code" type="CertificateCode"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "205" subrecord_code = "00" tag = Tag("certificate") certificate_type__sid = TextElement(Tag("certificate.type.code")) sid = TextElement(Tag("certificate.code")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper
class MeasureTypeParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="measure.type" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measure.type.id" type="MeasureTypeId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="trade.movement.code" type="TradeMovementCode"/> <xs:element name="priority.code" type="PriorityCode"/> <xs:element name="measure.component.applicable.code" type="MeasurementUnitApplicabilityCode"/> <xs:element name="origin.dest.code" type="OriginCode"/> <xs:element name="order.number.capture.code" type="OrderNumberCaptureCode"/> <xs:element name="measure.explosion.level" type="MeasureExplosionLevel"/> <xs:element name="measure.type.series.id" type="MeasureTypeSeriesId"/> </xs:sequence> </xs:complexType> </xs:element> """ tag = Tag("measure.type") sid = TextElement(Tag("measure.type.id")) trade_movement_code = IntElement(Tag("trade.movement.code")) priority_code = IntElement(Tag("priority.code")) measure_component_applicability_code = IntElement( Tag("measure.component.applicable.code"), ) origin_destination_code = IntElement(Tag("origin.dest.code")) order_number_capture_code = IntElement(Tag("order.number.capture.code")) measure_explosion_level = IntElement(Tag("measure.explosion.level")) measure_type_series__sid = TextElement(Tag("measure.type.series.id"))
class RecordParser(ElementParser): """Parser for TARIC3 `record` element.""" tag = Tag("record") transaction_id = TextElement(Tag("transaction.id")) record_code = TextElement(Tag("record.code")) subrecord_code = TextElement(Tag("subrecord.code")) sequence_number = TextElement(Tag("record.sequence.number")) update_type = TextElement(Tag("update.type")) def save(self, data: Mapping[str, Any], transaction_id: int): """ Save the Record to the database. :param data: A dict of the parsed element, mapping field names to values :param transaction_id: The primary key of the transaction to add the record to """ method_name = { str(UpdateType.UPDATE): "update", str(UpdateType.DELETE): "delete", str(UpdateType.CREATE): "create", }[data["update_type"]] for parser, field_name in self._field_lookup.items(): record_data = data.get(field_name) if record_data and hasattr(parser, method_name): getattr(parser, method_name)(record_data, transaction_id)
class AdditionalCodeParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="additional.code" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.sid" type="SID"/> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="additional.code" type="AdditionalCode"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "245" subrecord_code = "00" tag = Tag("additional.code") sid = IntElement(Tag("additional.code.sid")) type__sid = TextElement(Tag("additional.code.type.id")) code = TextElement(Tag("additional.code")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper
class AdditionalCodeDescriptionPeriodParser( ValidityStartMixin, Writable, ElementParser, ): """ Example XML: .. code-block:: XML <xs:element name="additional.code.description.period" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.description.period.sid" type="SID"/> <xs:element name="additional.code.sid" type="SID"/> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="additional.code" type="AdditionalCode"/> <xs:element name="validity.start.date" type="Date"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "245" subrecord_code = "05" tag = Tag("additional.code.description.period") sid = TextElement(Tag("additional.code.description.period.sid")) described_additionalcode__sid = TextElement(Tag("additional.code.sid")) described_additionalcode__type__sid = TextElement( Tag("additional.code.type.id"), ) described_additionalcode__code = TextElement(Tag("additional.code")) validity_start = ValidityStartMixin.validity_start
class MeasurementParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="measurement" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measurement.unit.code" type="MeasurementUnitCode"/> <xs:element name="measurement.unit.qualifier.code" type="MeasurementUnitQualifierCode"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "220" subrecord_code = "00" tag = Tag("measurement") measurement_unit__code = TextElement(Tag("measurement.unit.code")) measurement_unit_qualifier__code = TextElement( Tag("measurement.unit.qualifier.code"), ) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper
class MeasureExcludedGeographicalAreaParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="measure.excluded.geographical.area" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measure.sid" type="SID"/> <xs:element name="excluded.geographical.area" type="GeographicalAreaId"/> <xs:element name="geographical.area.sid" type="SID"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "430" subrecord_code = "15" tag = Tag("measure.excluded.geographical.area") modified_measure__sid = TextElement(Tag("measure.sid")) excluded_geographical_area__area_id = TextElement( Tag("excluded.geographical.area"), ) excluded_geographical_area__sid = TextElement(Tag("geographical.area.sid"))
class FootnoteTypeParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="footnote.type" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="footnote.type.id" type="FootnoteTypeId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="application.code" type="ApplicationCodeFootnote"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "100" subrecord_code = "00" tag = Tag("footnote.type") footnote_type_id = TextElement(Tag("footnote.type.id")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper application_code = TextElement(Tag("application.code"))
class GeographicalAreaDescriptionPeriodParser( ValidityStartMixin, Writable, ElementParser, ): """ Example XML: .. code-block:: XML <xs:element name="geographical.area.description.period" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="geographical.area.description.period.sid" type="SID"/> <xs:element name="geographical.area.sid" type="SID"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="geographical.area.id" type="GeographicalAreaId"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "250" subrecord_code = "05" tag = Tag("geographical.area.description.period") sid = IntElement(Tag("geographical.area.description.period.sid")) described_geographicalarea__sid = TextElement(Tag("geographical.area.sid")) validity_start = ValidityStartMixin.validity_start described_geographicalarea__area_id = TextElement( Tag("geographical.area.id"))
class GoodsNomenclatureSuccessorParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="goods.nomenclature.successor" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="goods.nomenclature.sid" type="SID"/> <xs:element name="absorbed.goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="absorbed.productline.suffix" type="ProductLineSuffix"/> <xs:element name="goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="productline.suffix" type="ProductLineSuffix"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "400" subrecord_code = "40" tag = Tag("goods.nomenclature.successor") replaced_goods_nomenclature__sid = TextElement( Tag("goods.nomenclature.sid")) absorbed_into_goods_nomenclature__item_id = TextElement( Tag("absorbed.goods.nomenclature.item.id"), ) absorbed_into_goods_nomenclature__suffix = TextElement( Tag("absorbed.productline.suffix"), ) replaced_goods_nomenclature__item_id = TextElement( Tag("goods.nomenclature.item.id"), ) replaced_goods_nomenclature__suffix = TextElement( Tag("productline.suffix"))
class GoodsNomenclatureOriginParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="goods.nomenclature.origin" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="goods.nomenclature.sid" type="SID"/> <xs:element name="derived.goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="derived.productline.suffix" type="ProductLineSuffix"/> <xs:element name="goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="productline.suffix" type="ProductLineSuffix"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "400" subrecord_code = "35" tag = Tag("goods.nomenclature.origin") new_goods_nomenclature__sid = TextElement(Tag("goods.nomenclature.sid")) derived_from_goods_nomenclature__item_id = TextElement( Tag("derived.goods.nomenclature.item.id"), ) derived_from_goods_nomenclature__suffix = TextElement( Tag("derived.productline.suffix"), ) new_goods_nomenclature__item_id = TextElement( Tag("goods.nomenclature.item.id"), ) new_goods_nomenclature__suffix = TextElement(Tag("productline.suffix"))
class GoodsNomenclatureIndentParser(ValidityStartMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="goods.nomenclature.indents" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="goods.nomenclature.indent.sid" type="SID"/> <xs:element name="goods.nomenclature.sid" type="SID"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="number.indents" type="NumberOf"/> <xs:element name="goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="productline.suffix" type="ProductLineSuffix"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "400" subrecord_code = "05" tag = Tag("goods.nomenclature.indents") sid = TextElement(Tag("goods.nomenclature.indent.sid")) indented_goods_nomenclature__sid = TextElement( Tag("goods.nomenclature.sid")) validity_start = ValidityStartMixin.validity_start indent = IntElement(Tag("number.indents"), format="FM00") indented_goods_nomenclature__item_id = TextElement( Tag("goods.nomenclature.item.id"), ) indented_goods_nomenclature__suffix = TextElement( Tag("productline.suffix"))
class AdditionalCodeDescriptionPeriodParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="additional.code.description.period" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.description.period.sid" type="SID"/> <xs:element name="additional.code.sid" type="SID"/> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="additional.code" type="AdditionalCode"/> <xs:element name="validity.start.date" type="Date"/> </xs:sequence> </xs:complexType> </xs:element> """ tag = Tag("additional.code.description.period") sid = TextElement(Tag("additional.code.description.period.sid")) additional_code_sid = TextElement(Tag("additional.code.sid")) additional_code_type_id = TextElement(Tag("additional.code.type.id")) additional_code = TextElement(Tag("additional.code")) valid_between_lower = TextElement(Tag("validity.start.date"))
class FootnoteAssociationMeasureParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="footnote.association.measure" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measure.sid" type="SID"/> <xs:element name="footnote.type.id" type="FootnoteTypeId"/> <xs:element name="footnote.id" type="FootnoteId"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "430" subrecord_code = "20" tag = Tag("footnote.association.measure") footnoted_measure__sid = TextElement(Tag("measure.sid")) associated_footnote__footnote_type__footnote_type_id = TextElement( Tag("footnote.type.id"), ) associated_footnote__footnote_id = TextElement(Tag("footnote.id"))
class AdditionalCodeTypeParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="additional.code.type" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="application.code" type="ApplicationCodeAdditionalCode"/> <xs:element name="meursing.table.plan.id" type="MeursingTablePlanId" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "120" subrecord_code = "00" tag = Tag("additional.code.type") sid = TextElement(Tag("additional.code.type.id")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper application_code = TextElement(Tag("application.code"))
class MeasurementUnitDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="measurement.unit.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measurement.unit.code" type="MeasurementUnitCode"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="description" type="ShortDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "210" subrecord_code = "05" tag = Tag("measurement.unit.description") code = TextElement(Tag("measurement.unit.code")) language_id = ConstantElement(Tag("language.id"), value="EN") description = TextElement(Tag("description"))
class FootnoteAssociationAdditionalCodeParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block: XML <xs:element name="footnote.association.additional.code" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.sid" type="SID"/> <xs:element name="footnote.type.id" type="FootnoteTypeId"/> <xs:element name="footnote.id" type="FootnoteId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="additional.code" type="AdditionalCode"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "245" subrecord_code = "15" tag = Tag("footnote.association.additional.code") additional_code__sid = TextElement(Tag("additional.code.sid")) associated_footnote__footnote_type__sid = TextElement( Tag("footnote.type.id")) associated_footnote__footnote_id = TextElement(Tag("footnote.id")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper additional_code__type__sid = TextElement(Tag("additional.code.type.id")) additional_code__code = TextElement(Tag("additional.code"))
class QuotaOrderNumberParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="quota.order.number" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="quota.order.number.sid" type="SID"/> <xs:element name="quota.order.number.id" type="OrderNumber"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "360" subrecord_code = "00" tag = Tag("quota.order.number") sid = TextElement(Tag("quota.order.number.sid")) order_number = TextElement(Tag("quota.order.number.id")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper def clean(self): super().clean() # mechanism and category do not occur in TARIC3, can we calculate them? self.data["mechanism"] = "0" self.data["category"] = "1"
class AdditionalCodeDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="additional.code.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="additional.code.description.period.sid" type="SID"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="additional.code.sid" type="SID"/> <xs:element name="additional.code.type.id" type="AdditionalCodeTypeId"/> <xs:element name="additional.code" type="AdditionalCode"/> <xs:element name="description" type="LongDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "245" subrecord_code = "10" tag = Tag("additional.code.description") sid = TextElement(Tag("additional.code.description.period.sid")) language_id = ConstantElement(Tag("language.id"), value="EN") described_additionalcode__sid = TextElement(Tag("additional.code.sid")) described_additionalcode__type__sid = TextElement( Tag("additional.code.type.id"), ) described_additionalcode__code = TextElement(Tag("additional.code")) description = TextElement(Tag("description"))
class QuotaAssociationParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="quota.association" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="main.quota.definition.sid" type="SID"/> <xs:element name="sub.quota.definition.sid" type="SID"/> <xs:element name="relation.type" type="RelationType"/> <xs:element name="coefficient" type="QuotaCoefficient" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "370" subrecord_code = "05" tag = Tag("quota.association") main_quota__sid = TextElement(Tag("main.quota.definition.sid")) sub_quota__sid = TextElement(Tag("sub.quota.definition.sid")) sub_quota_relation_type = TextElement(Tag("relation.type")) coefficient = TextElement(Tag("coefficient"))
class MeasureConditionComponentParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="measure.condition.component" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="measure.condition.sid" type="SID"/> <xs:element name="duty.expression.id" type="DutyExpressionId"/> <xs:element name="duty.amount" type="DutyAmount" minOccurs="0"/> <xs:element name="monetary.unit.code" type="MonetaryUnitCode" minOccurs="0"/> <xs:element name="measurement.unit.code" type="MeasurementUnitCode" minOccurs="0"/> <xs:element name="measurement.unit.qualifier.code" type="MeasurementUnitQualifierCode" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ tag = Tag("measure.condition.component") condition__sid = TextElement(Tag("measure.condition.sid")) duty_expression__sid = IntElement(Tag("duty.expression.id")) duty_amount = TextElement(Tag("duty.amount")) monetary_unit__code = TextElement(Tag("monetary.unit.code")) component_measurement__measurement_unit__code = TextElement( Tag("measurement.unit.code"), ) component_measurement__measurement_unit_qualifier__code = TextElement( Tag("measurement.unit.qualifier.code"), )
class QuotaOrderNumberOriginParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="quota.order.number.origin" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="quota.order.number.origin.sid" type="SID"/> <xs:element name="quota.order.number.sid" type="SID"/> <xs:element name="geographical.area.id" type="GeographicalAreaId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="geographical.area.sid" type="SID"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "360" subrecord_code = "10" tag = Tag("quota.order.number.origin") sid = TextElement(Tag("quota.order.number.origin.sid")) order_number__sid = TextElement(Tag("quota.order.number.sid")) geographical_area__area_id = TextElement(Tag("geographical.area.id")) valid_between_lower = ValidityMixin.valid_between_lower valid_between_upper = ValidityMixin.valid_between_upper geographical_area__sid = TextElement(Tag("geographical.area.sid"))
class FullTemporaryStopActionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="fts.regulation.action" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="fts.regulation.role" type="RegulationRoleTypeId"/> <xs:element name="fts.regulation.id" type="RegulationId"/> <xs:element name="stopped.regulation.role" type="RegulationRoleTypeId"/> <xs:element name="stopped.regulation.id" type="RegulationId"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "305" subrecord_code = "00" tag = Tag("fts.regulation.action") enacting_regulation__role_type = IntElement(Tag("fts.regulation.role")) enacting_regulation__regulation_id = TextElement(Tag("fts.regulation.id")) target_regulation__role_type = IntElement(Tag("stopped.regulation.role")) target_regulation__regulation_id = TextElement( Tag("stopped.regulation.id"))
class GeographicalAreaParser(ValidityMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="geographical.area" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="geographical.area.sid" type="SID"/> <xs:element name="geographical.area.id" type="GeographicalAreaId"/> <xs:element name="validity.start.date" type="Date"/> <xs:element name="validity.end.date" type="Date" minOccurs="0"/> <xs:element name="geographical.code" type="AreaCode"/> <xs:element name="parent.geographical.area.group.sid" type="SID" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ tag = Tag("geographical.area") sid = TextElement(Tag("geographical.area.sid")) area_id = TextElement(Tag("geographical.area.id")) area_code = TextElement(Tag("geographical.code")) parent__sid = TextElement(Tag("parent.geographical.area.group.sid"))
class CertificateDescriptionPeriodParser(ValidityStartMixin, Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="certificate.description.period" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="certificate.description.period.sid" type="SID"/> <xs:element name="certificate.type.code" type="CertificateTypeCode"/> <xs:element name="certificate.code" type="CertificateCode"/> <xs:element name="validity.start.date" type="Date"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "205" subrecord_code = "05" tag = Tag("certificate.description.period") sid = IntElement(Tag("certificate.description.period.sid")) described_certificate__certificate_type__sid = TextElement( Tag("certificate.type.code"), ) described_certificate__sid = TextElement(Tag("certificate.code")) validity_start = ValidityStartMixin.validity_start
class GeographicalAreaDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="geographical.area.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="geographical.area.description.period.sid" type="SID"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="geographical.area.sid" type="SID"/> <xs:element name="geographical.area.id" type="GeographicalAreaId"/> <xs:element name="description" type="ShortDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ tag = Tag("geographical.area.description") sid = IntElement(Tag("geographical.area.description.period.sid")) area__sid = TextElement(Tag("geographical.area.sid")) area__area_id = TextElement(Tag("geographical.area.id")) description = TextElement(Tag("description"))
class CertificateDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="certificate.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="certificate.description.period.sid" type="SID"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="certificate.type.code" type="CertificateTypeCode"/> <xs:element name="certificate.code" type="CertificateCode"/> <xs:element name="description" type="ShortDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "205" subrecord_code = "10" tag = Tag("certificate.description") sid = IntElement(Tag("certificate.description.period.sid")) language_id = ConstantElement(Tag("language.id"), value="EN") described_certificate__certificate_type__sid = TextElement( Tag("certificate.type.code"), ) described_certificate__sid = TextElement(Tag("certificate.code")) description = TextElement(Tag("description"))
class GoodsNomenclatureDescriptionParser(Writable, ElementParser): """ Example XML: .. code-block:: XML <xs:element name="goods.nomenclature.description" substitutionGroup="abstract.record"> <xs:complexType> <xs:sequence> <xs:element name="goods.nomenclature.description.period.sid" type="SID"/> <xs:element name="language.id" type="LanguageId"/> <xs:element name="goods.nomenclature.sid" type="SID"/> <xs:element name="goods.nomenclature.item.id" type="GoodsNomenclatureItemId"/> <xs:element name="productline.suffix" type="ProductLineSuffix"/> <xs:element name="description" type="LongDescription" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> """ record_code = "400" subrecord_code = "15" tag = Tag("goods.nomenclature.description") sid = TextElement(Tag("goods.nomenclature.description.period.sid")) language_id = ConstantElement(Tag("language.id"), value="EN") described_goods_nomenclature__sid = TextElement( Tag("goods.nomenclature.sid")) described_goods_nomenclature__item_id = TextElement( Tag("goods.nomenclature.item.id"), ) described_goods_nomenclature__suffix = TextElement( Tag("productline.suffix"), ) description = TextElement(Tag("description"))