Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDA ObservationMedia inheritance #1

Open
hiparcos opened this issue May 10, 2017 · 0 comments
Open

CDA ObservationMedia inheritance #1

hiparcos opened this issue May 10, 2017 · 0 comments

Comments

@hiparcos
Copy link

Hello,

I need to add a custom attribute "ID" to the ObservationMedia class in order to get this:
<observationMedia ID="string identifier" classCode="OBS" moodCode="EVN">

To do so, I created a custom ObservationMedia as below:

[Structure(Name = "ObservationMedia", Model = "POCD_MT000040UV", StructureType = StructureAttribute.StructureAttributeType.MessageType)]
public class MyObservationMedia : ObservationMedia
{
[Property(
Name = "ID",
PropertyType = PropertyAttribute.AttributeAttributeType.Structural,
Conformance = PropertyAttribute.AttributeConformanceType.Optional)]
[System.Xml.Serialization.XmlAttribute("ID")]
public string ID { get; set; }

}

Then I registered the class in the formatter objet using:

fmtr.RegisterXSITypeName("POCD_MT000040UV.ObservationMedia", typeof(MyObservationMedia));

Finally I use my custom class just like a classic ObservationMedia object:
Component4 component4 = new Component4();
MyObservationMedia obs_l = new MyObservationMedia();
obs_l.ID = "myID";
// other object initializations
component4.SetClinicalStatement(obs_l);

Unfortunately I get the error "MyObservationMedia is not a valid choice according to available choice elements and won't be formatted".

I already did this for a custom ServiceEvent class and it worked fine. It seems that the Component4.ClinicalStatement is not allowing to a MyObservationMedia objet.
Do I need to override Component4.SetClinicalStatement(ObservationMedia value) and what to put in that function ?

Thanks
Remy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant