chb / indivo_server

The Indivo™ Personally Controlled Health Record
http://indivohealth.org
GNU General Public License v3.0
103 stars 40 forks source link

Documents are not processed if sent from a PHA #47

Closed kevingill1966 closed 11 years ago

kevingill1966 commented 11 years ago

I have a custom PHA that sends documents to Indivo Server. The documents are sent using the a Models (SDMX) format

<Models xmlns="http://indivo.org/vocab/xml/documents#">
<Model name="TestEncounter">
<Field name="date">2009-01-02</Field>
<Field name="provider">B</Field>
<Field name="location">C</Field>
</Model>
</Models>

The document is saved to the Record as a Document, but not to the data model.

There is a piece of code in Document.save() records_and_documents.py line 337 that prevents the document being processed.

  # Process the Doc, if necessary
  if not self.pha and self.content:
    doc.process()

It can import correctly if I alter this logic to...

  if self.content:
    doc.process()
Travers commented 11 years ago

That check is there since we don't process app-specific documents, only ones created on a Record. Have you added the TestEncounter model to your Indivo instance? If not, then I am guessing it is not processing to anything since you don't have a valid data model to process into.

kevingill1966 commented 11 years ago

Thanks for the response.

My error is that I used the record_app_document_create() api call rather than the document_create() api call. Once I used the correct API, it is working find.