You have 2 options to return a value from a Method, one is to send by reference an object and instantiate that object inside the method called:

ClassMethod MyMethod(myInput As String, Output myOutput As MyPackage.MyClass) As %Library.Status
{
    set myOuput = ##class(MyPackage.MyClass).%New()
    set myOutput.name = "This is a name"
    
    return $$$OK
}

And invoke it like:

// Invoke method with .. if it belong to the same class or with ##class(classname).method if it doesn't
set tSC = ..MyMethod("One Input", .output)
// Now output has been created and output.name has the value "This is a name"
write output.name

You can see here in the documentation how to pass variables by reference:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

When you create a RecordMapper to transform a CSV into an ObjectScript class you can add to the production a Business Process to receive the created object from the mapper, so you can transform it to XML (extending the ObjectScript class from %XML.Adaptor) and save it into a file created ad-hoc when you've received the first mapped row of the CSV (I guess that you can get from the original request the name of the original CSV file to identify the PONumber).

You can add after the %Save() command something like this:

set sqlUpdateMoodRecord = "UPDATE MoopRecord SET TotalAmount = 
        CASE WHEN TotalAmount > ? THEN TotalAmount - ? WHEN TotalAmount < ? THEN ? -TotalAmount
            ELSE TotalAmount WHERE %ID = ?"
set statementUpdateMoodRecord = ##class(%SQL.Statement).%New()
set statusUpdateMoodRecord = statementUpdateMoodRecord.%Prepare(sqlUpdateMoodRecord)
if ($$$ISOK(statusUpdateMoodRecord)) {
    set resultSet = statementUpdateMoodRecord.%Execute(pRequest.TotalAmount, 
                        pRequest.TotalAmount, pRequest.TotalAmount, pRequest.TotalAmount,
                        tEntEpicMoopRecord.%ID)
}

Probably that code is not going to work...but the idea is to launch an UPDATE with a condition in the SET.

Well, Code function is validating if the code in source.Severity has a match in the target ValueSet and if it has then return the code. Maybe you can add a new line after each null validation of value var with something like these to get the description value:

^HS.XF.LookupTable("SDA3","vSTU3","HS.SDA3.CodeTableDetail.AllergyCategory","allergy-intolerance-category",value)

^HS.XF.LookupTable("SDA3","vR4","HS.SDA3.CodeTableDetail.Severity","reaction-event-severity|4.0.1",value)

And update the assign with something like this:

<assign value='^HS.XF.LookupTable("SDA3","vSTU3","HS.SDA3.CodeTableDetail.AllergyCategory","allergy-intolerance-category",value)' property='target.category' action='set'>

But not sure if it's correct to overwrite the codes of the resource with the description...try it and if you don't break anything keep it!

Jeffrey is totally right, you can't add multiple ranges in an OBX segment, the idea of that field is just to add the valid range for the observation, you can see that there is another field in that segment (OBX:12 - Efective date of Reference Range) in wich you can define the date when the range start to be valid.

Another option to the NTE segment is to repeat the OBX segment with the same value of the observation so many times as range values you have, informing the OBX:12 with a different date and the valid range for that date.