Skip to Content

MIF (Member Information File) Imports API

Administrative endpoints for importing Member Information Files (MIF) containing ECM patient demographics and eligibility data.

Overview

MIF files are used to import ECM patient data from health plans. The system supports CSV, XML, and XLSX file formats. When imported, the system creates or updates patient records and their associated ECM eligibility information.

Import MIF File

Import a Member Information File to create or update ECM patient records.

Endpoint: POST /v1/admin/clinic/ecm/mifs
Authentication: Required (Admin role)

Request Body Parameters

ParameterTypeRequiredDescription
mifobjectYesMIF file data object
mif.filestringConditionalBase64-encoded file content with data URI prefix
mif.urlstringConditionalURL to fetch the file from
mif.pathstringConditionalServer-side file path
mif.file_typestringNoFile type: csv, xml, or xlsx (auto-detected if not provided)

Note: You must provide at least one of: file, url, or path.

File Format Requirements

CSV Format

  • Must include header row with field names
  • Field names are case-insensitive
  • Supports comma-separated or tab-separated values
  • All dates must be in MM-DD-YYYY format

XML Format

  • Must be well-formed XML
  • Root element can be <Members> or any other root tag
  • Each patient record should be in a <Member> element
  • Field names should match the MIF specification (uppercase recommended)

XLSX Format

  • Excel 2007+ format
  • First row should contain headers
  • Data rows follow the header row

Data URI Prefixes

File TypeData URI Prefix
CSVdata:text/csv;base64,
XMLdata:text/xml;base64,
XLSXdata:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,

Example Request - Base64 Upload

POST /v1/admin/clinic/ecm/mifs HTTP/1.1 Content-Type: application/json X-User-Token: your_admin_token_here { "mif": { "file": "data:text/csv;base64,TUVNQkVSX0lELEZJUlNUX05BTUUsTEFTVF9OQU1FLERPQg...", "file_type": "csv" } }

Example Request - URL Upload

POST /v1/admin/clinic/ecm/mifs HTTP/1.1 Content-Type: application/json X-User-Token: your_admin_token_here { "mif": { "url": "https://example.com/mif_file.csv", "file_type": "csv" } }

Success Response

{ "message": "MIF data imported successfully", "imported_count": 15, "mif_file_id": 1 }

Error Response

{ "errors": [ "Invalid CSV format: Unclosed quoted field on line 3", "Validation failed: Member ID can't be blank" ] }

Import Behavior

The MIF import process follows these rules:

  1. Patient Matching: Patients are matched by name. If a patient with the same name exists, their record is updated.
  2. New Patients: If no matching patient is found, a new patient record is created.
  3. Transaction Safety: All records are processed in a single database transaction. If any record fails validation, the entire import is rolled back.
  4. Provider Assignment: Patients are automatically assigned to the ECM provider caseload if the provider exists.
  5. Eligibility Association: All imported eligibility information records are associated with the MIF file for tracking.

MIF Field Mapping

MIF FieldDatabase FieldDescription
MEMBER_IDmember_idUnique member identifier (CIN)
CINcinClient Index Number
FIRST_NAMEfirst_namePatient first name
LAST_NAMElast_namePatient last name
DOBdate_of_birthDate of birth
GENDERgenderPatient gender
ADDRESSaddressStreet address
CITYcityCity
STATEstateState
ZIPzipZIP code
PHONEphonePhone number
ECM_SERVICE_AUTH_IDecm_service_auth_idECM service authorization ID
ECM_PROVIDER_NAMEecm_provider_nameECM provider name
ECM_NPIecm_npiECM provider NPI
ECM_BENEFIT_AUTH_EFF_DATEecm_benefit_auth_eff_dateAuthorization effective date
ECM_BENEFIT_AUTH_END_DATEecm_benefit_auth_end_dateAuthorization end date
ACUITY_LEVELacuity_levelPatient acuity level

List MIF Files

Retrieve a paginated list of all MIF files that have been uploaded and processed.

Endpoint: GET /v1/admin/clinic/ecm/mifs
Authentication: Required (Admin role)

Query Parameters

ParameterTypeRequiredDescription
per_pageintegerNoNumber of items per page (default: 25)
pageintegerNoPage number (default: 1)

Example Request

GET /v1/admin/clinic/ecm/mifs?per_page=10&page=1 HTTP/1.1 Content-Type: application/json X-User-Token: your_admin_token_here

