TFML.org > Using Teaching File Modeling Language

[ Also see: Publishing a case to MyPACS.net ]

Sample TFML document:

 

<?xml version="1.0"?>

<tfml>

<command action="add_case" user="mypacs_login"

    password="mypacs_passwd">

<case source="radpix">

  <title>ACL CYST</title>

  <author>

    <name>Jane Doe</name>

    <email>jdoe@hotmail.com</email>

  </author>

  <accessibility level="Public"/>

  <modalities>MR</modalities>

  <pathology>Benign Mass, Cyst</pathology>

  <anatomy>Skeletal System</anatomy>

  <keywords>acl, cyst</keywords>

  <date_imaged>2002-09-14</date_imaged>

  <patient>

    <gender>M</gender>

  </patient>

  <notes>note to self: edit this case!</notes>

  <case_images>

    <case_image sequence="1">

      <url>25526.jpg</url>

    </case_image>

    <case_image sequence="2">

      <url> 25524.jpg</url>

    </case_image>    

  </case_images>

</case>

</command>

</tfml>

 

Each element is described below.

 

The <tfml> element

 

All TFML documents begin with an XML declaration and wrap their contents in a root tfml element:

 

<?xml version="1.0"?>

<tfml>

</tfml>

 

The <command> element

 

TFML elements can contain one or more command elements as children:

 

<tfml>

<command action="add_case" user="mypacs_login"

         password="mypacs_passwd">

</command>

<command action=”add_images” case_id = “543”

         user=”mypacs_login" password="mypacs_passwd">

</command>

</tfml>

 

<command> elements tell MyPACS to perform an action and provide the authentication information necessary for performing the requested action.  Currently, two actions are supported:

 

1)      action=”add_case”:  This action asks MyPACS to import one or more cases.  A command element that specifies “add_case” as the value of its “action” attribute will contain a child <case> element for every case that should be imported.  MyPACS will authenticate the user specified by the command element’s “user” and “password” attributes, after which it will import all of the cases by parsing the child <case> elements.

 

2)      action=”add_images”: This action adds images to a case which already exists in MyPACS.  The “case_id” attribute specifies the oid of the destination case in MyPACS.  Like the “add_case” action above, the “user” and “password” attributes are used to authenticate the user and make sure that he or she is allowed to add images to the case.  A command element employing this action should contain one <case_images> element which in turn should contain one or more <case_image> elements (one for each image to be added).

 

The <case> element

 

The case element describes the actual case that you wish to import.  command elements can contain more than one case element, each one containing optional subelements which specify the case’s metadata and images.   

 

The opening tag of a case element can contain two optional attributes:

 

            source=”source – a label identifying the source of the case

            id=”id– an id that is specific to the case

 

Additionally, case elements support the following subelements (all of these can only be used as children of case elements unless otherwise specified):

 

<title>title</title>  -- specifies the importes case’s title

 

<author>

     <name>Jane Doe</name>

     <email>jdoe@nowhere.com</email>

     <occupation>none</occupation>

     <organization>RSNA</organization>

     <country>United States</country>

</author>

 

The author element specifies information specific to the author of the case.  This information is appended to the case’s private notes field when it is imported.  All of the sub-elements are optional.

 

<accessibility>Public</accessibility>

 

Accepted values:  Public, Private

 

accessibility determines who will be able to view the imported case.  If set to Public, the case will be viewable by all MyPACS users.  If set to Private, only the owner of the case and MyPACS administrators can view the case.  If this element is omitted, the imported case defaults to Private accessibility.

 

<modalities>MR, CT</modalities>

 

This element contains a comma-delimited list of modalities which correspond to the case’s contents.  Allowable modality values are currently:

 

‘CT’, ‘MR’, ‘US’, ‘Plain Film’, ‘Nuc Med’, ‘PET’, ‘GI’, ‘GU’, ‘Drain’, ‘Dilate’, ‘Inject’, ‘Biopsy’, ‘Embolization’, ‘Arthography’, ‘Myelography’, ‘Angiography’, and ‘Other’.

 

<pathology>Benign Mass, Cyst</pathology>

 

This element specifies the case’s pathology.  Only one value may be submitted per case.  Allowable values are currently:

 

'Congenital', 'Infection', 'Non-Infectious Inflammatory Disease',  'Benign Mass, Cyst', 'Neoplasm', 'Trauma', 'Normal/Variants',  'Iatrogenic', 'Metabolic', 'Hematological', 'Vascular', 'Other'. 

 

<anatomy>Skeletal System</anatomy>

 

This element specifies the case’s anatomic location.  Only one value may be submitted per case.  Allowable values are currently:

 

'Cranium and Contents', 'Face and Neck',  'Spine and Peripheral Nervous System',  'Skeletal System', 'Heart', 'Lung', 'Gastrointestinal (GI)', 'Genitourinary (GU)',  'Vascular/Lympatic', 'Breast', 'Other'.  .

 

<keywords>acl, cyst</keywords>

 

contains a comma-delimited list of keywords which can be used to facilitate searches for the imported case.

 

<date_imaged>2002-09-14</date_imaged>

 

contains the date the cases images were taken expressed in yyyy-mm-dd format.

 

<patient>

     <gender>Unknown</gender> -- allowable values: Unknown, M, F

     <age>

          <years>34</years>

          <months>6</months>

          <days>29</days>

            <age>

</patient>

 

years must be a whole integer, months an integer from 0 to 11, and days an integer from 0 to 30.

 

<acr>acr codes</acr>

 

contains a comma-delimited list of relevant acr codes.

 

<notes>text</notes>

<history>text</history>

<findings>text</findings>

<diagnosis>text</diagnosis>

<discussion>text</discussion>

<refs>text</refs

 

The above contain text strings which will be added to the case’s private notes, history, findings, diagnosis, discussion, and references fields, respectively.

 

 <case_images>…</case_images>

 

Each case can contain one (and only one) case_images elements which will contain one or more case_image elements for each of the case’s image that is being imported.  This is the one subelement of a case element which can be used elsewhere.  It can also be used as a child of a command element using the add_images action.

 

<case_image>

<url>25526.jpg</url>

</case_image>

 

Each case_image element contains one url element which specifies the location of the case image.   If the image is included in the zip archive, then the url element should simply specify the name of the image file: <url>25526.jpg</url>.   Alternatively, the image may reside on a web-accessible source, in which case the url element should point to the image on the web, e.g. <url>http://radpix.com/images/22526.jpg</url>.