Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
SymXchange core query no data file

We are working on updating our extensions from using the Symitar core (SymConnect) to use the SymXchange core, and we noticed that the function that builds the PowerOn core query (build_poweron_query) does not have a parameter for a data file like the similar function for the Symitar core does (build_base_query). Are data files no longer supported by SymXchange?

Votes Newest

Answers


Hey Michael,

I think the best way to get this same functionality is to use the SymXchange File API. Upload your file then call your poweron with the letter file name you uploaded.

While this query is not in the SDK yet it something we should get added. Below is something you could use to get you started.

import base64
import logging
import uuid
from typing import Type

from lxml.builder import E, ElementMaker
from q2_cores.SymXchange.models import namespaces
from q2_cores.SymXchange.models import Credentials, DeviceInformation
from q2_cores.SymXchange.queries.base_query import SymXchangeBaseQuery


class FileManagementQuery(SymXchangeBaseQuery):
    def __init__(
        self,
        logger: logging.Logger,
        file_name: str,
        file_contents: str,
        credentials: Type[Credentials],
        device_info: DeviceInformation,
        mock_failure: bool = False,
    ):
        self.file_name = file_name
        self.file_contents = file_contents
        super().__init__(logger, credentials, device_info, mock_failure)

    @property
    def service(self) -> str:
        return "filemanagement"
    
    def build(self) -> str:
        file = ElementMaker(
            namespace=namespaces.SYMXCHANGE_FILEMANAGEMENT,
            nsmap={"file": namespaces.SYMXCHANGE_FILEMANAGEMENT, "dto": namespaces.SYMXCHANGE_FILEMANAGEMENT_DTO}
        )
        file_dto = ElementMaker(
            namespace=namespaces.SYMXCHANGE_FILEMANAGEMENT_DTO
        )

        file_upload = file.uploadLetterFile(
            E.Request(
                {f'{{{namespaces.SYMXCHANGE_COMMON}}}MessageId' : str(uuid.uuid4())},
                self.create_credentials(),
                self.create_device_info(),
                file_dto.FileName(self.file_name),
                E.Data(base64.b64encode(self.file_contents.encode()).decode()),
                E.noNewline(str(False).lower())
            )
        )

        envelope = self.create_envelope(file_upload)

        return super().serialize(envelope)

Posted 2 years ago
Edited 2 years ago
Jason Herbert
104 × 1 Administrator
156 Views
1 Answer
2 years ago
2 years ago
Tags