Example Response

{ "mif_files": [ { "id": 1, "filename": "mif_20241124_120530.csv", "file_type": "csv", "source_type": "base64", "records_imported": 15, "import_errors": null, "status": "completed", "created_at": "2024-11-24T12:05:30.000Z", "updated_at": "2024-11-24T12:05:35.000Z", "file_url": "https://s3.amazonaws.com/bucket/path/to/file.csv?X-Amz-Algorithm=..." } ], "pagination": { "current_page": 1, "total_pages": 3, "total_count": 25, "per_page": 10 } }

Response Fields

FieldTypeDescription
idintegerUnique identifier for the MIF file
filenamestringGenerated filename for the uploaded file
file_typestringType of file: csv, xml, or xlsx
source_typestringHow the file was provided: base64, url, or path
records_importedintegerNumber of records successfully imported
import_errorsstringError messages if import failed (null if successful)
statusstringImport status: pending, processing, completed, failed
created_atstringTimestamp when the file was uploaded
updated_atstringTimestamp when the file was last updated
file_urlstringPresigned S3 URL to download the file (expires in 30 minutes)

Get MIF File Details

Retrieve details of a specific MIF file including all eligibility information records that were imported from it.

Endpoint: GET /v1/admin/clinic/ecm/mifs/{id}
Authentication: Required (Admin role)

Path Parameters

ParameterTypeRequiredDescription
idintegerYesMIF file ID

Example Request

GET /v1/admin/clinic/ecm/mifs/1 HTTP/1.1 Content-Type: application/json X-User-Token: your_admin_token_here

Example Response

{ "mif_file": { "id": 1, "filename": "mif_20241124_120530.csv", "file_type": "csv", "source_type": "base64", "records_imported": 15, "import_errors": null, "status": "completed", "created_at": "2024-11-24T12:05:30.000Z", "updated_at": "2024-11-24T12:05:35.000Z", "file_url": "https://s3.amazonaws.com/bucket/path/to/file.csv?X-Amz-Algorithm=...", "eligibility_informations": [ { "id": 123, "patient_id": 456, "patient_name": "John Doe", "member_id": "MEM0000000001", "cin": "CIN123456", "first_name": "John", "last_name": "Doe", "dob": "1990-01-01", "ecm_service_auth_id": "AUTH123456", "ecm_provider_name": "Esteem Health PSC", "member_record_status": "new_member", "created_at": "2024-11-24T12:05:32.000Z", "updated_at": "2024-11-24T12:05:32.000Z" } ] } }

JavaScript Example

const fileInput = document.querySelector('input[type="file"]'); const file = fileInput.files[0]; const reader = new FileReader(); reader.onloadend = function() { const base64String = reader.result; fetch('/v1/admin/clinic/ecm/mifs', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-User-Token': 'YOUR_TOKEN' }, body: JSON.stringify({ mif: { file: base64String, file_type: 'csv' } }) }) .then(response => response.json()) .then(data => console.log(data)); }; reader.readAsDataURL(file);

cURL Example

# Encode file to base64 BASE64_FILE=$(base64 -i member_info.csv | tr -d '\n') # Send request curl -X POST "https://your-api-domain.com/v1/admin/clinic/ecm/mifs" \ -H "Content-Type: application/json" \ -H "X-User-Token: YOUR_TOKEN" \ -d "{ \"mif\": { \"file\": \"data:text/csv;base64,${BASE64_FILE}\", \"file_type\": \"csv\" } }"

Error Responses

403 Forbidden

{ "errors": ["Admin access required"] }

404 Not Found

{ "errors": ["MIF file not found"] }

422 Unprocessable Entity

{ "errors": [ "Invalid CSV format: Unclosed quoted field on line 3", "Validation failed: Member ID can't be blank" ] }

Best Practices

  1. File Size: Keep files under 50MB for optimal performance
  2. Encoding: Always use base64 encoding for file uploads
  3. Data URI: Include the appropriate data URI prefix for better type detection
  4. Error Handling: Always check the import_errors field in file listings for any issues
  5. URL Expiration: Presigned URLs expire after 30 minutes - download files promptly
  6. Validation: Ensure all required fields are present before uploading
  7. Date Format: Use MM-DD-YYYY format for all date fields in CSV files